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.
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: ec4c92057b73 in 10.0.x
Fixes: 6e0aa9f6c731 ("linux-user/strace: add fsmount series of syscalls")
Fixes: f5e02d6a301e in 10.0.x
Signed-off-by: Matt Turner <[email protected]>
Reviewed-by: Helge Deller <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
(cherry picked from commit aba80ad9d853e436047899177f92334379de4537)
(Mjt: context fixup for 10.0.x)
Signed-off-by: Michael Tokarev <[email protected]>
diff --git a/linux-user/strace.c b/linux-user/strace.c
index d103ac00304..04464abded2 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -4312,7 +4312,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) &&
defined(FSCONFIG_SET_FLAG)
static void
print_fsconfig_cmd_name(int cmd)
{
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 6a5b27d4acf..e496bd4cab8 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -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) &&
defined(FSCONFIG_SET_FLAG)
{ TARGET_NR_fsconfig, "fsconfig", NULL, print_fsconfig, NULL },
#endif
#ifdef TARGET_NR_fsmount
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5d7c37017a3..019ce72613b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9458,7 +9458,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
@@ -14184,7 +14184,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int
num, abi_long arg1,
return do_riscv_hwprobe(cpu_env, arg1, arg2, arg3, arg4, arg5);
#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.47.3