diff options
author | Heiko Carstens <[email protected]> | 2016-12-12 16:43:09 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2016-12-12 18:55:07 -0800 |
commit | c7142aead87aa5026e4b57671c7dbb1706b02606 (patch) | |
tree | 174f043eb6436a684ef832f856f58221915b9241 | |
parent | c3352cbb1bdf198e81141700eb7003b8e2de1f1a (diff) |
mm/pkeys: generate pkey system call code only if ARCH_HAS_PKEYS is selected
Having code for the pkey_mprotect, pkey_alloc and pkey_free system calls
makes only sense if ARCH_HAS_PKEYS is selected. If not selected these
system calls will always return -ENOSPC or -EINVAL.
To simplify things and have less code generate the pkey system call code
only if ARCH_HAS_PKEYS is selected.
For architectures which have already wired up the system calls, but do
not select ARCH_HAS_PKEYS this will result in less generated code and a
different return code: the three system calls will now always return
-ENOSYS, using the cond_syscall mechanism.
For architectures which have not wired up the system calls less
unreachable code will be generated.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Heiko Carstens <[email protected]>
Acked-by: Dave Hansen <[email protected]>
Cc: Mark Rutland <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/mprotect.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c index c5ba2aae0f54..cc2459c57f60 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -497,6 +497,8 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, return do_mprotect_pkey(start, len, prot, -1); } +#ifdef CONFIG_ARCH_HAS_PKEYS + SYSCALL_DEFINE4(pkey_mprotect, unsigned long, start, size_t, len, unsigned long, prot, int, pkey) { @@ -547,3 +549,5 @@ SYSCALL_DEFINE1(pkey_free, int, pkey) */ return ret; } + +#endif /* CONFIG_ARCH_HAS_PKEYS */ |