mirror of https://github.com/mkerrisk/man-pages
pkey_alloc.2: Various tweaks to the text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
79a2a43713
commit
b638d22097
|
@ -34,14 +34,17 @@ pkey_alloc, pkey_free \- allocate or free a protection key
|
|||
.fi
|
||||
.SH DESCRIPTION
|
||||
.BR pkey_alloc ()
|
||||
allocates a protection key and allows it to be passed to
|
||||
.BR pkey_mprotect (2) .
|
||||
allocates a protection key (pkey) and allows it to be passed to
|
||||
.BR pkey_mprotect (2).
|
||||
|
||||
.BR pkey_alloc ()
|
||||
is always safe to call whether or not the operating system
|
||||
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 enumeration of the feature
|
||||
and will simply return ENOSPC in the case that the operating
|
||||
system has no protection keys support.
|
||||
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.
|
||||
|
@ -49,8 +52,8 @@ 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
|
||||
.BR pkey_free ()),
|
||||
the kernel may make arbitrary changes to the parts of the
|
||||
rights register affecting access to that key.
|
||||
.PP
|
||||
.BR pkey_free ()
|
||||
|
@ -63,12 +66,13 @@ An application should not call
|
|||
on any protection key which has been assigned to an address
|
||||
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.
|
||||
and which is still in use.
|
||||
The behavior in this case is undefined and may result in an error.
|
||||
.PP
|
||||
.RB ( pkey_alloc ())
|
||||
The
|
||||
.BR pkey_alloc ()
|
||||
.I flags
|
||||
may contain zero or more disable operations:
|
||||
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.
|
||||
|
@ -94,31 +98,31 @@ or
|
|||
is invalid.
|
||||
.TP
|
||||
.B ENOSPC
|
||||
.(RB pkey_alloc ())
|
||||
.RB ( pkey_alloc ())
|
||||
All protection keys available for the current process have
|
||||
been allocated.
|
||||
The number of keys available is architecture-specific and
|
||||
implementation-specfic and may be reduced by kernel-internal use
|
||||
implementation-specific and may be reduced by kernel-internal use
|
||||
of certain keys.
|
||||
There are currently 15 keys available to user programs on x86.
|
||||
This will also be returned if the processor or operating system
|
||||
|
||||
This error will also be returned if the processor or operating system
|
||||
does not support protection keys.
|
||||
Applications should always be prepared to handle this error since
|
||||
Applications should always be prepared to handle this error, since
|
||||
factors outside of the application's control can reduce the number
|
||||
of available pkeys.
|
||||
.SH VERSIONS
|
||||
.BR pkey_alloc ()
|
||||
and
|
||||
.BR pkey_free ()
|
||||
were added to Linux in kernel <FIXME>;
|
||||
library support was added to glibc in version <FIXME>.
|
||||
were added to Linux in kernel 4.9.
|
||||
Glibc support is not yet available.
|
||||
.SH CONFORMING TO
|
||||
The
|
||||
.BR pkey_alloc ()
|
||||
and
|
||||
.BR pkey_free ()
|
||||
system calls are Linux-specific.
|
||||
.SH
|
||||
.SH SEE ALSO
|
||||
.BR pkey_mprotect (2),
|
||||
.BR pkey (7)
|
||||
|
|
Loading…
Reference in New Issue