summaryrefslogtreecommitdiffstats
path: root/linux-user
diff options
context:
space:
mode:
authorHelge Deller2022-09-24 13:44:58 +0200
committerLaurent Vivier2022-09-27 09:33:56 +0200
commitf43882052f330ce5f5a1a2553466df5aa0808fa0 (patch)
tree718a6ed64db2acb39e6ba3a7d7b2d03628a0f48e /linux-user
parentlinux-user/hppa: Add signal trampoline for hppa target (diff)
downloadqemu-f43882052f330ce5f5a1a2553466df5aa0808fa0.tar.gz
qemu-f43882052f330ce5f5a1a2553466df5aa0808fa0.tar.xz
qemu-f43882052f330ce5f5a1a2553466df5aa0808fa0.zip
linux-user/hppa: Drop stack guard page on hppa target
The stack-overflow check when building the "grep" debian package fails on the debian hppa target. Reason is, that the guard page at the top of the stack (which is added by qemu) prevents the fault handler in the grep program to properly detect the stack overflow. The Linux kernel on a physical machine doesn't install a guard page either, so drop it and as such fix the build of "grep". Signed-off-by: Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-5-deller@gmx.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ba5c4c02e5..c7e3f1d47c 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2096,9 +2096,15 @@ static abi_ulong setup_arg_pages(struct linux_binprm *bprm,
if (size < STACK_LOWER_LIMIT) {
size = STACK_LOWER_LIMIT;
}
- guard = TARGET_PAGE_SIZE;
- if (guard < qemu_real_host_page_size()) {
- guard = qemu_real_host_page_size();
+
+ if (STACK_GROWS_DOWN) {
+ guard = TARGET_PAGE_SIZE;
+ if (guard < qemu_real_host_page_size()) {
+ guard = qemu_real_host_page_size();
+ }
+ } else {
+ /* no guard page for hppa target where stack grows upwards. */
+ guard = 0;
}
prot = PROT_READ | PROT_WRITE;
@@ -2118,7 +2124,6 @@ static abi_ulong setup_arg_pages(struct linux_binprm *bprm,
info->stack_limit = error + guard;
return info->stack_limit + size - sizeof(void *);
} else {
- target_mprotect(error + size, guard, PROT_NONE);
info->stack_limit = error + size;
return error;
}