diff options
| -rw-r--r-- | man2/pkey_alloc.2 | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/man2/pkey_alloc.2 b/man2/pkey_alloc.2 index 863332ced4..905be03eaf 100644 --- a/man2/pkey_alloc.2 +++ b/man2/pkey_alloc.2 @@ -37,30 +37,23 @@ pkey_alloc, pkey_free \- allocate or free a protection key allocates a protection key (pkey) and allows it to be passed to .BR pkey_mprotect (2). +The .BR pkey_alloc () -is always safe to call regardless of whether or not the operating system -supports protection keys. -It can be used in lieu of any other mechanism for detecting pkey support -and will simply fail with the error -.B ENOSPC -if the operating system has no pkey support. - -The kernel guarantees that the contents of the hardware rights -register (PKRU) will be preserved only for allocated protection -keys. -Any time a key is unallocated (either before the first call -returning that key from -.BR pkey_alloc () -or after it is freed via -.BR pkey_free ()), -the kernel may make arbitrary changes to the parts of the -rights register affecting access to that key. +.I flags +argument may contain zero or more disable operations: +.TP +.B PKEY_DISABLE_ACCESS +Disable all data access to memory covered by the returned protection key. +.TP +.B PKEY_DISABLE_WRITE +Disable write access to memory covered by the returned protection key. .PP .BR pkey_free () frees a protection key and makes it available for later allocations. After a protection key has been freed, it may no longer be used in any protection-key-related operations. + An application should not call .BR pkey_free () on any protection key which has been assigned to an address @@ -68,17 +61,6 @@ range by .BR pkey_mprotect (2) and which is still in use. The behavior in this case is undefined and may result in an error. -.PP -The -.BR pkey_alloc () -.I flags -argument may contain zero or more disable operations: -.TP -.B PKEY_DISABLE_ACCESS -Disable all data access to memory covered by the returned protection key. -.TP -.B PKEY_DISABLE_WRITE -Disable write access to memory covered by the returned protection key. .SH RETURN VALUE On success, .BR pkey_alloc () @@ -123,6 +105,25 @@ The and .BR pkey_free () system calls are Linux-specific. +.SH NOTES +.BR pkey_alloc () +is always safe to call regardless of whether or not the operating system +supports protection keys. +It can be used in lieu of any other mechanism for detecting pkey support +and will simply fail with the error +.B ENOSPC +if the operating system has no pkey support. + +The kernel guarantees that the contents of the hardware rights +register (PKRU) will be preserved only for allocated protection +keys. +Any time a key is unallocated (either before the first call +returning that key from +.BR pkey_alloc () +or after it is freed via +.BR pkey_free ()), +the kernel may make arbitrary changes to the parts of the +rights register affecting access to that key. .SH SEE ALSO .BR pkey_mprotect (2), .BR pkey (7) |
