qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] linux-user/syscall: fix target_msqid_ds time fields order
@ 2024-03-29 22:36 Max Filippov
  0 siblings, 0 replies; only message in thread
From: Max Filippov @ 2024-03-29 22:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Philippe Mathieu-Daudé, Max Filippov,
	qemu-stable

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-29 22:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29 22:36 [PATCH v2] linux-user/syscall: fix target_msqid_ds time fields order Max Filippov

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).