Linux user patches
From: Helge Deller <[email protected]>
The following changes since commit de5eb7c4dd3ef5688b14007134eb11ff4973580c:
Merge tag 'hw-misc-20260728' of https://github.com/philmd/qemu into staging (2026-07-28 10:04:08 -0400)
are available in the Git repository at:
https://github.com/hdeller/qemu-hppa.git tags/linux-user-pull-request
for you to fetch changes up to 8d0ac5933aa3476283c14680f165727268103fcd:
linux-user/aarch64: Fix SHADOW_STACK_SET_TOKEN (2026-07-29 22:56:12 +0200)
----------------------------------------------------------------
linux-user patches
Three linux-user patches, one aarch64 shadow stack fix and two fixes for members of the target_msqid_ds struct.
----------------------------------------------------------------
Helge Deller (1):
linux-user: Fix msqid_ds struct wrt 32-bit big endian architectures
Richard Henderson (1):
linux-user/aarch64: Fix SHADOW_STACK_SET_TOKEN
no92 (1):
linux-user: fix incorrect msg_l[sr]pid members of target_msqid_ds
linux-user/syscall.c | 45 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 25 deletions(-)
Signature · 1 line
2.54.0
[PULL 1/3] linux-user: Fix msqid_ds struct wrt 32-bit big endian architectures
From: Helge Deller <[email protected]>
Make sure that the time entries (msg_stime, msg_rtime and msg_ctime) are defined as 64-bit time_t values, since the userspace may access the whole 64-bit value. By this change we fix the word ordering for 32-bit big endian architectures as well.
This fixes the msgctl01 LTP testcase on hppa32.
--- linux-user/syscall.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
linux-user/syscall.c +12 -18
@@ -4216,21 +4216,15 @@ static inline abi_long do_semtimedop(int semid, }#endif +#define target_time64_t abi_ullong +#define target_swap_time64 (x) tswap64(x) +struct target_msqid_ds {struct target_ipc_perm msg_perm; -abi_ulong msg_stime; -#if TARGET_ABI_BITS ==32 -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 +target_time64_t msg_stime; +target_time64_t msg_rtime; +target_time64_t msg_ctime;abi_ulong __msg_cbytes;abi_ulong msg_qnum;abi_ulong msg_qbytes;
@@ -4249,9 +4243,9 @@ static inline abi_long target_to_host_msqid_ds(struct msqid_ds *host_md,return -TARGET_EFAULT ;if (target_to_host_ipc_perm (&(host_md->msg_perm),target_addr))return -TARGET_EFAULT ; - host_md->msg_stime =tswapal (target_md->msg_stime); - host_md->msg_rtime =tswapal (target_md->msg_rtime); - host_md->msg_ctime =tswapal (target_md->msg_ctime); + host_md->msg_stime =target_swap_time64 (target_md->msg_stime); + host_md->msg_rtime =target_swap_time64 (target_md->msg_rtime); + host_md->msg_ctime =target_swap_time64 (target_md->msg_ctime); 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);
@@ -4270,9 +4264,9 @@ static inline abi_long host_to_target_msqid_ds(abi_ulong target_addr,return -TARGET_EFAULT ;if (host_to_target_ipc_perm (target_addr,&(host_md->msg_perm)))return -TARGET_EFAULT ; - target_md->msg_stime =tswapal (host_md->msg_stime); - target_md->msg_rtime =tswapal (host_md->msg_rtime); - target_md->msg_ctime =tswapal (host_md->msg_ctime); + target_md->msg_stime =target_swap_time64 (host_md->msg_stime); + target_md->msg_rtime =target_swap_time64 (host_md->msg_rtime); + target_md->msg_ctime =target_swap_time64 (host_md->msg_ctime); 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);
Signature · 1 line
2.54.0
[PULL 2/3] linux-user: fix incorrect msg_l[sr]pid members of target_msqid_ds
In reply to Helge DellerFrom: no92 <[email protected]>
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.
--- linux-user/syscall.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
linux-user/syscall.c +6 -6
@@ -4228,8 +4228,8 @@ struct target_msqid_dsabi_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 ; }
Signature · 1 line
2.54.0
[PULL 3/3] linux-user/aarch64: Fix SHADOW_STACK_SET_TOKEN
In reply to Helge DellerFrom: Richard Henderson <[email protected]>
The token is not computed via TARGET_PAGE_SIZE, but via a fixed 12-bit field.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4106
--- linux-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/syscall.c +2 -1
@@ -6900,7 +6900,8 @@ static abi_long do_map_shadow_stack(CPUArchState *env, abi_ulong addr,/* Leave an extra empty frame at top-of-stack. */ cap_ptr -=8 ; } - cap_val = (cap_ptr &TARGET_PAGE_MASK ) |1 ; +/* Note the 12 bit field is unaffected by current page size. */ + cap_val =deposit64 (cap_ptr,0 ,12 ,1 );if (put_user_u64 (cap_val, cap_ptr)) {/* Allocation succeeded above. */ g_assert_not_reached ();
Signature · 1 line
2.54.0
Stefan Hajnoczi
AppliedApplied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.