aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/syscalls.h
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2018-07-11 09:56:50 -0400
committerWill Deacon <will.deacon@arm.com>2018-07-12 09:49:48 -0400
commitbf1c77b4644f46d2986b7ca5e43e012f0fc8984b (patch)
treedc904b18b02cbab1c85d6bd336869837e410ffe3 /include/linux/syscalls.h
parent80d63bc39f9ace9c1d2bef7f921d2f3ef2037d4b (diff)
kernel: add ksys_personality()
Using this helper allows us to avoid the in-kernel call to the sys_personality() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_personality(). Since ksys_personality is trivial, it is implemented directly in <linux/syscalls.h>, as we do for ksys_close() and friends. This helper is necessary to enable conversion of arm64's syscall handling to use pt_regs wrappers. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@infradead.org> Cc: Dave Martin <dave.martin@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'include/linux/syscalls.h')
-rw-r--r--include/linux/syscalls.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a368a68cb667..abfe12d8a9c5 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -80,6 +80,7 @@ union bpf_attr;
80#include <linux/unistd.h> 80#include <linux/unistd.h>
81#include <linux/quota.h> 81#include <linux/quota.h>
82#include <linux/key.h> 82#include <linux/key.h>
83#include <linux/personality.h>
83#include <trace/syscall.h> 84#include <trace/syscall.h>
84 85
85#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER 86#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
@@ -1281,4 +1282,14 @@ static inline long ksys_truncate(const char __user *pathname, loff_t length)
1281 return do_sys_truncate(pathname, length); 1282 return do_sys_truncate(pathname, length);
1282} 1283}
1283 1284
1285static inline unsigned int ksys_personality(unsigned int personality)
1286{
1287 unsigned int old = current->personality;
1288
1289 if (personality != 0xffffffff)
1290 set_personality(personality);
1291
1292 return old;
1293}
1294
1284#endif 1295#endif