Skip to content

Commit 39859ae

Browse files
rohanmclurempe
authored andcommitted
powerpc: Enable compile-time check for syscall handlers
The table of syscall handlers and registered compatibility syscall handlers has in past been produced using assembly, with function references resolved at link time. This moves link-time errors to compile-time, by rewriting systbl.S in C, and including the linux/syscalls.h, linux/compat.h and asm/syscalls.h headers for prototypes. Reported-by: Arnd Bergmann <arnd@arndb.de> 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-18-rmclure@linux.ibm.com
1 parent 8cd1def commit 39859ae

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

arch/powerpc/kernel/systbl.S renamed to arch/powerpc/kernel/systbl.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,26 @@
1010
* PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
1111
*/
1212

13-
#include <asm/ppc_asm.h>
13+
#include <linux/syscalls.h>
14+
#include <linux/compat.h>
15+
#include <asm/unistd.h>
16+
#include <asm/syscalls.h>
1417

15-
#ifdef CONFIG_RELOCATABLE
16-
.section .data.rel.ro,"aw"
17-
#else
18-
.section .rodata,"a"
19-
#endif
18+
#define __SYSCALL_WITH_COMPAT(nr, entry, compat) __SYSCALL(nr, entry)
19+
#define __SYSCALL(nr, entry) [nr] = (unsigned long) &entry,
2020

21-
#ifdef CONFIG_PPC64
22-
.p2align 3
23-
#define __SYSCALL(nr, entry) .8byte entry
24-
#else
25-
.p2align 2
26-
#define __SYSCALL(nr, entry) .long entry
27-
#endif
28-
29-
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
30-
.globl sys_call_table
31-
sys_call_table:
21+
const unsigned long sys_call_table[] = {
3222
#ifdef CONFIG_PPC64
3323
#include <asm/syscall_table_64.h>
3424
#else
3525
#include <asm/syscall_table_32.h>
3626
#endif
27+
};
3728

3829
#ifdef CONFIG_COMPAT
3930
#undef __SYSCALL_WITH_COMPAT
4031
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat)
41-
.globl compat_sys_call_table
42-
compat_sys_call_table:
43-
#define compat_sys_sigsuspend sys_sigsuspend
32+
const unsigned long compat_sys_call_table[] = {
4433
#include <asm/syscall_table_32.h>
45-
#endif
34+
};
35+
#endif /* CONFIG_COMPAT */

0 commit comments

Comments
 (0)