this commit makes write_cr0(read_cr0() | 0x10000)
useless, next time you see a 5.x linux kernel, good luck
according to this stackoverflow question, we cannot:
- disable CR0's Write-Protection bits
- set RO page to RW
i think ive found a solution:
since lkm runs in ring0, why not just write to cr0
directly, why bother using write_cr0
?
/* needed for hooking */
static inline void
write_cr0_forced(unsigned long val)
{
unsigned long __force_order;
/* __asm__ __volatile__( */
asm volatile(
"mov %0, %%cr0"
: "+r"(val), "+m"(__force_order));
}
static inline void
protect_memory(void)
{
write_cr0_forced(cr0);
}
static inline void
unprotect_memory(void)
{
write_cr0_forced(cr0 & ~0x00010000);
}
Comments
comments powered by Disqus