QEMU-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/3] Linux user patches
@ 2026-07-28  9:16 Helge Deller
  2026-07-28  9:16 ` [PULL 1/3] linux-user: Guard local FUTEX_CMD_MASK definition Helge Deller
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Helge Deller @ 2026-07-28  9:16 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi
  Cc: Yoshinori Sato, Cédric Le Goater, Helge Deller,
	Laurent Vivier, Matt Turner, Pierrick Bouvier

From: Helge Deller <deller@gmx.de>

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 db3abd36e4c7c2a72e00e5806cf4c47f5aa5c491:

  linux-user/sh4: allow full 32-bit address space (2026-07-28 11:12:37 +0200)

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

Enable fsmount() syscalls, fix build with Linux 7.2 kernel headers and
allow full 32-bit address space on sh4.

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

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

Laurent Vivier (1):
  linux-user/sh4: allow full 32-bit address space

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

 linux-user/sh4/target_mman.h | 2 +-
 linux-user/strace.c          | 2 +-
 linux-user/strace.list       | 2 +-
 linux-user/syscall.c         | 4 ++--
 linux-user/syscall_defs.h    | 2 ++
 target/sh4/cpu-param.h       | 8 +++-----
 6 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.54.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] linux-user: Guard local FUTEX_CMD_MASK definition
  2026-07-28  9:16 [PULL 0/3] Linux user patches Helge Deller
@ 2026-07-28  9:16 ` Helge Deller
  2026-07-28  9:16 ` [PULL 2/3] linux-user: fix guards for the fsmount(2) syscall series Helge Deller
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2026-07-28  9:16 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi
  Cc: Yoshinori Sato, Cédric Le Goater, Helge Deller,
	Laurent Vivier, Matt Turner, Pierrick Bouvier,
	Philippe Mathieu-Daudé

From: Cédric Le Goater <clg@redhat.com>

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.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Helge Deller <deller@gmx.de>
---
 linux-user/syscall_defs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 5799769f83..e033c7db34 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] linux-user: fix guards for the fsmount(2) syscall series
  2026-07-28  9:16 [PULL 0/3] Linux user patches Helge Deller
  2026-07-28  9:16 ` [PULL 1/3] linux-user: Guard local FUTEX_CMD_MASK definition Helge Deller
@ 2026-07-28  9:16 ` Helge Deller
  2026-07-28  9:16 ` [PULL 3/3] linux-user/sh4: allow full 32-bit address space Helge Deller
  2026-07-28 15:31 ` [PULL 0/3] Linux user patches Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2026-07-28  9:16 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi
  Cc: Yoshinori Sato, Cédric Le Goater, Helge Deller,
	Laurent Vivier, Matt Turner, Pierrick Bouvier

From: Matt Turner <mattst88@gmail.com>

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>
---
 linux-user/strace.c    | 2 +-
 linux-user/strace.list | 2 +-
 linux-user/syscall.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 3a81cc95f4..bc43a95a77 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -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) && 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 e363892e0a..25ace05187 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 3da5530d42..740142825d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] linux-user/sh4: allow full 32-bit address space
  2026-07-28  9:16 [PULL 0/3] Linux user patches Helge Deller
  2026-07-28  9:16 ` [PULL 1/3] linux-user: Guard local FUTEX_CMD_MASK definition Helge Deller
  2026-07-28  9:16 ` [PULL 2/3] linux-user: fix guards for the fsmount(2) syscall series Helge Deller
@ 2026-07-28  9:16 ` Helge Deller
  2026-07-28 15:31 ` [PULL 0/3] Linux user patches Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2026-07-28  9:16 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi
  Cc: Yoshinori Sato, Cédric Le Goater, Helge Deller,
	Laurent Vivier, Matt Turner, Pierrick Bouvier,
	John Paul Adrian Glaubitz

From: Laurent Vivier <laurent@vivier.eu>

On real SH4 hardware, the address space is split between user mode
(U0, 0x00000000-0x7fffffff) and kernel mode (P1-P4, 0x80000000-0xffffffff),
so TARGET_VIRT_ADDR_SPACE_BITS was set to 31 for CONFIG_USER_ONLY.

However, qemu-user does not emulate the MMU, so this limit is not needed.
The only effect is to restrict reserved_va to 2 GB, causing OOM failures
for memory-intensive builds (e.g. webkit2gtk on Debian sh4 buildds).

Set TARGET_VIRT_ADDR_SPACE_BITS to 32 unconditionally, like most other
32-bit targets. Also fix the TASK_UNMAPPED_BASE macro to use 1ull instead
of 1u to avoid undefined behavior when shifting by 32.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
---
 linux-user/sh4/target_mman.h | 2 +-
 target/sh4/cpu-param.h       | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/linux-user/sh4/target_mman.h b/linux-user/sh4/target_mman.h
index dd9016081e..2d05837c2f 100644
--- a/linux-user/sh4/target_mman.h
+++ b/linux-user/sh4/target_mman.h
@@ -1,6 +1,6 @@
 /* arch/sh/include/asm/processor_32.h */
 #define TASK_UNMAPPED_BASE \
-    TARGET_PAGE_ALIGN((1u << TARGET_VIRT_ADDR_SPACE_BITS) / 3)
+    TARGET_PAGE_ALIGN((1ull << TARGET_VIRT_ADDR_SPACE_BITS) / 3)
 
 /* arch/sh/include/asm/elf.h */
 #define ELF_ET_DYN_BASE       (TASK_UNMAPPED_BASE * 2)
diff --git a/target/sh4/cpu-param.h b/target/sh4/cpu-param.h
index c3b8114e53..9d72e35e31 100644
--- a/target/sh4/cpu-param.h
+++ b/target/sh4/cpu-param.h
@@ -9,10 +9,8 @@
 #define SH4_CPU_PARAM_H
 
 #define TARGET_PAGE_BITS 12  /* 4k */
-#ifdef CONFIG_USER_ONLY
-# define TARGET_VIRT_ADDR_SPACE_BITS 31
-#else
-# define TARGET_VIRT_ADDR_SPACE_BITS 32
-#endif
+
+/* qemu-user does not emulate the MMU, so no need to limit to 31 bits. */
+#define TARGET_VIRT_ADDR_SPACE_BITS 32
 
 #endif
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] Linux user patches
  2026-07-28  9:16 [PULL 0/3] Linux user patches Helge Deller
                   ` (2 preceding siblings ...)
  2026-07-28  9:16 ` [PULL 3/3] linux-user/sh4: allow full 32-bit address space Helge Deller
@ 2026-07-28 15:31 ` Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2026-07-28 15:31 UTC (permalink / raw)
  To: Helge Deller
  Cc: qemu-devel, Stefan Hajnoczi, Yoshinori Sato,
	Cédric Le Goater, Helge Deller, Laurent Vivier, Matt Turner,
	Pierrick Bouvier

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-28 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  9:16 [PULL 0/3] Linux user patches Helge Deller
2026-07-28  9:16 ` [PULL 1/3] linux-user: Guard local FUTEX_CMD_MASK definition Helge Deller
2026-07-28  9:16 ` [PULL 2/3] linux-user: fix guards for the fsmount(2) syscall series Helge Deller
2026-07-28  9:16 ` [PULL 3/3] linux-user/sh4: allow full 32-bit address space Helge Deller
2026-07-28 15:31 ` [PULL 0/3] Linux user patches Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox