[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/7] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mp
From: |
Helge Deller |
Subject: |
[PATCH 6/7] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect() |
Date: |
Sat, 24 Sep 2022 13:45:00 +0200 |
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>
---
linux-user/mmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index dba6823668..b7478ad0fa 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -105,6 +105,8 @@ static int validate_prot_to_pageflags(int *host_prot, int
prot)
page_flags |= PAGE_MTE;
}
}
+#elif TARGET_HPPA
+ valid |= PROT_GROWSDOWN | PROT_GROWSUP;
#endif
return prot & ~valid ? 0 : page_flags;
--
2.37.3
- [PATCH 0/7] linux-user fixes for hppa target - part 2, Helge Deller, 2022/09/24
- [PATCH 2/7] linux-user: Add proper strace format strings for getdents()/getdents64(), Helge Deller, 2022/09/24
- [PATCH 4/7] linux-user/hppa: Drop stack guard page on hppa target, Helge Deller, 2022/09/24
- [PATCH 5/7] linux-user/hppa: Increase guest stack size to 80MB for hppa target, Helge Deller, 2022/09/24
- [PATCH 7/7] linux-user/hppa: Fix setup_sigcontext(), Helge Deller, 2022/09/24
- [PATCH 1/7] linux-user: Fix TARGET_PROT_SEM for XTENSA, Helge Deller, 2022/09/24
- [PATCH 6/7] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect(),
Helge Deller <=
- [PATCH 3/7] linux-user/hppa: Add signal trampoline for hppa target, Helge Deller, 2022/09/24
- Re: [PATCH 0/7] linux-user fixes for hppa target - part 2, Laurent Vivier, 2022/09/27