diff options
author | Rohan McLure <rmclure@linux.ibm.com> | 2022-09-21 16:55:58 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-09-28 19:22:09 +1000 |
commit | 8640de0dee49cec50040d9845a2bc96fd15adc9e (patch) | |
tree | a46b6ff4196c2cd9c57396a44a13d4d691b77cf6 /arch/powerpc/include/asm | |
parent | powerpc: Enable compile-time check for syscall handlers (diff) | |
download | linux-dev-8640de0dee49cec50040d9845a2bc96fd15adc9e.tar.xz linux-dev-8640de0dee49cec50040d9845a2bc96fd15adc9e.zip |
powerpc: Use common syscall handler type
Cause syscall handlers to be typed as follows when called indirectly
throughout the kernel. This is to allow for better type checking.
typedef long (*syscall_fn)(unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long);
Since both 32 and 64-bit abis allow for at least the first six
machine-word length parameters to a function to be passed by registers,
even handlers which admit fewer than six parameters may be viewed as
having the above type.
Coercing syscalls to syscall_fn requires a cast to void* to avoid
-Wcast-function-type.
Fixup comparisons in VDSO to avoid pointer-integer comparison. Introduce
explicit cast on systems with SPUs.
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220921065605.1051927-19-rmclure@linux.ibm.com
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r-- | arch/powerpc/include/asm/syscall.h | 7 | ||||
-rw-r--r-- | arch/powerpc/include/asm/syscalls.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h index 25fc8ad9a27a..d2a8dfd5de33 100644 --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -14,9 +14,12 @@ #include <linux/sched.h> #include <linux/thread_info.h> +typedef long (*syscall_fn)(unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long, unsigned long); + /* ftrace syscalls requires exporting the sys_call_table */ -extern const unsigned long sys_call_table[]; -extern const unsigned long compat_sys_call_table[]; +extern const syscall_fn sys_call_table[]; +extern const syscall_fn compat_sys_call_table[]; static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h index 7911738ad4a9..211bb8393dee 100644 --- a/arch/powerpc/include/asm/syscalls.h +++ b/arch/powerpc/include/asm/syscalls.h @@ -8,6 +8,7 @@ #include <linux/types.h> #include <linux/compat.h> +#include <asm/syscall.h> #ifdef CONFIG_PPC64 #include <asm/syscalls_32.h> #endif |