Skip to content

Instantly share code, notes, and snippets.

@le4ker
Last active May 28, 2017 22:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save le4ker/2134037 to your computer and use it in GitHub Desktop.
Change the page protection in Linux kernel
static void disable_page_protection(void)
{
unsigned long cr0 = read_cr0();
if(cr0 & (1 << 16))
{
cr0 &= ~ (1 << 16);
write_cr0(cr0);
}
}
static void enable_page_protection(void)
{
unsigned long cr0 = read_cr0();
if(!(cr0 & (1 << 16)))
{
cr0 |= (1 << 16);
write_cr0(cr0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment