]> Git Repo - qemu.git/commitdiff
linux-user: Correct definition of stack_t
authorLemonBoy <[email protected]>
Thu, 5 Nov 2020 15:52:51 +0000 (16:52 +0100)
committerLaurent Vivier <[email protected]>
Wed, 11 Nov 2020 09:59:39 +0000 (10:59 +0100)
Some platforms used the wrong definition of stack_t where the flags and
size fields were swapped or where the flags field had type ulong instead
of int.

Due to the presence of padding space in the structure and the prevalence
of little-endian machines this problem went unnoticed for a long time.

The type definitions have been cross-checked with the ones defined in
the Linux kernel v5.9, plus some older versions for a few architecture
that have been removed and Xilinx's kernel fork for NiosII [1].

The bsd-user headers remain unchanged as I don't know if they are wrong
or not.

[1] https://github.com/Xilinx/linux-xlnx/blob/master/arch/nios2/include/uapi/asm/signal.h

Signed-off-by: Giuseppe Musacchio <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-Id: <e9d47692-ee92-009f-6007-0abc3f502b97@gmail.com>
Signed-off-by: Laurent Vivier <[email protected]>
15 files changed:
linux-user/alpha/target_signal.h
linux-user/arm/target_signal.h
linux-user/cris/target_signal.h
linux-user/hppa/target_signal.h
linux-user/i386/target_signal.h
linux-user/m68k/target_signal.h
linux-user/microblaze/target_signal.h
linux-user/mips/target_signal.h
linux-user/mips64/target_signal.h
linux-user/nios2/target_signal.h
linux-user/ppc/target_signal.h
linux-user/s390x/target_signal.h
linux-user/sh4/target_signal.h
linux-user/sparc/target_signal.h
linux-user/x86_64/target_signal.h

index cd63d59fdec1e46b549deff4e5a2b8a4c9d4cfe8..b83797281c323278d3fcc2d5a88998bb2cc74894 100644 (file)
@@ -42,8 +42,7 @@
 
 typedef struct target_sigaltstack {
     abi_ulong ss_sp;
-    int32_t ss_flags;
-    int32_t dummy;
+    abi_int ss_flags;
     abi_ulong ss_size;
 } target_stack_t;
 
index ea123c40f38dab7f85d762d0c88b363bc6f1c6ca..0998dd6dfa75de03787fb67f5ddfd79dd29e3ae1 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_long ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index 1cb5548f85ea13bcf2a6310278c3490485718c10..495a1428968174184fa62d75e76d6a3ab02c3401 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_ulong ss_size;
-       abi_long ss_flags;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index c2a0102ed73d126b10554a2330b2e2c1a51793cb..c52a3ea5794bdc4e1eb8ce632b43460dd8956928 100644 (file)
@@ -44,7 +44,7 @@
 
 typedef struct target_sigaltstack {
     abi_ulong ss_sp;
-    int32_t ss_flags;
+    abi_int ss_flags;
     abi_ulong ss_size;
 } target_stack_t;
 
index f55e78fd33e7c4419bdb0f53f7c2fca67f83c8e5..50361af8746e7e3ccac98c1d42761667ae80f33b 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_long ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index 314e808844a4f5c6f327cdf20e89a4359af33552..d096544ef8420c706ed1c56e2a6747beb0c8d719 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_long ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index 08bcf24b9d1c3e4f9aa71bb2dfefb320e19b7824..1c326296de42c76efb43a676a725835664050f00 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_ulong ss_size;
-       abi_long ss_flags;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index 66e1ad44a64ef0547920a6d8ce1844f6b251fda8..fa4084a99dcdab739fa4a144027578afac8c8d3a 100644 (file)
@@ -45,9 +45,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_long ss_sp;
-       abi_ulong ss_size;
-       abi_long ss_flags;
+    abi_ulong ss_sp;
+    abi_ulong ss_size;
+    abi_int ss_flags;
 } target_stack_t;
 
 
index 753e91fbd695f859f20c42fab238dc9a4c473d3b..799f7a668cd0f63808dd4f1f51b9adbef4840ae7 100644 (file)
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_long ss_sp;
-       abi_ulong ss_size;
-       abi_int ss_flags;
+    abi_ulong ss_sp;
+    abi_ulong ss_size;
+    abi_int ss_flags;
 } target_stack_t;
 
-
 /*
  * sigaltstack controls
  */
index fe48721b3db07809a7eb58fc257f7b458a950c99..aebf749f1278f2221d2a9c8d99ab3e78177332f3 100644 (file)
@@ -4,11 +4,12 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-    abi_long ss_sp;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
     abi_ulong ss_size;
-    abi_long ss_flags;
 } target_stack_t;
 
+
 /* sigaltstack controls  */
 #define TARGET_SS_ONSTACK     1
 #define TARGET_SS_DISABLE     2
index 4453e2e7efd7dee2a0a44420ef80ec497e22bb1a..72fcdd9bfa20ccf9185283017dffb85246a022bf 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       int ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index b58bc7c20f63c5bf49d75a550bc5190c43e0d739..bbfc464d4417ee0d2fcd2e4a30238c95c8f0d26c 100644 (file)
@@ -3,7 +3,7 @@
 
 typedef struct target_sigaltstack {
     abi_ulong ss_sp;
-    int ss_flags;
+    abi_int ss_flags;
     abi_ulong ss_size;
 } target_stack_t;
 
index 434970a9900a1c4eeb50513489c2ffce2db49d40..d7309b7136d76eecb36f3de692835b3af30b7a9a 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_long ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index 5cc40327d2c2400ee1b44d0abb121b18a0afdddf..1b10d1490fc9a046e14d3d4777746b074988f6a8 100644 (file)
@@ -42,9 +42,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_long ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
index 4c4380f7b94922bd435b7368ee51e5a91444f75a..4ea74f20dd42a32eebcd5f0b6f7d0ca327924e79 100644 (file)
@@ -4,9 +4,9 @@
 /* this struct defines a stack used during syscall handling */
 
 typedef struct target_sigaltstack {
-       abi_ulong ss_sp;
-       abi_long ss_flags;
-       abi_ulong ss_size;
+    abi_ulong ss_sp;
+    abi_int ss_flags;
+    abi_ulong ss_size;
 } target_stack_t;
 
 
This page took 0.037879 seconds and 4 git commands to generate.