1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:07:46 +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:
sin-ack 2022-10-01 19:29:59 +00:00 committed by Andrew Kaster
parent 3275015786
commit ef6921d7c7
9 changed files with 43 additions and 7 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <Kernel/API/POSIX/sys/limits.h>
#include <Kernel/API/serenity_limits.h>
#include <bits/posix1_lim.h>
#include <bits/stdint.h>
#include <bits/wchar.h>
@ -86,8 +87,6 @@
#define ARG_MAX 65536
#define PTHREAD_STACK_MIN 65536
#define SSIZE_MAX 2147483647
#define LINK_MAX 4096