linux: force stack area mapping at requested address

With `MAP_FIXED` absent from the mmap(3p) flags, "the implementation uses
addr in an implementation-defined manner to arrive at pa", which may
lead to a mapping at an address diffent to the requested `addr`.

Add `MAP_FIXED` to the mmmap flags to force mapping to the specified
address.

Fixes #5147
This commit is contained in:
Benjamin Lamowski 2024-03-18 11:55:09 +01:00 committed by Christian Helmuth
parent 6315a09369
commit 1b313df419

View File

@ -61,7 +61,7 @@ static inline Genode::addr_t reserve_stack_area()
using namespace Genode;
using Genode::size_t;
int const flags = MAP_ANONYMOUS | MAP_PRIVATE;
int const flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED;
int const prot = PROT_NONE;
size_t const size = stack_area_virtual_size();
void * const addr_in = (void *)stack_area_virtual_base();