mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
Kernel: Copy over TLS region size and alignment when forking
Previously we would unintentionally leave them zero-initialized, resulting in any threads created post fork (but without execve) having invalid thread local storage pointers stored in their FS register.
This commit is contained in:
parent
b35ebd31a4
commit
2a6b492c7f
1 changed files with 4 additions and 1 deletions
|
@ -168,8 +168,11 @@ ErrorOr<FlatPtr> Process::sys$fork(RegisterState& regs)
|
||||||
TRY(child_space->region_tree().place_specifically(*region_clone, region.range()));
|
TRY(child_space->region_tree().place_specifically(*region_clone, region.range()));
|
||||||
auto* child_region = region_clone.leak_ptr();
|
auto* child_region = region_clone.leak_ptr();
|
||||||
|
|
||||||
if (®ion == m_master_tls_region.unsafe_ptr())
|
if (®ion == m_master_tls_region.unsafe_ptr()) {
|
||||||
child->m_master_tls_region = TRY(child_region->try_make_weak_ptr());
|
child->m_master_tls_region = TRY(child_region->try_make_weak_ptr());
|
||||||
|
child->m_master_tls_size = m_master_tls_size;
|
||||||
|
child->m_master_tls_alignment = m_master_tls_alignment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue