Skip to contentSkip to conversation

Linux user patches

GIT PULL Helge Deller 3 participants 6 messages Jul 26 – Jul 28

lore
Share & tools
lore
#0 lore raw

From: Helge Deller <[email protected]>

The following changes since commit 300438ffbb8d9430cac2fcc15cba6f482b2c0587:

Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging (2026-07-24 09:13:49 -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 4fdc24696cbf1ac6d97075d877cafc9fead4c475:

linux-user: fix guards for the fsmount(2) syscall series (2026-07-26 15:10:59 +0200)

----------------------------------------------------------------
linux-user patches

Enable fsmount() syscalls and fix build with Linux 7.2 kernel headers.

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

Cédric Le Goater (1):
linux-user: Guard local FUTEX_CMD_MASK definition

Matt Turner (1):
linux-user: fix guards for the fsmount(2) syscall series

 linux-user/strace.c       | 2 +-
 linux-user/strace.list    | 2 +-
 linux-user/syscall.c      | 4 ++--
 linux-user/syscall_defs.h | 2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.54.0
#1 lore raw

[PULL 2/2] linux-user: fix guards for the fsmount(2) syscall series

From: Matt Turner <[email protected]>

The fsopen(), fsconfig(), fsmount() and fspick() implementations are guarded by defined(NR_fsopen) rather than defined(__NR_fsopen). No such macro exists, so the guard is never true and the entire series compiles out. Guests calling any of the four get -ENOSYS, which for example makes systemd's credential setup fail with EXIT_CREDENTIALS for most units.

The strace bits for fsconfig() have the same typo.

Fixes 767c32fe6983 ("linux-user: implement fsmount(2) series of syscalls")
Fixes 6e0aa9f6c731 ("linux-user/strace: add fsmount series of syscalls")
---
 linux-user/strace.c    | 2 +-
 linux-user/strace.list | 2 +-
 linux-user/syscall.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
linux-user/strace.c +1 -1
index 3a81cc95f4..af1cf9548a 100644
@@ -4344,7 +4344,7 @@ print_statx(CPUArchState *cpu_env, const struct syscallname *name,
 }
 #endif
 
-#if defined(TARGET_NR_fsconfig) && defined(NR_fsconfig)
+#if defined(TARGET_NR_fsconfig) && defined(__NR_fsconfig)
 static void
 print_fsconfig_cmd_name(int cmd)
 {
linux-user/strace.list +1 -1
index e363892e0a..ba1c1dc0ae 100644
@@ -1725,7 +1725,7 @@
 #ifdef TARGET_NR_fsopen
 { TARGET_NR_fsopen, "fsopen", "%s(%s,%d)", NULL, NULL },
 #endif
-#if defined(TARGET_NR_fsconfig) && defined(NR_fsconfig)
+#if defined(TARGET_NR_fsconfig) && defined(__NR_fsconfig)
 { TARGET_NR_fsconfig, "fsconfig", NULL, print_fsconfig, NULL },
 #endif
 #ifdef TARGET_NR_fsmount
linux-user/syscall.c +2 -2
index 3da5530d42..740142825d 100644
@@ -9740,7 +9740,7 @@ _syscall5(int, sys_move_mount, int, __from_dfd, const char *, __from_pathname,
            int, __to_dfd, const char *, __to_pathname, unsigned int, flag)
 #endif
 
-#if defined(TARGET_NR_fsopen) && defined(NR_fsopen)
+#if defined(TARGET_NR_fsopen) && defined(__NR_fsopen)
 #define __NR_sys_fsopen __NR_fsopen
 _syscall2(int, sys_fsopen, const char *, fs_name, unsigned int, flags);
 #define __NR_sys_fsconfig __NR_fsconfig
@@ -14485,7 +14485,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
         return do_map_shadow_stack(cpu_env, arg1, arg2, arg3);
 #endif
 
-#if defined(TARGET_NR_fsopen) && defined(NR_fsopen)
+#if defined(TARGET_NR_fsopen) && defined(__NR_fsopen)
     case TARGET_NR_fsopen:
         {
             p = lock_user_string(arg1);
Signature · 1 line
2.54.0
#5 lore raw

[PULL 1/2] linux-user: Guard local FUTEX_CMD_MASK definition

In reply to Helge Deller

From: Cédric Le Goater <[email protected]>

Building linux-user on a host with Linux 7.2 kernel headers fails with a macro redefinition error for FUTEX_CMD_MASK. The kernel commit 3ca9595d9fb6 ("futex: Add support for unlocking robust futexes") expanded the mask to include the new FUTEX_ROBUST_UNLOCK and FUTEX_ROBUST_LIST32 flags, which conflicts with QEMU's local definition.

Add a #ifndef guard so the host definition takes precedence when available. The local fallback is kept for older kernel headers (pre-2.6.29) that lack FUTEX_CMD_MASK or define a mask without FUTEX_CLOCK_REALTIME.

---
 linux-user/syscall_defs.h | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall_defs.h +2 -0
index 5799769f83..e033c7db34 100644
@@ -2593,7 +2593,9 @@ struct target_drm_i915_getparam {
 
 #define FUTEX_PRIVATE_FLAG      128
 #define FUTEX_CLOCK_REALTIME    256
+#ifndef FUTEX_CMD_MASK
 #define FUTEX_CMD_MASK          ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
+#endif
 
 #if defined(TARGET_X86_64)
 #define TARGET_EPOLL_PACKED QEMU_PACKED
Signature · 1 line
2.54.0
#2 lore raw

Re: [PULL 2/2] linux-user: fix guards for the fsmount(2) syscall series

In reply to Helge Deller
Quoted 10 lines · Helge Deller

From: Matt Turner <[email protected]>

The fsopen(), fsconfig(), fsmount() and fspick() implementations are guarded by defined(NR_fsopen) rather than defined(__NR_fsopen). No such macro exists, so the guard is never true and the entire series compiles out. Guests calling any of the four get -ENOSYS, which for example makes systemd's credential setup fail with EXIT_CREDENTIALS for most units.

The strace bits for fsconfig() have the same typo.

Please take a look at the following CI failure:

../linux-user/strace.c: In function ‘print_fsconfig_cmd_name’:
../linux-user/strace.c:4352:10: error: ‘FSCONFIG_SET_FLAG’ undeclared (first use in this function)
4352 | case FSCONFIG_SET_FLAG:
| ^~~~~~~~~~~~~~~~~

https://gitlab.com/qemu-project/qemu/-/jobs/15553379213#L2358

Once this has been fixed, please send a v2 pull request. Thanks!

Stefan

Quoted 63 lines
Fixes 767c32fe6983 ("linux-user: implement fsmount(2) series of syscalls")
Fixes 6e0aa9f6c731 ("linux-user/strace: add fsmount series of syscalls")
---
 linux-user/strace.c    | 2 +-
 linux-user/strace.list | 2 +-
 linux-user/syscall.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
linux-user/strace.c +1 -1
index 3a81cc95f4..af1cf9548a 100644
@@ -4344,7 +4344,7 @@ print_statx(CPUArchState *cpu_env, const struct syscallname *name,
 }
 #endif
 
-#if defined(TARGET_NR_fsconfig) && defined(NR_fsconfig)
+#if defined(TARGET_NR_fsconfig) && defined(__NR_fsconfig)
 static void
 print_fsconfig_cmd_name(int cmd)
 {
linux-user/strace.list +1 -1
index e363892e0a..ba1c1dc0ae 100644
@@ -1725,7 +1725,7 @@
 #ifdef TARGET_NR_fsopen
 { TARGET_NR_fsopen, "fsopen", "%s(%s,%d)", NULL, NULL },
 #endif
-#if defined(TARGET_NR_fsconfig) && defined(NR_fsconfig)
+#if defined(TARGET_NR_fsconfig) && defined(__NR_fsconfig)
 { TARGET_NR_fsconfig, "fsconfig", NULL, print_fsconfig, NULL },
 #endif
 #ifdef TARGET_NR_fsmount
linux-user/syscall.c +2 -3
index 3da5530d42..740142825d 100644
@@ -9740,7 +9740,7 @@ _syscall5(int, sys_move_mount, int, __from_dfd, const char *, __from_pathname,
            int, __to_dfd, const char *, __to_pathname, unsigned int, flag)
 #endif
 
-#if defined(TARGET_NR_fsopen) && defined(NR_fsopen)
+#if defined(TARGET_NR_fsopen) && defined(__NR_fsopen)
 #define __NR_sys_fsopen __NR_fsopen
 _syscall2(int, sys_fsopen, const char *, fs_name, unsigned int, flags);
 #define __NR_sys_fsconfig __NR_fsconfig
@@ -14485,7 +14485,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
         return do_map_shadow_stack(cpu_env, arg1, arg2, arg3);
 #endif
 
-#if defined(TARGET_NR_fsopen) && defined(NR_fsopen)
+#if defined(TARGET_NR_fsopen) && defined(__NR_fsopen)
     case TARGET_NR_fsopen:
         {
             p = lock_user_string(arg1);
--

2.54.0

#3 lore raw

Re: [PULL 2/2] linux-user: fix guards for the fsmount(2) syscall series

Quoted 20 lines · Stefan Hajnoczi
Quoted 10 lines · Helge Deller

From: Matt Turner <[email protected]>

The fsopen(), fsconfig(), fsmount() and fspick() implementations are guarded by defined(NR_fsopen) rather than defined(__NR_fsopen). No such macro exists, so the guard is never true and the entire series compiles out. Guests calling any of the four get -ENOSYS, which for example makes systemd's credential setup fail with EXIT_CREDENTIALS for most units.

The strace bits for fsconfig() have the same typo.

Please take a look at the following CI failure:

../linux-user/strace.c: In function ‘print_fsconfig_cmd_name’:
../linux-user/strace.c:4352:10: error: ‘FSCONFIG_SET_FLAG’ undeclared (first use in this function)
4352 | case FSCONFIG_SET_FLAG:
| ^~~~~~~~~~~~~~~~~

Quoted 3 lines

https://gitlab.com/qemu-project/qemu/-/jobs/15553379213#L2358

Once this has been fixed, please send a v2 pull request. Thanks!

I've sent a new pull request.
I added a dependency on the availability of the FSCONFIG_SET_FLAG define. This is okay for now, but maybe a better fix is possible?

Usually this define should be available, but it doesn't seem to
be in that chroot image.
I'm sure I'm missing something, but is it somewhere documented how to get that chroot image locally so that I can reproduce the problem?

Helge

#4 lore raw

Re: [PULL 2/2] linux-user: fix guards for the fsmount(2) syscall series

Quoted 26 lines · Helge Deller
Quoted 20 lines · Stefan Hajnoczi
Quoted 10 lines · Helge Deller

From: Matt Turner <[email protected]>

The fsopen(), fsconfig(), fsmount() and fspick() implementations are guarded by defined(NR_fsopen) rather than defined(__NR_fsopen). No such macro exists, so the guard is never true and the entire series compiles out. Guests calling any of the four get -ENOSYS, which for example makes systemd's credential setup fail with EXIT_CREDENTIALS for most units.

The strace bits for fsconfig() have the same typo.

Please take a look at the following CI failure:

../linux-user/strace.c: In function ‘print_fsconfig_cmd_name’:
../linux-user/strace.c:4352:10: error: ‘FSCONFIG_SET_FLAG’ undeclared (first use in this function)
4352 | case FSCONFIG_SET_FLAG:
| ^~~~~~~~~~~~~~~~~

Quoted 3 lines

https://gitlab.com/qemu-project/qemu/-/jobs/15553379213#L2358

Once this has been fixed, please send a v2 pull request. Thanks!

Quoted 8 lines

I've sent a new pull request.
I added a dependency on the availability of the FSCONFIG_SET_FLAG define. This is okay for now, but maybe a better fix is possible?

Usually this define should be available, but it doesn't seem to
be in that chroot image.
I'm sure I'm missing something, but is it somewhere documented how to get that chroot image locally so that I can reproduce the problem?

$ git grep build-without-default
.gitlab-ci.d/buildtest.yml:build-without-defaults:
$ cat .gitlab-ci.d/buildtest.yml
...
# Check our reduced build configurations
build-without-defaults:
  extends: .native_build_job_template
  needs:
    - job: amd64-centos9-container
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  variables:
    IMAGE: centos9
    ^^^^^^^^^^^^^^^^
$ git grep amd64-centos9-container
.gitlab-ci.d/container-core.yml:amd64-centos9-container

The amd64-centos9-container job builds the tests/docker/dockerfiles/centos9.docker Dockerfile.

You can reproduce QEMU's centos9 image locally with make docker-image-centos9.

Stefan