Skip to content

Commit 2fd0eba

Browse files
sohilmeharndb
authored andcommitted
arch: Reserve map_shadow_stack() syscall number for all architectures
commit c35559f ("x86/shstk: Introduce map_shadow_stack syscall") recently added support for map_shadow_stack() but it is limited to x86 only for now. There is a possibility that other architectures (namely, arm64 and RISC-V), that are implementing equivalent support for shadow stacks, might need to add support for it. Independent of that, reserving arch-specific syscall numbers in the syscall tables of all architectures is good practice and would help avoid future conflicts. map_shadow_stack() is marked as a conditional syscall in sys_ni.c. Adding it to the syscall tables of other architectures is harmless and would return ENOSYS when exercised. Note, map_shadow_stack() was assigned #453 during the merge process since torvalds#452 was taken by fchmodat2(). For Powerpc, map it to sys_ni_syscall() as is the norm for Powerpc syscall tables. For Alpha, map_shadow_stack() takes up torvalds#563 as Alpha still diverges from the common syscall numbering system in the other architectures. Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Sohil Mehta <[email protected]> Reviewed-by: Rick Edgecombe <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Acked-by: Michael Ellerman <[email protected]> (powerpc) Acked-by: Catalin Marinas <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent ccab211 commit 2fd0eba

File tree

17 files changed

+21
-2
lines changed

17 files changed

+21
-2
lines changed

arch/alpha/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -492,3 +492,4 @@
492492
560 common set_mempolicy_home_node sys_ni_syscall
493493
561 common cachestat sys_cachestat
494494
562 common fchmodat2 sys_fchmodat2
495+
563 common map_shadow_stack sys_map_shadow_stack

arch/arm/tools/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -466,3 +466,4 @@
466466
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
467467
451 common cachestat sys_cachestat
468468
452 common fchmodat2 sys_fchmodat2
469+
453 common map_shadow_stack sys_map_shadow_stack

arch/arm64/include/asm/unistd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
4040
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
4141

42-
#define __NR_compat_syscalls 453
42+
#define __NR_compat_syscalls 454
4343
#endif
4444

4545
#define __ARCH_WANT_SYS_CLONE

arch/arm64/include/asm/unistd32.h

+2
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,8 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
911911
__SYSCALL(__NR_cachestat, sys_cachestat)
912912
#define __NR_fchmodat2 452
913913
__SYSCALL(__NR_fchmodat2, sys_fchmodat2)
914+
#define __NR_map_shadow_stack 453
915+
__SYSCALL(__NR_map_shadow_stack, sys_map_shadow_stack)
914916

915917
/*
916918
* Please add new compat syscalls above this comment and update

arch/m68k/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,4 @@
452452
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
453453
451 common cachestat sys_cachestat
454454
452 common fchmodat2 sys_fchmodat2
455+
453 common map_shadow_stack sys_map_shadow_stack

arch/microblaze/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,4 @@
458458
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
459459
451 common cachestat sys_cachestat
460460
452 common fchmodat2 sys_fchmodat2
461+
453 common map_shadow_stack sys_map_shadow_stack

arch/mips/kernel/syscalls/syscall_n32.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,4 @@
391391
450 n32 set_mempolicy_home_node sys_set_mempolicy_home_node
392392
451 n32 cachestat sys_cachestat
393393
452 n32 fchmodat2 sys_fchmodat2
394+
453 n32 map_shadow_stack sys_map_shadow_stack

arch/mips/kernel/syscalls/syscall_n64.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,4 @@
367367
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
368368
451 n64 cachestat sys_cachestat
369369
452 n64 fchmodat2 sys_fchmodat2
370+
453 n64 map_shadow_stack sys_map_shadow_stack

arch/mips/kernel/syscalls/syscall_o32.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,4 @@
440440
450 o32 set_mempolicy_home_node sys_set_mempolicy_home_node
441441
451 o32 cachestat sys_cachestat
442442
452 o32 fchmodat2 sys_fchmodat2
443+
453 o32 map_shadow_stack sys_map_shadow_stack

arch/parisc/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -451,3 +451,4 @@
451451
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
452452
451 common cachestat sys_cachestat
453453
452 common fchmodat2 sys_fchmodat2
454+
453 common map_shadow_stack sys_map_shadow_stack

arch/powerpc/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -539,3 +539,4 @@
539539
450 nospu set_mempolicy_home_node sys_set_mempolicy_home_node
540540
451 common cachestat sys_cachestat
541541
452 common fchmodat2 sys_fchmodat2
542+
453 common map_shadow_stack sys_ni_syscall

arch/s390/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,4 @@
455455
450 common set_mempolicy_home_node sys_set_mempolicy_home_node sys_set_mempolicy_home_node
456456
451 common cachestat sys_cachestat sys_cachestat
457457
452 common fchmodat2 sys_fchmodat2 sys_fchmodat2
458+
453 common map_shadow_stack sys_map_shadow_stack sys_map_shadow_stack

arch/sh/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,4 @@
455455
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
456456
451 common cachestat sys_cachestat
457457
452 common fchmodat2 sys_fchmodat2
458+
453 common map_shadow_stack sys_map_shadow_stack

arch/sparc/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,4 @@
498498
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
499499
451 common cachestat sys_cachestat
500500
452 common fchmodat2 sys_fchmodat2
501+
453 common map_shadow_stack sys_map_shadow_stack

arch/x86/entry/syscalls/syscall_32.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,4 @@
457457
450 i386 set_mempolicy_home_node sys_set_mempolicy_home_node
458458
451 i386 cachestat sys_cachestat
459459
452 i386 fchmodat2 sys_fchmodat2
460+
453 i386 map_shadow_stack sys_map_shadow_stack

arch/xtensa/kernel/syscalls/syscall.tbl

+1
Original file line numberDiff line numberDiff line change
@@ -423,3 +423,4 @@
423423
450 common set_mempolicy_home_node sys_set_mempolicy_home_node
424424
451 common cachestat sys_cachestat
425425
452 common fchmodat2 sys_fchmodat2
426+
453 common map_shadow_stack sys_map_shadow_stack

include/uapi/asm-generic/unistd.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,11 @@ __SYSCALL(__NR_cachestat, sys_cachestat)
823823
#define __NR_fchmodat2 452
824824
__SYSCALL(__NR_fchmodat2, sys_fchmodat2)
825825

826+
#define __NR_map_shadow_stack 453
827+
__SYSCALL(__NR_map_shadow_stack, sys_map_shadow_stack)
828+
826829
#undef __NR_syscalls
827-
#define __NR_syscalls 453
830+
#define __NR_syscalls 454
828831

829832
/*
830833
* 32 bit systems traditionally used different

0 commit comments

Comments
 (0)