Skip to contentSkip to conversation

Linux user next patches

GIT PULL Applied Helge Deller 2 participants 3 messages Nov 22 – Nov 23

lore
Share & tools
lore
#0 lore raw

From: Helge Deller <[email protected]>

The following changes since commit 8f66cb79044c370e3813c56ceb7a75a5ca2d0a0e:

Merge tag 'pull-tcg-20261120' of https://gitlab.com/rth7680/qemu into staging (2026-11-20 14:52:05 -0800)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git tags/linux-user-next-pull-request

for you to fetch changes up to 31b27c0b645e8c596e69027d714ce075f1374792:

linux-user: do not emulate PI futexes given endianness mismatch (2026-11-22 16:57:52 +0100)

----------------------------------------------------------------
linux user

One PI futex patch from Barnabás Pőcze for linux-user.

----------------------------------------------------------------

Barnabás Pőcze (1):
linux-user: do not emulate PI futexes given endianness mismatch

 linux-user/syscall.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.54.0
#1 lore raw

[PULL 1/1] linux-user: do not emulate PI futexes given endianness mismatch

From: Barnabás Pőcze <[email protected]>

For PI futexes, the futex word is expected to contain the thread id in native byte order. And failing to emulate that leads to issues as e.g. glibc does not expect ESRCH to be returned from a FUTEX_LOCK_PI operation.

If the mutex is set to be "robust", then this is detected as unrecoverable failure and glibc aborts (since a robust mutex should've been unlocked by the kernel when the owner dies):

Fatal glibc error: pthread_mutex_lock.c:450 (__pthread_mutex_lock_full): assertion failed: e != ESRCH || !robust
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted (core dumped)

Since FUTEX_LOCK_PI{,2} cannot be easily emulated when the host and target endianness differs, do not handle them, and return ENOSYS. This allows e.g. glibc to detect that they do not work and handle things accordingly.

---
 linux-user/syscall.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
linux-user/syscall.c +6 -2
index 350e69e2d0..d2a6cfb454 100644
@@ -8243,6 +8243,7 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,
     case FUTEX_WAIT_BITSET:
         val = tswap32(val);
         break;
+#if HOST_BIG_ENDIAN == TARGET_BIG_ENDIAN
     case FUTEX_WAIT_REQUEUE_PI:
         val = tswap32(val);
         haddr2 = g2h(cpu, uaddr2);
@@ -8250,10 +8251,11 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,
     case FUTEX_LOCK_PI:
     case FUTEX_LOCK_PI2:
         break;
-    case FUTEX_WAKE:
-    case FUTEX_WAKE_BITSET:
     case FUTEX_TRYLOCK_PI:
     case FUTEX_UNLOCK_PI:
+#endif
+    case FUTEX_WAKE:
+    case FUTEX_WAKE_BITSET:
         timeout = 0;
         break;
     case FUTEX_FD:
@@ -8261,7 +8263,9 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,
         timeout = 0;
         break;
     case FUTEX_CMP_REQUEUE:
+#if HOST_BIG_ENDIAN == TARGET_BIG_ENDIAN
     case FUTEX_CMP_REQUEUE_PI:
+#endif
         val3 = tswap32(val3);
         /* fall through */
     case FUTEX_REQUEUE:
Signature · 1 line
2.54.0
#2 lore raw
In reply to Helge Deller
Quoted 10 lines · Helge Deller

From: Helge Deller<[email protected]>

The following changes since commit 8f66cb79044c370e3813c56ceb7a75a5ca2d0a0e:

   Merge tag 'pull-tcg-20261120' ofhttps://gitlab.com/rth7680/qemu into staging (2026-11-20 14:52:05 -0800)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git tags/linux-user-next-pull-request

Quoted 8 lines

for you to fetch changes up to 31b27c0b645e8c596e69027d714ce075f1374792:

linux-user: do not emulate PI futexes given endianness mismatch (2026-11-22 16:57:52 +0100)

----------------------------------------------------------------
linux user

One PI futex patch from Barnabás Pőcze for linux-user.

Applied, thanks.

r~