From 5ac9efa3c50d7caff9f3933bb8a3ad1139d92d92 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 9 Apr 2018 12:51:43 +0200 Subject: syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention Tidy the naming convention for compat syscall subs. Hints which describe the purpose of the stub go in front and receive a double underscore to denote that they are generated on-the-fly by the COMPAT_SYSCALL_DEFINEx() macro. For the generic case, this means: t kernel_waitid # common C function (see kernel/exit.c) __do_compat_sys_waitid # inlined helper doing the actual work # (takes original parameters as declared) T __se_compat_sys_waitid # sign-extending C function calling inlined # helper (takes parameters of type long, # casts them to unsigned long and then to # the declared type) T compat_sys_waitid # alias to __se_compat_sys_waitid() # (taking parameters as declared), to # be included in syscall table For x86, the naming is as follows: t kernel_waitid # common C function (see kernel/exit.c) __do_compat_sys_waitid # inlined helper doing the actual work # (takes original parameters as declared) t __se_compat_sys_waitid # sign-extending C function calling inlined # helper (takes parameters of type long, # casts them to unsigned long and then to # the declared type) T __ia32_compat_sys_waitid # IA32_EMULATION 32-bit-ptregs -> C stub, # calls __se_compat_sys_waitid(); to be # included in syscall table T __x32_compat_sys_waitid # x32 64-bit-ptregs -> C stub, calls # __se_compat_sys_waitid(); to be included # in syscall table If only one of IA32_EMULATION and x32 is enabled, __se_compat_sys_waitid() may be inlined into the stub __{ia32,x32}_compat_sys_waitid(). Suggested-by: Ingo Molnar Signed-off-by: Dominik Brodowski Cc: Al Viro Cc: Andrew Morton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20180409105145.5364-3-linux@dominikbrodowski.net Signed-off-by: Ingo Molnar --- arch/x86/include/asm/syscall_wrapper.h | 44 +++++++++++++++++----------------- arch/x86/include/asm/syscalls.h | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'arch/x86/include/asm') diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h index 798a3c2bff4f..8d0951cfc2d4 100644 --- a/arch/x86/include/asm/syscall_wrapper.h +++ b/arch/x86/include/asm/syscall_wrapper.h @@ -29,11 +29,11 @@ * case as well. */ #define COMPAT_SC_IA32_STUBx(x, name, ...) \ - asmlinkage long __compat_sys_ia32##name(const struct pt_regs *regs);\ - ALLOW_ERROR_INJECTION(__compat_sys_ia32##name, ERRNO); \ - asmlinkage long __compat_sys_ia32##name(const struct pt_regs *regs)\ + asmlinkage long __ia32_compat_sys##name(const struct pt_regs *regs);\ + ALLOW_ERROR_INJECTION(__ia32_compat_sys##name, ERRNO); \ + asmlinkage long __ia32_compat_sys##name(const struct pt_regs *regs)\ { \ - return c_SyS##name(SC_IA32_REGS_TO_ARGS(x,__VA_ARGS__));\ + return __se_compat_sys##name(SC_IA32_REGS_TO_ARGS(x,__VA_ARGS__));\ } \ #define SC_IA32_WRAPPERx(x, name, ...) \ @@ -65,11 +65,11 @@ * with x86_64 obviously do not need such care. */ #define COMPAT_SC_X32_STUBx(x, name, ...) \ - asmlinkage long __compat_sys_x32##name(const struct pt_regs *regs);\ - ALLOW_ERROR_INJECTION(__compat_sys_x32##name, ERRNO); \ - asmlinkage long __compat_sys_x32##name(const struct pt_regs *regs)\ + asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\ + ALLOW_ERROR_INJECTION(__x32_compat_sys##name, ERRNO); \ + asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\ { \ - return c_SyS##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\ + return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\ } \ #else /* CONFIG_X86_X32 */ @@ -84,16 +84,16 @@ * of them. There is no need to implement COMPAT_SYSCALL_DEFINE0, as it is * unused on x86. */ -#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ - static long c_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ - static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ - COMPAT_SC_IA32_STUBx(x, name, __VA_ARGS__) \ - COMPAT_SC_X32_STUBx(x, name, __VA_ARGS__) \ - static long c_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ - { \ - return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ - } \ - static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) +#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ + static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ + static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ + COMPAT_SC_IA32_STUBx(x, name, __VA_ARGS__) \ + COMPAT_SC_X32_STUBx(x, name, __VA_ARGS__) \ + static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ + { \ + return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ + } \ + static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) /* * As some compat syscalls may not be implemented, we need to expand @@ -101,12 +101,12 @@ * kernel/time/posix-stubs.c to cover this case as well. */ #define COND_SYSCALL_COMPAT(name) \ - cond_syscall(__compat_sys_ia32_##name); \ - cond_syscall(__compat_sys_x32_##name) + cond_syscall(__ia32_compat_sys_##name); \ + cond_syscall(__x32_compat_sys_##name) #define COMPAT_SYS_NI(name) \ - SYSCALL_ALIAS(__compat_sys_ia32_##name, sys_ni_posix_timers); \ - SYSCALL_ALIAS(__compat_sys_x32_##name, sys_ni_posix_timers) + SYSCALL_ALIAS(__ia32_compat_sys_##name, sys_ni_posix_timers); \ + SYSCALL_ALIAS(__x32_compat_sys_##name, sys_ni_posix_timers) #endif /* CONFIG_COMPAT */ diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index d4d18d94695c..9fa979dd0d9d 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h @@ -20,7 +20,7 @@ long ksys_ioperm(unsigned long from, unsigned long num, int turn_on); #ifdef CONFIG_X86_32 -/* +/* * These definitions are only valid on pure 32-bit systems; x86-64 uses a * different syscall calling convention */ -- cgit v1.2.3