about summary refs log tree commit diff
path: root/support/xunistd.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-12-05 15:20:30 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-12-05 15:20:35 +0100
commit446d22e91d3113be57a4b0d1151cf337458c3bec (patch)
tree933a5832d0cbd3aed24a722f1b28a6aefd95fb6c /support/xunistd.h
parentda616c1496e2bd3022dbe4afdd162a80731c08ad (diff)
downloadglibc-446d22e91d3113be57a4b0d1151cf337458c3bec.tar.gz
glibc-446d22e91d3113be57a4b0d1151cf337458c3bec.tar.xz
glibc-446d22e91d3113be57a4b0d1151cf337458c3bec.zip
Linux: Implement interfaces for memory protection keys
This adds system call wrappers for pkey_alloc, pkey_free, pkey_mprotect,
and x86-64 implementations of pkey_get and pkey_set, which abstract over
the PKRU CPU register and hide the actual number of memory protection
keys supported by the CPU.  pkey_mprotect with a -1 key is implemented
using mprotect, so it will work even if the kernel does not support the
pkey_mprotect system call.

The system call wrapers use unsigned int instead of unsigned long for
parameters, so that no special treatment for x32 is needed.  The flags
argument is currently unused, and the access rights bit mask is limited
to two bits by the current PKRU register layout anyway.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'support/xunistd.h')
-rw-r--r--support/xunistd.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/support/xunistd.h b/support/xunistd.h
index 05c2626a7b..00376f7aae 100644
--- a/support/xunistd.h
+++ b/support/xunistd.h
@@ -39,6 +39,7 @@ void xstat (const char *path, struct stat64 *);
 void xmkdir (const char *path, mode_t);
 void xchroot (const char *path);
 void xunlink (const char *path);
+long xsysconf (int name);
 
 /* Read the link at PATH.  The caller should free the returned string
    with free.  */