mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Pick the maximum out of the requested stack sizes
This commit is contained in:
parent
dcd462a050
commit
ed74f792e2
Notes:
sideshowbarker
2024-07-17 07:20:57 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/ed74f792e2 Pull-request: https://github.com/SerenityOS/serenity/pull/18278 Reviewed-by: https://github.com/supercomputer7 ✅
1 changed files with 5 additions and 6 deletions
|
@ -284,7 +284,7 @@ static ErrorOr<LoadResult> load_elf_object(Memory::AddressSpace& new_space, Open
|
|||
size_t master_tls_size = 0;
|
||||
size_t master_tls_alignment = 0;
|
||||
FlatPtr load_base_address = 0;
|
||||
size_t stack_size = 0;
|
||||
size_t stack_size = Thread::default_userspace_stack_size;
|
||||
|
||||
auto elf_name = TRY(object_description.pseudo_path());
|
||||
VERIFY(!Processor::in_critical());
|
||||
|
@ -381,7 +381,10 @@ static ErrorOr<LoadResult> load_elf_object(Memory::AddressSpace& new_space, Open
|
|||
return load_section(program_header);
|
||||
|
||||
if (program_header.type() == PT_GNU_STACK) {
|
||||
stack_size = program_header.size_in_memory();
|
||||
auto new_stack_size = program_header.size_in_memory();
|
||||
|
||||
if (new_stack_size > stack_size)
|
||||
stack_size = new_stack_size;
|
||||
}
|
||||
|
||||
// NOTE: We ignore other program header types.
|
||||
|
@ -397,10 +400,6 @@ static ErrorOr<LoadResult> load_elf_object(Memory::AddressSpace& new_space, Open
|
|||
return result;
|
||||
}());
|
||||
|
||||
if (stack_size == 0) {
|
||||
stack_size = Thread::default_userspace_stack_size;
|
||||
}
|
||||
|
||||
if (!elf_image.entry().offset(load_offset).get()) {
|
||||
dbgln("do_exec: Failure loading program, entry pointer is invalid! {})", elf_image.entry().offset(load_offset));
|
||||
return ENOEXEC;
|
||||
|
|
Loading…
Reference in a new issue