1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

Kernel: Enable SMAP protection earlier during syscall entry

There's no reason to delay this for as long as we did.
This commit is contained in:
Andreas Kling 2021-12-17 11:34:29 +01:00
parent 0ae8702692
commit ed839450c8

View file

@ -164,6 +164,9 @@ ErrorOr<FlatPtr> handle(RegisterState& regs, FlatPtr function, FlatPtr arg1, Fla
NEVER_INLINE void syscall_handler(TrapFrame* trap)
{
// Make sure SMAP protection is enabled on syscall entry.
clac();
auto& regs = *trap->regs;
auto current_thread = Thread::current();
VERIFY(current_thread->previous_mode() == Thread::PreviousMode::UserMode);
@ -182,9 +185,6 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap)
current_thread->yield_if_stopped();
// Make sure SMAP protection is enabled on syscall entry.
clac();
// Apply a random offset in the range 0-255 to the stack pointer,
// to make kernel stacks a bit less deterministic.
u32 lsw;