diff options
author | Andreas Kling <kling@serenityos.org> | 2021-12-17 11:34:29 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-18 11:30:10 +0100 |
commit | ed839450c8568e8f6176a491c28c2db0d5abcf0b (patch) | |
tree | d315ea337f7cc8834152ffa4beb019924e22d02b /Kernel | |
parent | 0ae870269226f7eee92a2aed119f46d408da9400 (diff) | |
download | serenity-ed839450c8568e8f6176a491c28c2db0d5abcf0b.zip |
Kernel: Enable SMAP protection earlier during syscall entry
There's no reason to delay this for as long as we did.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Syscall.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 1675902433..cd6199153a 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -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; |