[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] linux-user/hppa: Drop stack guard page on hppa target
From: |
Helge Deller |
Subject: |
[PATCH 4/7] linux-user/hppa: Drop stack guard page on hppa target |
Date: |
Sat, 24 Sep 2022 13:44:58 +0200 |
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>
---
linux-user/elfload.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ce902dbd56..51ec5dd668 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2033,9 +2033,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;
}
error = target_mmap(0, size + guard, PROT_READ | PROT_WRITE,
@@ -2051,7 +2057,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;
}
--
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 <=
- [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, 2022/09/24
- [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