[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/37] linux-user/hppa: Drop stack guard page on hppa target
From: |
Laurent Vivier |
Subject: |
[PULL 21/37] linux-user/hppa: Drop stack guard page on hppa target |
Date: |
Wed, 28 Sep 2022 22:27:21 +0200 |
From: Helge Deller <deller@gmx.de>
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>
---
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 ba5c4c02e591..c7e3f1d47c16 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;
}
--
2.37.3
- [PULL 07/37] linux-user/hppa: Use EXCP_DUMP() to show enhanced debug info, (continued)
- [PULL 07/37] linux-user/hppa: Use EXCP_DUMP() to show enhanced debug info, Laurent Vivier, 2022/09/28
- [PULL 09/37] linux-user: Fix strace of chmod() if mode == 0, Laurent Vivier, 2022/09/28
- [PULL 06/37] linux-user: Log failing executable in EXCP_DUMP(), Laurent Vivier, 2022/09/28
- [PULL 10/37] linux-user/hppa: Set TASK_UNMAPPED_BASE to 0xfa000000 for hppa arch, Laurent Vivier, 2022/09/28
- [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 <=
- [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, 2022/09/28
- [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