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

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
parent 6136faa4eb
commit 32e93c8808

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));
}