diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-07 17:06:25 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-07 17:06:25 +0200 |
commit | 899233a9253b307b431801bf7b579dc70dc536fe (patch) | |
tree | 18721d71ef8de8f57a48506cccc7d0578d7fb87b /Kernel | |
parent | a635619cc03bfecde9ab82767ec2a8d95b4b46aa (diff) | |
download | serenity-899233a9253b307b431801bf7b579dc70dc536fe.zip |
Kernel: Handle running programs that don't have a TLS image
Programs without a PT_TLS header won't have a master TLS image for us
to copy, so we shouldn't try to copy the m_master_tls_region then.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Thread.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index c360b937fe..221bd1e1e2 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -637,5 +637,6 @@ void Thread::make_thread_specific_region(Badge<Process>) auto* thread_local_storage = (u8*)((u8*)thread_specific_data) - align_up_to(process().m_master_tls_size, process().m_master_tls_alignment); m_thread_specific_data = VirtualAddress((u32)thread_specific_data); thread_specific_data->self = thread_specific_data; - memcpy(thread_local_storage, process().m_master_tls_region->vaddr().as_ptr(), process().m_master_tls_size); + if (process().m_master_tls_size) + memcpy(thread_local_storage, process().m_master_tls_region->vaddr().as_ptr(), process().m_master_tls_size); } |