1 .\" Copyright (c) 2020 Apple Inc. All rights reserved.
3 .\" @APPLE_LICENSE_HEADER_START@
5 .\" This file contains Original Code and/or Modifications of Original Code
6 .\" as defined in and that are subject to the Apple Public Source License
7 .\" Version 2.0 (the 'License'). You may not use this file except in
8 .\" compliance with the License. Please obtain a copy of the License at
9 .\" http://www.opensource.apple.com/apsl/ and read it before using this
12 .\" The Original Code and all software distributed under the License are
13 .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 .\" Please see the License for the specific language governing rights and
18 .\" limitations under the License.
20 .\" @APPLE_LICENSE_HEADER_END@
23 .Dt PTHREAD_JIT_WRITE_PROTECT_NP 3
26 .Nm pthread_jit_write_protect_supported_np ,
27 .Nm pthread_jit_write_protect_np
28 .Nd thread JIT region write protection settings
32 .Fn pthread_jit_write_protect_supported_np "void"
34 .Fn pthread_jit_write_protect_np "int enabled"
37 .Fn pthread_jit_write_protect_supported_np
38 function returns whether the
39 .Fn pthread_jit_write_protect_np
40 API is supported on this platform. If
41 .Fn pthread_jit_write_protect_np
42 API is supported on this platform,
43 .Fn pthread_jit_write_protect_np
44 must be called to toggle per-thread write protection on the MAP_JIT region before the thread writes to or executes from the MAP_JIT region.
47 .Fn pthread_jit_write_protect_np
48 function sets whether MAP_JIT region write protection is enabled for this thread.
51 .Fn pthread_jit_write_protect_supported_np
52 is true, MAP_JIT regions are never writeable and executable simultaneously.
53 When write protection is enabled for the thread, writes by the thread to the MAP_JIT region are denied and the MAP_JIT region is executable.
54 When write protection is disabled for the thread, writes by the thread to the MAP_JIT region are allowed and the MAP_JIT region is not executable.
55 Pass a non-zero value for the
57 parameter to enable thread JIT region write protection and allow execution. Pass a zero value for the
59 parameter to disable thread JIT write protection and deny execution.
62 .Fn pthread_jit_write_protect_supported_np
63 is not supported, MAP_JIT regions are both simultaenously writeable and executable. Calls to
64 .Fn pthread_jit_write_protect_np
65 are no-ops on unsupported platforms.
68 .Fn pthread_jit_write_protect_supported_np
69 function will return one. Otherwise the function will return zero.