mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Kernel+LibC+LibELF: Set stack size based on PT_GNU_STACK during execve
Some programs explicitly ask for a different initial stack size than what the OS provides. This is implemented in ELF by having a PT_GNU_STACK header which has its p_memsz set to the amount that the program requires. This commit implements this policy by reading the p_memsz of the header and setting the main thread stack size to that. ELF::Image::validate_program_headers ensures that the size attribute is a reasonable value.
This commit is contained in:
parent
3275015786
commit
ef6921d7c7
9 changed files with 43 additions and 7 deletions
|
@ -360,7 +360,7 @@ struct SC_create_thread_params {
|
|||
// ... ok, if you say so posix. Guess we get to lie to people about guard page size
|
||||
unsigned int guard_page_size = 0; // Rounded up to PAGE_SIZE
|
||||
unsigned int reported_guard_page_size = 0; // The lie we tell callers
|
||||
unsigned int stack_size = 1 * MiB; // Default PTHREAD_STACK_MIN
|
||||
unsigned int stack_size = 1 * MiB; // Equal to Thread::default_userspace_stack_size
|
||||
void* stack_location; // nullptr means any, o.w. process virtual address
|
||||
# if ARCH(X86_64)
|
||||
FlatPtr rdi;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue