mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 11:57:35 +00:00
Kernel: Over-align the FPUState on the stack in sigreturn
The stack is misaligned at this point for some reason, this is a hack that makes the resulting object "correctly" aligned, thus avoiding a KUBSAN error.
This commit is contained in:
parent
a5d4824abe
commit
6608812e4b
1 changed files with 4 additions and 1 deletions
|
@ -89,7 +89,10 @@ ErrorOr<FlatPtr> Process::sys$sigreturn([[maybe_unused]] RegisterState& register
|
|||
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
// The FPU state is at the top here, pop it off and restore it.
|
||||
Thread::current()->fpu_state() = TRY(copy_typed_from_user<FPUState>(stack_ptr));
|
||||
// FIXME: The stack alignment is off by 8 bytes here, figure this out and remove this excessively aligned object.
|
||||
alignas(alignof(FPUState) * 2) FPUState data {};
|
||||
TRY(copy_from_user(&data, bit_cast<FPUState const*>(stack_ptr)));
|
||||
Thread::current()->fpu_state() = data;
|
||||
stack_ptr += sizeof(FPUState);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue