[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/37] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in m
From: |
Laurent Vivier |
Subject: |
[PULL 23/37] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect() |
Date: |
Wed, 28 Sep 2022 22:27:23 +0200 |
From: Helge Deller <deller@gmx.de>
The hppa platform uses an upwards-growing stack and required in Linux
kernels < 5.18 an executable stack for signal processing. For that some
executables and libraries are marked to have an executable stack, for
which glibc uses the mprotect() syscall to mark the stack like this:
mprotect(xfa000000,4096,PROT_EXEC|PROT_READ|PROT_WRITE|PROT_GROWSUP).
Currently qemu will return -TARGET_EINVAL for this syscall because of the
checks in validate_prot_to_pageflags(), which doesn't allow the
PROT_GROWSUP or PROT_GROWSDOWN flags and thus triggers this error in the
guest:
error while loading shared libraries: libc.so.6: cannot enable executable
stack as shared object requires: Invalid argument
Allow mprotect() to handle both flags and thus fix the guest.
The glibc tst-execstack testcase can be used to reproduce the issue.
Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-7-deller@gmx.de>
[lvivier: s/elif TARGET_HPPA/elif defined(TARGET_HPPA)/]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/mmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index e557f3626e5d..28f3bc85ed45 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -106,6 +106,8 @@ static int validate_prot_to_pageflags(int *host_prot, int
prot)
page_flags |= PAGE_MTE;
}
}
+#elif defined(TARGET_HPPA)
+ valid |= PROT_GROWSDOWN | PROT_GROWSUP;
#endif
return prot & ~valid ? 0 : page_flags;
--
2.37.3
- [PULL 12/37] linux-user: Show timespec on strace for futex(), (continued)
- [PULL 12/37] linux-user: Show timespec on strace for futex(), Laurent Vivier, 2022/09/28
- [PULL 08/37] linux-user/hppa: Dump IIR on register dump, Laurent Vivier, 2022/09/28
- [PULL 14/37] linux-user: Fix madvise(MADV_DONTNEED) on alpha, Laurent Vivier, 2022/09/28
- [PULL 18/37] linux-user: Fix TARGET_PROT_SEM for XTENSA, Laurent Vivier, 2022/09/28
- [PULL 13/37] linux-user: Provide MADV_* definitions, Laurent Vivier, 2022/09/28
- [PULL 15/37] linux-user: Implement stracing madvise(), Laurent Vivier, 2022/09/28
- [PULL 21/37] linux-user/hppa: Drop stack guard page on hppa target, Laurent Vivier, 2022/09/28
- [PULL 20/37] linux-user/hppa: Add signal trampoline for hppa target, Laurent Vivier, 2022/09/28
- [PULL 16/37] linux-user: Passthrough MADV_DONTNEED for certain file mappings, Laurent Vivier, 2022/09/28
- [PULL 17/37] tests/tcg/linux-test: Add linux-madvise test, Laurent Vivier, 2022/09/28
- [PULL 23/37] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect(),
Laurent Vivier <=
- [PULL 22/37] linux-user/hppa: Increase guest stack size to 80MB for hppa target, Laurent Vivier, 2022/09/28
- [PULL 24/37] linux-user/hppa: Fix setup_sigcontext(), Laurent Vivier, 2022/09/28
- [PULL 26/37] linux-user: Don't assume 0 is not a valid host timer_t value, Laurent Vivier, 2022/09/28
- [PULL 30/37] linux-user: Combine do_futex and do_futex_time64, Laurent Vivier, 2022/09/28
- [PULL 27/37] linux-user/s390x: Save/restore fpc when handling a signal, Laurent Vivier, 2022/09/28
- [PULL 32/37] linux-user: Implement FUTEX_WAKE_BITSET, Laurent Vivier, 2022/09/28
- [PULL 33/37] linux-user: Convert signal number for FUTEX_FD, Laurent Vivier, 2022/09/28
- [PULL 29/37] linux-user: Set ELF_BASE_PLATFORM for MIPS, Laurent Vivier, 2022/09/28
- [PULL 19/37] linux-user: Add proper strace format strings for getdents()/getdents64(), Laurent Vivier, 2022/09/28
- [PULL 31/37] linux-user: Sink call to do_safe_futex, Laurent Vivier, 2022/09/28