mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +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
Notes:
sideshowbarker
2024-07-17 17:56:35 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/6608812e4b Pull-request: https://github.com/SerenityOS/serenity/pull/12762
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
Reference in a new issue