]> git.saurik.com Git - apple/libpthread.git/blame - man/pthread_jit_write_protect_np.3
libpthread-454.100.8.tar.gz
[apple/libpthread.git] / man / pthread_jit_write_protect_np.3
CommitLineData
c1f56ec9
A
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
36The
37.Fn pthread_jit_write_protect_supported_np
38function returns whether the
39.Fn pthread_jit_write_protect_np
40API is supported on this platform. If
41.Fn pthread_jit_write_protect_np
42API is supported on this platform,
43.Fn pthread_jit_write_protect_np
44must 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
46The
47.Fn pthread_jit_write_protect_np
48function sets whether MAP_JIT region write protection is enabled for this thread.
49.Pp
50On platforms where
51.Fn pthread_jit_write_protect_supported_np
52is true, MAP_JIT regions are never writeable and executable simultaneously.
53When 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.
54When 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.
55Pass a non-zero value for the
56.Fa enabled
57parameter to enable thread JIT region write protection and allow execution. Pass a zero value for the
58.Fa enabled
59parameter to disable thread JIT write protection and deny execution.
60.Pp
61On platforms where
62.Fn pthread_jit_write_protect_supported_np
63is not supported, MAP_JIT regions are both simultaenously writeable and executable. Calls to
64.Fn pthread_jit_write_protect_np
65are no-ops on unsupported platforms.
66.Sh RETURN VALUES
67If supported, the
68.Fn pthread_jit_write_protect_supported_np
69function will return one. Otherwise the function will return zero.
70.Sh SEE ALSO
71.Xr mmap 2