Kernel: Mark write_cr0() and write_cr4() as UNMAP_AFTER_INIT

This removes a very useful tool for attackers trying to disable
SMAP/SMEP/etc. :^)
This commit is contained in:
Andreas Kling 2021-02-19 18:25:28 +01:00
commit 32e93c8808
Notes: sideshowbarker 2024-07-18 22:08:53 +09:00

View file

@ -720,12 +720,12 @@ void exit_trap(TrapFrame* trap)
return Processor::current().exit_trap(*trap);
}
void write_cr0(u32 value)
NEVER_INLINE UNMAP_AFTER_INIT void write_cr0(u32 value)
{
asm volatile("movl %%eax, %%cr0" ::"a"(value));
}
void write_cr4(u32 value)
NEVER_INLINE UNMAP_AFTER_INIT void write_cr4(u32 value)
{
asm volatile("movl %%eax, %%cr4" ::"a"(value));
}