1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Kernel: Set TLS-related members of Process after loading static program

We previously ignored these values in the return value of
load_elf_object, which causes us to not allocate a TLS region for
statically-linked programs.
This commit is contained in:
Itamar 2021-03-15 21:56:13 +02:00 committed by Andreas Kling
parent 4cb38f6dd8
commit 2365e06b12
2 changed files with 9 additions and 1 deletions

View file

@ -310,6 +310,7 @@ static KResultOr<LoadResult> load_elf_object(NonnullOwnPtr<Space> new_space, Fil
ph_load_result = region_or_error.error();
return IterationDecision::Break;
}
master_tls_region = region_or_error.value();
master_tls_size = program_header.size_in_memory();
master_tls_alignment = program_header.alignment();
@ -444,6 +445,11 @@ KResultOr<LoadResult> Process::load(NonnullRefPtr<FileDescription> main_program_
auto result = load_elf_object(new_space.release_nonnull(), main_program_description, FlatPtr { 0 }, ShouldAllocateTls::Yes);
if (result.is_error())
return result.error();
m_master_tls_region = result.value().tls_region;
m_master_tls_size = result.value().tls_size;
m_master_tls_alignment = result.value().tls_alignment;
return result;
}