From 25523e73a4f3af5dcbe237c8f0211f43648ac589 Mon Sep 17 00:00:00 2001 From: Nicholas Mosier Date: Wed, 27 Nov 2024 04:11:27 -0800 Subject: [PATCH] arch-x86, sim-se: move mmap end downward in case of large stacks (#1810) Fix #1809. Shift the mmap end to a lower address in case the process has a large max stack size, to avoid overlapping the stack with the mmap memory range. Change-Id: Idae343dbbe851a7510463ff141c03f1847e36328 --- src/arch/x86/process.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index 9af685dac6..fff0c0d26c 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -114,7 +114,7 @@ X86_64Process::X86_64Process(const ProcessParams ¶ms, Addr stack_base = 0x7FFFFFFFF000ULL; Addr max_stack_size = params.maxStackSize; Addr next_thread_stack_base = stack_base - max_stack_size; - Addr mmap_end = 0x7FFFF7FFF000ULL; + Addr mmap_end = std::min(0x7FFFF7FFF000ULL, next_thread_stack_base); memState = std::make_shared( this, brk_point, stack_base, max_stack_size,