Commit 518a4aa01b for qemu.org
commit 518a4aa01b88ff814dbf8668016f3ec910426283
Author: no92 <leo@managarm.org>
Date: Fri Jul 24 18:01:04 2026 +0200
linux-user: fix incorrect msg_l[sr]pid members of target_msqid_ds
The members are declared as __kernel_pid_t in Linux UAPI headers.
Analogous members in struct target_shmid_ds (shm_[cl]pid) are also
declared as abi_int.
Cc: qemu-stable@nongnu.org
Fixes: 1c54ff97bbde ("linux-user: fix and cleanup IPCOP_msg* ipc calls handling")
Signed-off-by: no92 <leo@managarm.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c93b770ced..547784d971 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4228,8 +4228,8 @@ struct target_msqid_ds
abi_ulong __msg_cbytes;
abi_ulong msg_qnum;
abi_ulong msg_qbytes;
- abi_ulong msg_lspid;
- abi_ulong msg_lrpid;
+ abi_int msg_lspid;
+ abi_int msg_lrpid;
abi_ulong __unused4;
abi_ulong __unused5;
};
@@ -4249,8 +4249,8 @@ static inline abi_long target_to_host_msqid_ds(struct msqid_ds *host_md,
host_md->__msg_cbytes = tswapal(target_md->__msg_cbytes);
host_md->msg_qnum = tswapal(target_md->msg_qnum);
host_md->msg_qbytes = tswapal(target_md->msg_qbytes);
- host_md->msg_lspid = tswapal(target_md->msg_lspid);
- host_md->msg_lrpid = tswapal(target_md->msg_lrpid);
+ host_md->msg_lspid = tswap32(target_md->msg_lspid);
+ host_md->msg_lrpid = tswap32(target_md->msg_lrpid);
unlock_user_struct(target_md, target_addr, 0);
return 0;
}
@@ -4270,8 +4270,8 @@ static inline abi_long host_to_target_msqid_ds(abi_ulong target_addr,
target_md->__msg_cbytes = tswapal(host_md->__msg_cbytes);
target_md->msg_qnum = tswapal(host_md->msg_qnum);
target_md->msg_qbytes = tswapal(host_md->msg_qbytes);
- target_md->msg_lspid = tswapal(host_md->msg_lspid);
- target_md->msg_lrpid = tswapal(host_md->msg_lrpid);
+ target_md->msg_lspid = tswap32(host_md->msg_lspid);
+ target_md->msg_lrpid = tswap32(host_md->msg_lrpid);
unlock_user_struct(target_md, target_addr, 1);
return 0;
}