linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
@ 2023-09-14 18:58 Sohil Mehta
  2023-09-14 22:08 ` Edgecombe, Rick P
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Sohil Mehta @ 2023-09-14 18:58 UTC (permalink / raw)
  To: linux-api, linux-arch
  Cc: Sohil Mehta, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E . J . Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Chris Zankel, Max Filippov, Arnd Bergmann,
	Peter Zijlstra, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Lukas Bulwahn, Sergei Trofimovich, Andrew Morton,
	Rohan McLure, Andreas Schwab, Eric W . Biederman, Brian Gerst,
	Randy Dunlap, Rick Edgecombe, Mark Brown, Deepak Gupta,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-ia64,
	linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
	linux-sh, sparclinux, linux-perf-users

commit c35559f94ebc ("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 #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 #563 as Alpha still diverges from
the common syscall numbering system in the other architectures.

Link: https://lore.kernel.org/lkml/20230515212255.GA562920@debug.ba.rivosinc.com/
Link: https://lore.kernel.org/lkml/b402b80b-a7c6-4ef0-b977-c0f5f582b78a@sirena.org.uk/

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
---
v2:
- Skip syscall table changes to tools/. They will be handled separetely by the
  perf folks.
- Map Powerpc to sys_ni_syscall (Rick Edgecombe)
---
 arch/alpha/kernel/syscalls/syscall.tbl      | 1 +
 arch/arm/tools/syscall.tbl                  | 1 +
 arch/arm64/include/asm/unistd.h             | 2 +-
 arch/arm64/include/asm/unistd32.h           | 2 ++
 arch/ia64/kernel/syscalls/syscall.tbl       | 1 +
 arch/m68k/kernel/syscalls/syscall.tbl       | 1 +
 arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
 arch/mips/kernel/syscalls/syscall_n32.tbl   | 1 +
 arch/mips/kernel/syscalls/syscall_n64.tbl   | 1 +
 arch/mips/kernel/syscalls/syscall_o32.tbl   | 1 +
 arch/parisc/kernel/syscalls/syscall.tbl     | 1 +
 arch/powerpc/kernel/syscalls/syscall.tbl    | 1 +
 arch/s390/kernel/syscalls/syscall.tbl       | 1 +
 arch/sh/kernel/syscalls/syscall.tbl         | 1 +
 arch/sparc/kernel/syscalls/syscall.tbl      | 1 +
 arch/x86/entry/syscalls/syscall_32.tbl      | 1 +
 arch/xtensa/kernel/syscalls/syscall.tbl     | 1 +
 include/uapi/asm-generic/unistd.h           | 5 ++++-
 18 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index ad37569d0507..6e8479c96e65 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -492,3 +492,4 @@
 560	common	set_mempolicy_home_node		sys_ni_syscall
 561	common	cachestat			sys_cachestat
 562	common	fchmodat2			sys_fchmodat2
+563	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index c572d6c3dee0..6d494dfbf5e4 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -466,3 +466,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index bd77253b62e0..6a28fb91b85d 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -39,7 +39,7 @@
 #define __ARM_NR_compat_set_tls		(__ARM_NR_COMPAT_BASE + 5)
 #define __ARM_NR_COMPAT_END		(__ARM_NR_COMPAT_BASE + 0x800)
 
-#define __NR_compat_syscalls		453
+#define __NR_compat_syscalls		454
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 78b68311ec81..a201d842ec82 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -911,6 +911,8 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
 __SYSCALL(__NR_cachestat, sys_cachestat)
 #define __NR_fchmodat2 452
 __SYSCALL(__NR_fchmodat2, sys_fchmodat2)
+#define __NR_map_shadow_stack 453
+__SYSCALL(__NR_map_shadow_stack, sys_map_shadow_stack)
 
 /*
  * Please add new compat syscalls above this comment and update
diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl
index 83d8609aec03..be02ce9d376f 100644
--- a/arch/ia64/kernel/syscalls/syscall.tbl
+++ b/arch/ia64/kernel/syscalls/syscall.tbl
@@ -373,3 +373,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index 259ceb125367..bee2d2f7f82c 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -452,3 +452,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index a3798c2637fd..09eda7ed91b0 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -458,3 +458,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index 152034b8e0a0..3c02cc3886ca 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -391,3 +391,4 @@
 450	n32	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	n32	cachestat			sys_cachestat
 452	n32	fchmodat2			sys_fchmodat2
+453	n32	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
index cb5e757f6621..aa9ed6a7cb48 100644
--- a/arch/mips/kernel/syscalls/syscall_n64.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
@@ -367,3 +367,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	n64	cachestat			sys_cachestat
 452	n64	fchmodat2			sys_fchmodat2
+453	n64	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 1a646813afdc..756f6feb21c2 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -440,3 +440,4 @@
 450	o32	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	o32	cachestat			sys_cachestat
 452	o32	fchmodat2			sys_fchmodat2
+453	o32	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
index e97c175b56f9..c80eedbe0170 100644
--- a/arch/parisc/kernel/syscalls/syscall.tbl
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -451,3 +451,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 20e50586e8a2..87a54acf8346 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -539,3 +539,4 @@
 450 	nospu	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_ni_syscall
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 0122cc156952..22249c07e556 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -455,3 +455,4 @@
 450  common	set_mempolicy_home_node	sys_set_mempolicy_home_node	sys_set_mempolicy_home_node
 451  common	cachestat		sys_cachestat			sys_cachestat
 452  common	fchmodat2		sys_fchmodat2			sys_fchmodat2
+453  common	map_shadow_stack	sys_map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index e90d585c4d3e..5ccfe6fbb6b1 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -455,3 +455,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 4ed06c71c43f..b2d664edebdd 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -498,3 +498,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index 2d0b1bd866ea..743a7ef5a4b9 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -457,3 +457,4 @@
 450	i386	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	i386	cachestat		sys_cachestat
 452	i386	fchmodat2		sys_fchmodat2
+453	i386	map_shadow_stack	sys_map_shadow_stack
diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
index fc1a4f3c81d9..94e6bcc2bec7 100644
--- a/arch/xtensa/kernel/syscalls/syscall.tbl
+++ b/arch/xtensa/kernel/syscalls/syscall.tbl
@@ -423,3 +423,4 @@
 450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
 451	common	cachestat			sys_cachestat
 452	common	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index abe087c53b4b..203ae30d7761 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -823,8 +823,11 @@ __SYSCALL(__NR_cachestat, sys_cachestat)
 #define __NR_fchmodat2 452
 __SYSCALL(__NR_fchmodat2, sys_fchmodat2)
 
+#define __NR_map_shadow_stack 453
+__SYSCALL(__NR_map_shadow_stack, sys_map_shadow_stack)
+
 #undef __NR_syscalls
-#define __NR_syscalls 453
+#define __NR_syscalls 454
 
 /*
  * 32 bit systems traditionally used different
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-09-14 18:58 [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
@ 2023-09-14 22:08 ` Edgecombe, Rick P
  2023-09-15  3:23 ` Michael Ellerman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Edgecombe, Rick P @ 2023-09-14 22:08 UTC (permalink / raw)
  To: Mehta, Sohil, linux-arch@vger.kernel.org,
	linux-api@vger.kernel.org
  Cc: svens@linux.ibm.com, catalin.marinas@arm.com,
	schwab@linux-m68k.org, brgerst@gmail.com,
	alexander.shishkin@linux.intel.com,
	linux-perf-users@vger.kernel.org, x86@kernel.org,
	monstr@monstr.eu, borntraeger@linux.ibm.com,
	dave.hansen@linux.intel.com, christophe.leroy@csgroup.eu,
	mark.rutland@arm.com, glaubitz@physik.fu-berlin.de,
	dalias@libc.org, lukas.bulwahn@gmail.com, rdunlap@infradead.org,
	tglx@linutronix.de, hca@linux.ibm.com, linux@armlinux.org.uk,
	sparclinux@vger.kernel.org, arnd@arndb.de,
	linux-ia64@vger.kernel.org, ebiederm@xmission.com,
	Lutomirski, Andy, jolsa@kernel.org, linux-kernel@vger.kernel.org,
	linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org,
	akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org,
	mpe@ellerman.id.au, geert@linux-m68k.org, hpa@zytor.com,
	James.Bottomley@HansenPartnership.com, peterz@infradead.org,
	ink@jurassic.park.msu.ru, linux-m68k@lists.linux-m68k.org,
	tsbogend@alpha.franken.de, broonie@kernel.org, Hunter, Adrian,
	acme@kernel.org, ysato@users.sourceforge.jp, deller@gmx.de,
	debug@rivosinc.com, rmclure@linux.ibm.com, gor@linux.ibm.com,
	slyich@gmail.com, npiggin@gmail.com, agordeev@linux.ibm.com,
	chris@zankel.net, mingo@redhat.com, linux-alpha@vger.kernel.org,
	linux-mips@vger.kernel.org, mattst88@gmail.com,
	linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	jcmvbkbc@gmail.com, bp@alien8.de, richard.henderson@linaro.org,
	irogers@google.com, namhyung@kernel.org, will@kernel.org,
	davem@davemloft.net

On Thu, 2023-09-14 at 18:58 +0000, Sohil Mehta wrote:
> commit c35559f94ebc ("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 #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 #563 as Alpha still diverges
> from
> the common syscall numbering system in the other architectures.

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-09-14 18:58 [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
  2023-09-14 22:08 ` Edgecombe, Rick P
@ 2023-09-15  3:23 ` Michael Ellerman
  2023-10-03 16:35 ` Sohil Mehta
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Michael Ellerman @ 2023-09-15  3:23 UTC (permalink / raw)
  To: Sohil Mehta, linux-api, linux-arch
  Cc: Sohil Mehta, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E . J . Bottomley,
	Helge Deller, Nicholas Piggin, Christophe Leroy, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Chris Zankel, Max Filippov, Arnd Bergmann,
	Peter Zijlstra, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Lukas Bulwahn, Sergei Trofimovich, Andrew Morton,
	Rohan McLure, Andreas Schwab, Eric W . Biederman, Brian Gerst,
	Randy Dunlap, Rick Edgecombe, Mark Brown, Deepak Gupta,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-ia64,
	linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
	linux-sh, sparclinux, linux-perf-users

Sohil Mehta <sohil.mehta@intel.com> writes:
> commit c35559f94ebc ("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 #452 was taken by fchmodat2().
>
> For Powerpc, map it to sys_ni_syscall() as is the norm for Powerpc
> syscall tables.

Mapping it to sys_map_shadow_stack() would work fine, but I'm happy with
sys_ni_syscall as I don't see powerpc implementing map_shadow_stack()
any time soon.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-09-14 18:58 [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
  2023-09-14 22:08 ` Edgecombe, Rick P
  2023-09-15  3:23 ` Michael Ellerman
@ 2023-10-03 16:35 ` Sohil Mehta
  2023-10-03 16:54   ` Arnd Bergmann
  2023-10-03 17:19 ` Geert Uytterhoeven
  2023-10-04  7:22 ` Catalin Marinas
  4 siblings, 1 reply; 11+ messages in thread
From: Sohil Mehta @ 2023-10-03 16:35 UTC (permalink / raw)
  To: linux-api, linux-arch, Arnd Bergmann
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Russell King,
	Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michal Simek,
	Thomas Bogendoerfer, James E . J . Bottomley, Helge Deller,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Chris Zankel, Max Filippov, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, Adrian Hunter, Lukas Bulwahn,
	Sergei Trofimovich, Andrew Morton, Rohan McLure, Andreas Schwab,
	Eric W . Biederman, Brian Gerst, Randy Dunlap, Rick Edgecombe,
	Mark Brown, Deepak Gupta, linux-alpha, linux-kernel,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux,
	linux-perf-users

On 9/14/2023 11:58 AM, Sohil Mehta wrote:
> commit c35559f94ebc ("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 #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 #563 as Alpha still diverges from
> the common syscall numbering system in the other architectures.
> 
> Link: https://lore.kernel.org/lkml/20230515212255.GA562920@debug.ba.rivosinc.com/
> Link: https://lore.kernel.org/lkml/b402b80b-a7c6-4ef0-b977-c0f5f582b78a@sirena.org.uk/
> 
> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
> ---

Gentle ping...

Are there any additional comments? It applies cleanly on 6.6-rc4.

Or does it seem ready to be merged? It has the following
acknowledgements until now:

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

>  arch/alpha/kernel/syscalls/syscall.tbl      | 1 +
>  arch/arm/tools/syscall.tbl                  | 1 +
>  arch/arm64/include/asm/unistd.h             | 2 +-
>  arch/arm64/include/asm/unistd32.h           | 2 ++
>  arch/ia64/kernel/syscalls/syscall.tbl       | 1 +
>  arch/m68k/kernel/syscalls/syscall.tbl       | 1 +
>  arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
>  arch/mips/kernel/syscalls/syscall_n32.tbl   | 1 +
>  arch/mips/kernel/syscalls/syscall_n64.tbl   | 1 +
>  arch/mips/kernel/syscalls/syscall_o32.tbl   | 1 +
>  arch/parisc/kernel/syscalls/syscall.tbl     | 1 +
>  arch/powerpc/kernel/syscalls/syscall.tbl    | 1 +
>  arch/s390/kernel/syscalls/syscall.tbl       | 1 +
>  arch/sh/kernel/syscalls/syscall.tbl         | 1 +
>  arch/sparc/kernel/syscalls/syscall.tbl      | 1 +
>  arch/x86/entry/syscalls/syscall_32.tbl      | 1 +
>  arch/xtensa/kernel/syscalls/syscall.tbl     | 1 +
>  include/uapi/asm-generic/unistd.h           | 5 ++++-
>  18 files changed, 22 insertions(+), 2 deletions(-)
>> diff --git a/arch/alpha/kernel/syscalls/syscall.tbl
b/arch/alpha/kernel/syscalls/syscall.tbl
> index ad37569d0507..6e8479c96e65 100644
> --- a/arch/alpha/kernel/syscalls/syscall.tbl
> +++ b/arch/alpha/kernel/syscalls/syscall.tbl
> @@ -492,3 +492,4 @@
>  560	common	set_mempolicy_home_node		sys_ni_syscall
>  561	common	cachestat			sys_cachestat
>  562	common	fchmodat2			sys_fchmodat2
> +563	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
> index c572d6c3dee0..6d494dfbf5e4 100644
> --- a/arch/arm/tools/syscall.tbl
> +++ b/arch/arm/tools/syscall.tbl
> @@ -466,3 +466,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
> index bd77253b62e0..6a28fb91b85d 100644
> --- a/arch/arm64/include/asm/unistd.h
> +++ b/arch/arm64/include/asm/unistd.h
> @@ -39,7 +39,7 @@
>  #define __ARM_NR_compat_set_tls		(__ARM_NR_COMPAT_BASE + 5)
>  #define __ARM_NR_COMPAT_END		(__ARM_NR_COMPAT_BASE + 0x800)
>  
> -#define __NR_compat_syscalls		453
> +#define __NR_compat_syscalls		454
>  #endif
>  
>  #define __ARCH_WANT_SYS_CLONE
> diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
> index 78b68311ec81..a201d842ec82 100644
> --- a/arch/arm64/include/asm/unistd32.h
> +++ b/arch/arm64/include/asm/unistd32.h
> @@ -911,6 +911,8 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
>  __SYSCALL(__NR_cachestat, sys_cachestat)
>  #define __NR_fchmodat2 452
>  __SYSCALL(__NR_fchmodat2, sys_fchmodat2)
> +#define __NR_map_shadow_stack 453
> +__SYSCALL(__NR_map_shadow_stack, sys_map_shadow_stack)
>  
>  /*
>   * Please add new compat syscalls above this comment and update
> diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl
> index 83d8609aec03..be02ce9d376f 100644
> --- a/arch/ia64/kernel/syscalls/syscall.tbl
> +++ b/arch/ia64/kernel/syscalls/syscall.tbl
> @@ -373,3 +373,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
> index 259ceb125367..bee2d2f7f82c 100644
> --- a/arch/m68k/kernel/syscalls/syscall.tbl
> +++ b/arch/m68k/kernel/syscalls/syscall.tbl
> @@ -452,3 +452,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
> index a3798c2637fd..09eda7ed91b0 100644
> --- a/arch/microblaze/kernel/syscalls/syscall.tbl
> +++ b/arch/microblaze/kernel/syscalls/syscall.tbl
> @@ -458,3 +458,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
> index 152034b8e0a0..3c02cc3886ca 100644
> --- a/arch/mips/kernel/syscalls/syscall_n32.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
> @@ -391,3 +391,4 @@
>  450	n32	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	n32	cachestat			sys_cachestat
>  452	n32	fchmodat2			sys_fchmodat2
> +453	n32	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
> index cb5e757f6621..aa9ed6a7cb48 100644
> --- a/arch/mips/kernel/syscalls/syscall_n64.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
> @@ -367,3 +367,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	n64	cachestat			sys_cachestat
>  452	n64	fchmodat2			sys_fchmodat2
> +453	n64	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
> index 1a646813afdc..756f6feb21c2 100644
> --- a/arch/mips/kernel/syscalls/syscall_o32.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
> @@ -440,3 +440,4 @@
>  450	o32	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	o32	cachestat			sys_cachestat
>  452	o32	fchmodat2			sys_fchmodat2
> +453	o32	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
> index e97c175b56f9..c80eedbe0170 100644
> --- a/arch/parisc/kernel/syscalls/syscall.tbl
> +++ b/arch/parisc/kernel/syscalls/syscall.tbl
> @@ -451,3 +451,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
> index 20e50586e8a2..87a54acf8346 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -539,3 +539,4 @@
>  450 	nospu	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_ni_syscall
> diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
> index 0122cc156952..22249c07e556 100644
> --- a/arch/s390/kernel/syscalls/syscall.tbl
> +++ b/arch/s390/kernel/syscalls/syscall.tbl
> @@ -455,3 +455,4 @@
>  450  common	set_mempolicy_home_node	sys_set_mempolicy_home_node	sys_set_mempolicy_home_node
>  451  common	cachestat		sys_cachestat			sys_cachestat
>  452  common	fchmodat2		sys_fchmodat2			sys_fchmodat2
> +453  common	map_shadow_stack	sys_map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
> index e90d585c4d3e..5ccfe6fbb6b1 100644
> --- a/arch/sh/kernel/syscalls/syscall.tbl
> +++ b/arch/sh/kernel/syscalls/syscall.tbl
> @@ -455,3 +455,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
> index 4ed06c71c43f..b2d664edebdd 100644
> --- a/arch/sparc/kernel/syscalls/syscall.tbl
> +++ b/arch/sparc/kernel/syscalls/syscall.tbl
> @@ -498,3 +498,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
> index 2d0b1bd866ea..743a7ef5a4b9 100644
> --- a/arch/x86/entry/syscalls/syscall_32.tbl
> +++ b/arch/x86/entry/syscalls/syscall_32.tbl
> @@ -457,3 +457,4 @@
>  450	i386	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	i386	cachestat		sys_cachestat
>  452	i386	fchmodat2		sys_fchmodat2
> +453	i386	map_shadow_stack	sys_map_shadow_stack
> diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
> index fc1a4f3c81d9..94e6bcc2bec7 100644
> --- a/arch/xtensa/kernel/syscalls/syscall.tbl
> +++ b/arch/xtensa/kernel/syscalls/syscall.tbl
> @@ -423,3 +423,4 @@
>  450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
>  451	common	cachestat			sys_cachestat
>  452	common	fchmodat2			sys_fchmodat2
> +453	common	map_shadow_stack		sys_map_shadow_stack
> diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
> index abe087c53b4b..203ae30d7761 100644
> --- a/include/uapi/asm-generic/unistd.h
> +++ b/include/uapi/asm-generic/unistd.h
> @@ -823,8 +823,11 @@ __SYSCALL(__NR_cachestat, sys_cachestat)
>  #define __NR_fchmodat2 452
>  __SYSCALL(__NR_fchmodat2, sys_fchmodat2)
>  
> +#define __NR_map_shadow_stack 453
> +__SYSCALL(__NR_map_shadow_stack, sys_map_shadow_stack)
> +
>  #undef __NR_syscalls
> -#define __NR_syscalls 453
> +#define __NR_syscalls 454
>  
>  /*
>   * 32 bit systems traditionally used different
> -- 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-10-03 16:35 ` Sohil Mehta
@ 2023-10-03 16:54   ` Arnd Bergmann
  2023-10-03 17:18     ` Sohil Mehta
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2023-10-03 16:54 UTC (permalink / raw)
  To: Sohil Mehta, linux-api, Linux-Arch
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Russell King,
	Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michal Simek,
	Thomas Bogendoerfer, James E . J . Bottomley, Helge Deller,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Chris Zankel, Max Filippov, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, Adrian Hunter, Lukas Bulwahn,
	Sergei Trofimovich, Andrew Morton, Rohan McLure, Andreas Schwab,
	Eric W. Biederman, Brian Gerst, Randy Dunlap, Rick Edgecombe,
	Mark Brown, Deepak Gupta, linux-alpha, linux-kernel,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux,
	linux-perf-users

On Tue, Oct 3, 2023, at 18:35, Sohil Mehta wrote:
> On 9/14/2023 11:58 AM, Sohil Mehta wrote:
>> commit c35559f94ebc ("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 #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 #563 as Alpha still diverges from
>> the common syscall numbering system in the other architectures.
>> 
>> Link: https://lore.kernel.org/lkml/20230515212255.GA562920@debug.ba.rivosinc.com/
>> Link: https://lore.kernel.org/lkml/b402b80b-a7c6-4ef0-b977-c0f5f582b78a@sirena.org.uk/
>> 
>> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
>> ---
>
> Gentle ping...
>
> Are there any additional comments? It applies cleanly on 6.6-rc4.
>
> Or does it seem ready to be merged? It has the following
> acknowledgements until now:
>
> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

If you like, I can pick this up for 6.7 through the asm-generic
tree. If you think this should be part of 6.6, I would suggest
to merge it through the tree that originally contained the
syscall code.

      Arnd

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-10-03 16:54   ` Arnd Bergmann
@ 2023-10-03 17:18     ` Sohil Mehta
  2023-10-06 20:01       ` Edgecombe, Rick P
  0 siblings, 1 reply; 11+ messages in thread
From: Sohil Mehta @ 2023-10-03 17:18 UTC (permalink / raw)
  To: Arnd Bergmann, linux-api, Linux-Arch, Dave Hansen, Ingo Molnar
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Russell King,
	Catalin Marinas, Will Deacon, Geert Uytterhoeven, Michal Simek,
	Thomas Bogendoerfer, James E . J . Bottomley, Helge Deller,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Borislav Petkov, x86, H. Peter Anvin,
	Chris Zankel, Max Filippov, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, Adrian Hunter, Lukas Bulwahn,
	Sergei Trofimovich, Andrew Morton, Rohan McLure, Andreas Schwab,
	Eric W. Biederman, Brian Gerst, Randy Dunlap, Rick Edgecombe,
	Mark Brown, Deepak Gupta, linux-alpha, linux-kernel,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux,
	linux-perf-users

On 10/3/2023 9:54 AM, Arnd Bergmann wrote:
> On Tue, Oct 3, 2023, at 18:35, Sohil Mehta wrote:
>>
>> Gentle ping...
>>
>> Are there any additional comments? It applies cleanly on 6.6-rc4.
>>
>> Or does it seem ready to be merged? It has the following
>> acknowledgements until now:
>>
>> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
>> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
>>
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> 

Thanks Arnd.

> If you like, I can pick this up for 6.7 through the asm-generic
> tree. If you think this should be part of 6.6, I would suggest
> to merge it through the tree that originally contained the
> syscall code.
> 

Dave, Ingo, would you prefer to take this patch through 6.6 or defer it
until 6.7?

It's not necessarily a fix but it does help finish up the shstk syscall
added with 6.6. Also, it might help reduce some merge conflicts later if
newer syscalls are being added during the 6.7 window.

Sohil


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-09-14 18:58 [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
                   ` (2 preceding siblings ...)
  2023-10-03 16:35 ` Sohil Mehta
@ 2023-10-03 17:19 ` Geert Uytterhoeven
  2023-10-04  7:22 ` Catalin Marinas
  4 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2023-10-03 17:19 UTC (permalink / raw)
  To: Sohil Mehta
  Cc: linux-api, linux-arch, Richard Henderson, Ivan Kokshaysky,
	Matt Turner, Russell King, Catalin Marinas, Will Deacon,
	Michal Simek, Thomas Bogendoerfer, James E . J . Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Chris Zankel, Max Filippov, Arnd Bergmann,
	Peter Zijlstra, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Lukas Bulwahn, Sergei Trofimovich, Andrew Morton,
	Rohan McLure, Andreas Schwab, Eric W . Biederman, Brian Gerst,
	Randy Dunlap, Rick Edgecombe, Mark Brown, Deepak Gupta,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-ia64,
	linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
	linux-sh, sparclinux, linux-perf-users

On Thu, Sep 14, 2023 at 8:59 PM Sohil Mehta <sohil.mehta@intel.com> wrote:
> commit c35559f94ebc ("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 #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 #563 as Alpha still diverges from
> the common syscall numbering system in the other architectures.
>
> Link: https://lore.kernel.org/lkml/20230515212255.GA562920@debug.ba.rivosinc.com/
> Link: https://lore.kernel.org/lkml/b402b80b-a7c6-4ef0-b977-c0f5f582b78a@sirena.org.uk/
>
> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>

>  arch/m68k/kernel/syscalls/syscall.tbl       | 1 +

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-09-14 18:58 [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
                   ` (3 preceding siblings ...)
  2023-10-03 17:19 ` Geert Uytterhoeven
@ 2023-10-04  7:22 ` Catalin Marinas
  4 siblings, 0 replies; 11+ messages in thread
From: Catalin Marinas @ 2023-10-04  7:22 UTC (permalink / raw)
  To: Sohil Mehta
  Cc: linux-api, linux-arch, Richard Henderson, Ivan Kokshaysky,
	Matt Turner, Russell King, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E . J . Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S . Miller, Andy Lutomirski,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Chris Zankel, Max Filippov, Arnd Bergmann,
	Peter Zijlstra, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Lukas Bulwahn, Sergei Trofimovich, Andrew Morton,
	Rohan McLure, Andreas Schwab, Eric W . Biederman, Brian Gerst,
	Randy Dunlap, Rick Edgecombe, Mark Brown, Deepak Gupta,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-ia64,
	linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
	linux-sh, sparclinux, linux-perf-users

On Thu, Sep 14, 2023 at 06:58:03PM +0000, Sohil Mehta wrote:
> commit c35559f94ebc ("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 #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 #563 as Alpha still diverges from
> the common syscall numbering system in the other architectures.
> 
> Link: https://lore.kernel.org/lkml/20230515212255.GA562920@debug.ba.rivosinc.com/
> Link: https://lore.kernel.org/lkml/b402b80b-a7c6-4ef0-b977-c0f5f582b78a@sirena.org.uk/
> 
> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
> ---
> v2:
> - Skip syscall table changes to tools/. They will be handled separetely by the
>   perf folks.
> - Map Powerpc to sys_ni_syscall (Rick Edgecombe)
> ---
>  arch/alpha/kernel/syscalls/syscall.tbl      | 1 +
>  arch/arm/tools/syscall.tbl                  | 1 +
>  arch/arm64/include/asm/unistd.h             | 2 +-
>  arch/arm64/include/asm/unistd32.h           | 2 ++

For arm64 (compat):

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-10-03 17:18     ` Sohil Mehta
@ 2023-10-06 20:01       ` Edgecombe, Rick P
  2023-10-06 20:29         ` Arnd Bergmann
  0 siblings, 1 reply; 11+ messages in thread
From: Edgecombe, Rick P @ 2023-10-06 20:01 UTC (permalink / raw)
  To: Mehta, Sohil, dave.hansen@linux.intel.com, mingo@redhat.com,
	linux-arch@vger.kernel.org, arnd@arndb.de,
	linux-api@vger.kernel.org
  Cc: borntraeger@linux.ibm.com, tglx@linutronix.de, deller@gmx.de,
	lukas.bulwahn@gmail.com, irogers@google.com,
	agordeev@linux.ibm.com, davem@davemloft.net, Lutomirski, Andy,
	jcmvbkbc@gmail.com, linux@armlinux.org.uk,
	ysato@users.sourceforge.jp, Hunter, Adrian, chris@zankel.net,
	hca@linux.ibm.com, catalin.marinas@arm.com, peterz@infradead.org,
	brgerst@gmail.com, linuxppc-dev@lists.ozlabs.org,
	broonie@kernel.org, linux-s390@vger.kernel.org,
	linux-mips@vger.kernel.org, christophe.leroy@csgroup.eu,
	x86@kernel.org, mpe@ellerman.id.au, tsbogend@alpha.franken.de,
	ink@jurassic.park.msu.ru, bp@alien8.de, geert@linux-m68k.org,
	rdunlap@infradead.org, mark.rutland@arm.com,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	namhyung@kernel.org, jolsa@kernel.org, npiggin@gmail.com,
	monstr@monstr.eu, linux-m68k@lists.linux-m68k.org,
	debug@rivosinc.com, ebiederm@xmission.com,
	richard.henderson@linaro.org, will@kernel.org, hpa@zytor.com,
	gor@linux.ibm.com, alexander.shishkin@linux.intel.com,
	mattst88@gmail.com, glaubitz@physik.fu-berlin.de,
	linux-parisc@vger.kernel.org, acme@kernel.org, slyich@gmail.com,
	linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org,
	James.Bottomley@HansenPartnership.com, rmclure@linux.ibm.com,
	linux-sh@vger.kernel.org, svens@linux.ibm.com, dalias@libc.org,
	schwab@linux-m68k.org, akpm@linux-foundation.org,
	sparclinux@vger.kernel.org, linux-perf-users@vger.kernel.org

On Tue, 2023-10-03 at 10:18 -0700, Sohil Mehta wrote:
> > If you like, I can pick this up for 6.7 through the asm-generic
> > tree. If you think this should be part of 6.6, I would suggest
> > to merge it through the tree that originally contained the
> > syscall code.
> > 
> 
> Dave, Ingo, would you prefer to take this patch through 6.6 or defer
> it
> until 6.7?
> 
> It's not necessarily a fix but it does help finish up the shstk
> syscall
> added with 6.6. Also, it might help reduce some merge conflicts later
> if
> newer syscalls are being added during the 6.7 window.

Hi Arnd,

It doesn't look like anyone is pouncing on the syscall number in linux-
next currently. It might be nice to have this patch go through linux-
next since it touches so many architectures. And it sounds like x86
folk are ok with this, so if you could pick it up for 6.7 that would be
great. Thanks!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-10-06 20:01       ` Edgecombe, Rick P
@ 2023-10-06 20:29         ` Arnd Bergmann
  2023-10-06 20:36           ` Sohil Mehta
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2023-10-06 20:29 UTC (permalink / raw)
  To: Rick Edgecombe, Sohil Mehta, Dave Hansen, Ingo Molnar, Linux-Arch,
	linux-api@vger.kernel.org
  Cc: Christian Borntraeger, Thomas Gleixner, Helge Deller,
	Lukas Bulwahn, Ian Rogers, Alexander Gordeev, David S . Miller,
	Andy Lutomirski, Max Filippov, Russell King, Yoshinori Sato,
	Adrian Hunter, chris@zankel.net, Heiko Carstens, Catalin Marinas,
	Peter Zijlstra, Brian Gerst, linuxppc-dev@lists.ozlabs.org,
	Mark Brown, linux-s390@vger.kernel.org,
	linux-mips@vger.kernel.org, Christophe Leroy, x86@kernel.org,
	Michael Ellerman, Thomas Bogendoerfer, Ivan Kokshaysky,
	Borislav Petkov, Geert Uytterhoeven, Randy Dunlap, Mark Rutland,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	Namhyung Kim, Jiri Olsa, Nicholas Piggin, Michal Simek,
	linux-m68k@lists.linux-m68k.org, Deepak Gupta, Eric W. Biederman,
	Richard Henderson, Will Deacon, H. Peter Anvin, gor@linux.ibm.com,
	Alexander Shishkin, Matt Turner, John Paul Adrian Glaubitz,
	linux-parisc@vger.kernel.org, Arnaldo Carvalho de Melo,
	Sergei Trofimovich, linux-arm-kernel@lists.infradead.org,
	linux-alpha@vger.kernel.org, James E . J . Bottomley,
	Rohan McLure, linux-sh@vger.kernel.org, Sven Schnelle,
	Rich Felker, Andreas Schwab, Andrew Morton,
	sparclinux@vger.kernel.org, linux-perf-users@vger.kernel.org

On Fri, Oct 6, 2023, at 22:01, Edgecombe, Rick P wrote:
> On Tue, 2023-10-03 at 10:18 -0700, Sohil Mehta wrote:
>> > If you like, I can pick this up for 6.7 through the asm-generic
>> > tree. If you think this should be part of 6.6, I would suggest
>> > to merge it through the tree that originally contained the
>> > syscall code.
>> > 
>> 
>> Dave, Ingo, would you prefer to take this patch through 6.6 or defer
>> it
>> until 6.7?
>> 
>> It's not necessarily a fix but it does help finish up the shstk
>> syscall
>> added with 6.6. Also, it might help reduce some merge conflicts later
>> if
>> newer syscalls are being added during the 6.7 window.
>
> Hi Arnd,
>
> It doesn't look like anyone is pouncing on the syscall number in linux-
> next currently. It might be nice to have this patch go through linux-
> next since it touches so many architectures. And it sounds like x86
> folk are ok with this, so if you could pick it up for 6.7 that would be
> great. Thanks!

Ok, I picked it up now, should be in linux-next starting next week.

     Arnd

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures
  2023-10-06 20:29         ` Arnd Bergmann
@ 2023-10-06 20:36           ` Sohil Mehta
  0 siblings, 0 replies; 11+ messages in thread
From: Sohil Mehta @ 2023-10-06 20:36 UTC (permalink / raw)
  To: Arnd Bergmann, Rick Edgecombe, Dave Hansen, Ingo Molnar,
	Linux-Arch, linux-api@vger.kernel.org
  Cc: Christian Borntraeger, Thomas Gleixner, Helge Deller,
	Lukas Bulwahn, Ian Rogers, Alexander Gordeev, David S . Miller,
	Andy Lutomirski, Max Filippov, Russell King, Yoshinori Sato,
	Adrian Hunter, chris@zankel.net, Heiko Carstens, Catalin Marinas,
	Peter Zijlstra, Brian Gerst, linuxppc-dev@lists.ozlabs.org,
	Mark Brown, linux-s390@vger.kernel.org,
	linux-mips@vger.kernel.org, Christophe Leroy, x86@kernel.org,
	Michael Ellerman, Thomas Bogendoerfer, Ivan Kokshaysky,
	Borislav Petkov, Geert Uytterhoeven, Randy Dunlap, Mark Rutland,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	Namhyung Kim, Jiri Olsa, Nicholas Piggin, Michal Simek,
	linux-m68k@lists.linux-m68k.org, Deepak Gupta, Eric W. Biederman,
	Richard Henderson, Will Deacon, H. Peter Anvin, gor@linux.ibm.com,
	Alexander Shishkin, Matt Turner, John Paul Adrian Glaubitz,
	linux-parisc@vger.kernel.org, Arnaldo Carvalho de Melo,
	Sergei Trofimovich, linux-arm-kernel@lists.infradead.org,
	linux-alpha@vger.kernel.org, James E . J . Bottomley,
	Rohan McLure, linux-sh@vger.kernel.org, Sven Schnelle,
	Rich Felker, Andreas Schwab, Andrew Morton,
	sparclinux@vger.kernel.org, linux-perf-users@vger.kernel.org

On 10/6/2023 1:29 PM, Arnd Bergmann wrote:
> On Fri, Oct 6, 2023, at 22:01, Edgecombe, Rick P wrote:
>> Hi Arnd,
>>
>> It doesn't look like anyone is pouncing on the syscall number in linux-
>> next currently. It might be nice to have this patch go through linux-
>> next since it touches so many architectures. And it sounds like x86
>> folk are ok with this, so if you could pick it up for 6.7 that would be
>> great. Thanks!
> 
> Ok, I picked it up now, should be in linux-next starting next week.
> 

Great, thanks Arnd and Rick!

Sohil



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-10-06 20:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 18:58 [PATCH v2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
2023-09-14 22:08 ` Edgecombe, Rick P
2023-09-15  3:23 ` Michael Ellerman
2023-10-03 16:35 ` Sohil Mehta
2023-10-03 16:54   ` Arnd Bergmann
2023-10-03 17:18     ` Sohil Mehta
2023-10-06 20:01       ` Edgecombe, Rick P
2023-10-06 20:29         ` Arnd Bergmann
2023-10-06 20:36           ` Sohil Mehta
2023-10-03 17:19 ` Geert Uytterhoeven
2023-10-04  7:22 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).