From: Mark Rutland Date: Wed, 11 Jul 2018 13:56:50 +0000 (+0100) Subject: kernel: add ksys_personality() X-Git-Tag: v5.15~8199^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf1c77b4644f46d2986b7ca5e43e012f0fc8984b;p=platform%2Fkernel%2Flinux-starfive.git 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 , 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 Reviewed-by: Dominik Brodowski Cc: Al Viro Cc: Christoph Hellwig Cc: Dave Martin Signed-off-by: Will Deacon --- diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index a368a68..abfe12d 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -80,6 +80,7 @@ union bpf_attr; #include #include #include +#include #include #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER @@ -1281,4 +1282,14 @@ static inline long ksys_truncate(const char __user *pathname, loff_t length) return do_sys_truncate(pathname, length); } +static inline unsigned int ksys_personality(unsigned int personality) +{ + unsigned int old = current->personality; + + if (personality != 0xffffffff) + set_personality(personality); + + return old; +} + #endif