qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] linux-user/syscall: fix target_msqid_ds time fields order


From: Max Filippov
Subject: [PATCH v2] linux-user/syscall: fix target_msqid_ds time fields order
Date: Fri, 29 Mar 2024 15:36:53 -0700

target_msqid_ds::msg_*time field pairs are reversed on 32-bit TARGET_PPC
and TARGET_SPARC and on big-endian TARGET_MIPS and TARGET_XTENSA.
Fix the order to match the kernel definitions.
The issue is spotted by the libc-test http://nsz.repo.hu/git/?p=libc-test
on big-endian xtensa core.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1->v2:
- split into a separate patch
- add PPC, SPARC and big-endian MIPS

 linux-user/syscall.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d9bfd31c1cad..781ed14bc613 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4113,17 +4113,27 @@ static inline abi_long do_semtimedop(int semid,
 struct target_msqid_ds
 {
     struct target_ipc_perm msg_perm;
-    abi_ulong msg_stime;
 #if TARGET_ABI_BITS == 32
+#if defined(TARGET_PPC) || defined(TARGET_SPARC) || \
+    (TARGET_BIG_ENDIAN && (defined(TARGET_MIPS) || defined(TARGET_XTENSA)))
+    abi_ulong __unused1;
+    abi_ulong msg_stime;
+    abi_ulong __unused2;
+    abi_ulong msg_rtime;
+    abi_ulong __unused3;
+    abi_ulong msg_ctime;
+#else
+    abi_ulong msg_stime;
     abi_ulong __unused1;
-#endif
     abi_ulong msg_rtime;
-#if TARGET_ABI_BITS == 32
     abi_ulong __unused2;
-#endif
     abi_ulong msg_ctime;
-#if TARGET_ABI_BITS == 32
     abi_ulong __unused3;
+#endif
+#else
+    abi_ulong msg_stime;
+    abi_ulong msg_rtime;
+    abi_ulong msg_ctime;
 #endif
     abi_ulong __msg_cbytes;
     abi_ulong msg_qnum;
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]