@samitouri / QOSamiQemu / commits / aba80ad9d8

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

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. Check if FSCONFIG_SET_FLAG is defined to avoid build errors in the strace code on some older distributions (Helge). Fixes: 767c32fe6983 ("linux-user: implement fsmount(2) series of syscalls") Fixes: 6e0aa9f6c731 ("linux-user/strace: add fsmount series of syscalls") Signed-off-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Helge Deller <deller@gmx.de> Signed-off-by: Helge Deller <deller@gmx.de>

Matt Turner committed Jul 25, 2026 at 20:55 UTC aba80ad9d853e436047899177f92334379de4537
3 files changed +4 -4
linux-user/strace.c
+1 -1
@@ -4344,7 +4344,7 @@ print_statx(CPUArchState *cpu_env, const struct syscallname *name,
4344 }
4345 #endif
4346
4347 -#if defined(TARGET_NR_fsconfig) && defined(NR_fsconfig)
4347 +#if defined(TARGET_NR_fsconfig) && defined(__NR_fsconfig) && defined(FSCONFIG_SET_FLAG)
4348 static void
4349 print_fsconfig_cmd_name(int cmd)
4350 {
linux-user/strace.list
+1 -1
@@ -1725,7 +1725,7 @@
1725 #ifdef TARGET_NR_fsopen
1726 { TARGET_NR_fsopen, "fsopen", "%s(%s,%d)", NULL, NULL },
1727 #endif
1728 -#if defined(TARGET_NR_fsconfig) && defined(NR_fsconfig)
1728 +#if defined(TARGET_NR_fsconfig) && defined(__NR_fsconfig) && defined(FSCONFIG_SET_FLAG)
1729 { TARGET_NR_fsconfig, "fsconfig", NULL, print_fsconfig, NULL },
1730 #endif
1731 #ifdef TARGET_NR_fsmount
linux-user/syscall.c
+2 -2
@@ -9740,7 +9740,7 @@ _syscall5(int, sys_move_mount, int, __from_dfd, const char *, __from_pathname,
9740 int, __to_dfd, const char *, __to_pathname, unsigned int, flag)
9741 #endif
9742
9743 -#if defined(TARGET_NR_fsopen) && defined(NR_fsopen)
9743 +#if defined(TARGET_NR_fsopen) && defined(__NR_fsopen)
9744 #define __NR_sys_fsopen __NR_fsopen
9745 _syscall2(int, sys_fsopen, const char *, fs_name, unsigned int, flags);
9746 #define __NR_sys_fsconfig __NR_fsconfig
@@ -14485,7 +14485,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
14485 return do_map_shadow_stack(cpu_env, arg1, arg2, arg3);
14486 #endif
14487
14488 -#if defined(TARGET_NR_fsopen) && defined(NR_fsopen)
14488 +#if defined(TARGET_NR_fsopen) && defined(__NR_fsopen)
14489 case TARGET_NR_fsopen:
14490 {
14491 p = lock_user_string(arg1);