Skip to contentSkip to conversation

linux-user: Fix strace output for s390x mmap()

PATCH Superseded Ilya Leoshkevich 2 participants 2 messages Nov 19, 2024 – Nov 20, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Fix strace output for s390x mmap()

print_mmap() assumes that mmap() receives arguments via memory if mmap2() is present. s390x (as opposed to s390) does not fit this
pattern: it does not have mmap2(), but mmap() still receives arguments via memory.

Fix by special-casing s390x.

Fixes d971040c2d16 ("linux-user: Fix strace output for old_mmap")
---
 linux-user/strace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/strace.c +1 -1
index b70eadc19ef..50f41e746ec 100644
@@ -3971,7 +3971,7 @@ print_mmap(CPUArchState *cpu_env, const struct syscallname *name,
 {
     return print_mmap_both(cpu_env, name, arg0, arg1, arg2, arg3,
                            arg4, arg5,
-#if defined(TARGET_NR_mmap2)
+#if defined(TARGET_NR_mmap2) || defined(TARGET_S390X)
                             true
 #else
                             false
Signature · 1 line
2.47.0
#1 lore raw
Quoted 19 lines · Ilya Leoshkevich

print_mmap() assumes that mmap() receives arguments via memory if mmap2() is present. s390x (as opposed to s390) does not fit this
pattern: it does not have mmap2(), but mmap() still receives arguments via memory.

Fix by special-casing s390x.

Fixes d971040c2d16 ("linux-user: Fix strace output for old_mmap")
---
  linux-user/strace.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/strace.c +0 -0
index b70eadc19ef..50f41e746ec 100644

linux-user/strace.c print_mmap(CPUArchState *cpu_env, const struct syscallname *name, · line 3974

Quoted 5 lines
linux-user/strace.c +1 -1
@@ -3971,7 +3971,7 @@ print_mmap(CPUArchState *cpu_env, const struct syscallname *name,
  {
      return print_mmap_both(cpu_env, name, arg0, arg1, arg2, arg3,
                             arg4, arg5,
-#if defined(TARGET_NR_mmap2)
+#if defined(TARGET_NR_mmap2) || defined(TARGET_S390X)

I think we should explicitly match syscalls.c:

#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || \
    (defined(TARGET_ARM) && defined(TARGET_ABI32)) || \
    defined(TARGET_M68K) || defined(TARGET_MICROBLAZE) \
    || defined(TARGET_S390X)

r~