]> git.saurik.com Git - apple/libpthread.git/blob - man/pthread_jit_write_protect_np.3
libpthread-454.100.8.tar.gz
[apple/libpthread.git] / man / pthread_jit_write_protect_np.3
1 .\" Copyright (c) 2020 Apple Inc. All rights reserved.
2 .\"
3 .\" @APPLE_LICENSE_HEADER_START@
4 .\"
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
10 .\" file.
11 .\"
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.
19 .\"
20 .\" @APPLE_LICENSE_HEADER_END@
21 .\"
22 .Dd May 1, 2020
23 .Dt PTHREAD_JIT_WRITE_PROTECT_NP 3
24 .Os
25 .Sh NAME
26 .Nm pthread_jit_write_protect_supported_np ,
27 .Nm pthread_jit_write_protect_np
28 .Nd thread JIT region write protection settings
29 .Sh SYNOPSIS
30 .In pthread.h
31 .Ft int
32 .Fn pthread_jit_write_protect_supported_np "void"
33 .Ft void
34 .Fn pthread_jit_write_protect_np "int enabled"
35 .Sh DESCRIPTION
36 The
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.
45 .Pp
46 The
47 .Fn pthread_jit_write_protect_np
48 function sets whether MAP_JIT region write protection is enabled for this thread.
49 .Pp
50 On platforms where
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
56 .Fa enabled
57 parameter to enable thread JIT region write protection and allow execution. Pass a zero value for the
58 .Fa enabled
59 parameter to disable thread JIT write protection and deny execution.
60 .Pp
61 On platforms where
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.
66 .Sh RETURN VALUES
67 If supported, the
68 .Fn pthread_jit_write_protect_supported_np
69 function will return one. Otherwise the function will return zero.
70 .Sh SEE ALSO
71 .Xr mmap 2