]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
mprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0
authorMark Wielaard <mark@klomp.org>
Wed, 29 May 2019 23:08:39 +0000 (01:08 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Fri, 14 Jun 2019 15:06:50 +0000 (17:06 +0200)
The mprotect.2 NOTES say:

    On systems that do not support protection keys in
    hardware, pkey_mprotect() may still be used, but pkey must
    be set to 0.  When called this way, the operation of
    pkey_mprotect() is equivalent to mprotect().

But this is not what the glibc manual says:

    It is also possible to call pkey_mprotect with a key value
    of -1, in which case it will behave in the same way as
    mprotect.

Which is correct. Both the glibc implementation and the
kernel check whether pkey is -1. 0 is not a valid pkey when
memory protection keys are not supported in hardware.

Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/mprotect.2

index 9bb02eb1b33a27b200b676d22630eeb8b19febaf..cbbfd51377fde0ccee9bfda7fee30bf56c9a8804 100644 (file)
@@ -274,7 +274,7 @@ On systems that do not support protection keys in hardware,
 .BR pkey_mprotect ()
 may still be used, but
 .IR pkey
-must be set to 0.
+must be set to -1.
 When called this way, the operation of
 .BR pkey_mprotect ()
 is equivalent to