linux-user: Move TARGET_SA_RESTORER out of generic/signal.h
authorAndreas Schwab <schwab@suse.de>
Mon, 10 Feb 2025 12:59:34 +0000 (13:59 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 18 Feb 2025 16:29:03 +0000 (08:29 -0800)
SA_RESTORER and the associated sa_restorer field of struct sigaction are
an obsolete feature, not expected to be used by future architectures.
They are also absent on RISC-V, LoongArch, Hexagon and OpenRISC, but
defined due to their use of generic/signal.h.  This leads to corrupted
data and out-of-bounds accesses.

Move the definition of TARGET_SA_RESTORER out of generic/signal.h into the
target_signal.h files that need it.  Note that m68k has the sa_restorer
field, but does not use it and does not define SA_RESTORER.

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <mvmed060xc9.fsf@suse.de>

linux-user/aarch64/target_signal.h
linux-user/arm/target_signal.h
linux-user/generic/signal.h
linux-user/i386/target_signal.h
linux-user/m68k/target_signal.h
linux-user/microblaze/target_signal.h
linux-user/ppc/target_signal.h
linux-user/s390x/target_signal.h
linux-user/sh4/target_signal.h
linux-user/x86_64/target_signal.h
linux-user/xtensa/target_signal.h

index 40e399d9908df7f5d53749f45db2c1f9387d0eb9..6f66a50bfd2a64fa5b69876d943a94bc05689a83 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_SEGV_MTEAERR  8  /* Asynchronous ARM MTE error */
 #define TARGET_SEGV_MTESERR  9  /* Synchronous ARM MTE exception */
 
index 0e6351d9f789822759171e5f2adb45f7d3a2dfbc..ff1810b1fe022a22b8181fff714974863658292f 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_ARCH_HAS_SETUP_FRAME
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
index 6fd05b77bb3ec0a85e62b60d66f6a13fd7a0c3cd..b34740258edb0d30ef03f5ba3df1c295ad14329f 100644 (file)
@@ -15,7 +15,6 @@
 #define TARGET_SA_RESTART       0x10000000
 #define TARGET_SA_NODEFER       0x40000000
 #define TARGET_SA_RESETHAND     0x80000000
-#define TARGET_SA_RESTORER      0x04000000
 
 #define TARGET_SIGHUP            1
 #define TARGET_SIGINT            2
index 9315cba241cf4f6fc19193b7f0970e17a85dd6cd..eee792ef637e55cc96c59a30024bf87befb56ae6 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_ARCH_HAS_SETUP_FRAME
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
index 6e0f4b74e391cf7f24917bcda4af8da8aef78cef..b05b9303b0d5c782eca08bbab1a3cfccae385eee 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_ARCH_HAS_SA_RESTORER 1
 #define TARGET_ARCH_HAS_SETUP_FRAME
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
index 7dc5c45f00aca49929f4a5ae6068a7f78a651cd9..ffe4442213a97509409723e9414fd671e5833d20 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
 #endif /* MICROBLAZE_TARGET_SIGNAL_H */
index 5be24e152b7ee9e5c1659223d87a19cfea0eed8e..53fae473f3c395952165f3a657d196c85a63940e 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #if !defined(TARGET_PPC64)
 #define TARGET_ARCH_HAS_SETUP_FRAME
 #endif
index 41e0e34a55d754dab0add6ec7d602093133d09ce..738e0673f4a3e0450926191cd803a6ac7cee454c 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_ARCH_HAS_SETUP_FRAME
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
index eee6a1a7cda418c77e6fd9aee94e5c50eb9013d4..0bde417fd1fd32bb1b3889e5ca74df6f3c18a79a 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_ARCH_HAS_SETUP_FRAME
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
index 9d9717406f3beed01ec56e2905562f9d3f87f880..0af100c66110252a9647e447aa8e3287b514868a 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 /* For x86_64, use of SA_RESTORER is mandatory. */
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0
 
index e4b1bea5cb5dd3c81f51ddded0408e93722b52c5..8a198bf8ac88ec01f02df41f8c72584c6d5bf1ac 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "../generic/signal.h"
 
+#define TARGET_SA_RESTORER      0x04000000
+
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
 
 #endif