Re: [PATCH 25/25] x86, pkeys: Documentation
From: Dave Hansen
Date: Mon Sep 28 2015 - 16:42:07 EST
On 09/28/2015 01:34 PM, Andi Kleen wrote:
> Do you have a manpage for the new syscall too?
Yep, I just added it to the mprotect() manpage.
diff --git a/man2/mprotect.2 b/man2/mprotect.2
index ae305f6..5ba6c58 100644
--- a/man2/mprotect.2
+++ b/man2/mprotect.2
@@ -38,16 +38,19 @@
.\"
.TH MPROTECT 2 2015-07-23 "Linux" "Linux Programmer's Manual"
.SH NAME
-mprotect \- set protection on a region of memory
+mprotect, mprotect_key \- set protection on a region of memory
.SH SYNOPSIS
.nf
.B #include <sys/mman.h>
.sp
.BI "int mprotect(void *" addr ", size_t " len ", int " prot );
+.BI "int mprotect_key(void *" addr ", size_t " len ", int " prot , " unsigned long " key);
.fi
.SH DESCRIPTION
.BR mprotect ()
-changes protection for the calling process's memory page(s)
+and
+.BR mprotect_key ()
+change protection for the calling process's memory page(s)
containing any part of the address range in the
interval [\fIaddr\fP,\ \fIaddr\fP+\fIlen\fP\-1].
.I addr
@@ -74,10 +77,18 @@ The memory can be modified.
.TP
.B PROT_EXEC
The memory can be executed.
+.PP
+.I key
+is the protection or storage key to assign to the memory.
+The number of keys supported is dependent on the architecture
+and is always at least one.
+The default key is 0.
.SH RETURN VALUE
On success,
.BR mprotect ()
-returns zero.
+and
+.BR mprotect_key ()
+return zero.
On error, \-1 is returned, and
.I errno
is set appropriately.