[Q] How to set a page's protection from kernel land?

Inaky Perez Gonzalez (inaky@peloncho.fis.ucm.es)
Tue, 18 Aug 1998 13:51:02 +0200


Hi

I've been some hours trying to guess how to do this:

unsigned long pages;
pages = __get_free_pages (1, GFP_KERNEL);
mprotect (pages, 2*PAGE_SIZE, PROT_NONE);

from the kernel. Obviosuly, mprotect() should be sys_mprotect(), but
using it gives me a -EFAULT errno code. I'm afraid this is because the
page I've received with __get_free_pages() is not associated to any
current->mm MM context.

I need this to track a drunk pointer. I've developed an scheme
similar to that of Electric Fence within the kernel, but cannot manage
to set the protection. I've been lurking around linux/mm/mprotect.c
but cannot get anything clear.

Any help pls?

-- 

Linux-USB! http://peloncho.fis.ucm.es/~inaky/USB.html - - Inaky Perez Gonzalez -- PGP pubkey fingerprint - inaky@peloncho.fis.ucm.es -- 8E 34 3A 62 64 99 E2 44 - http://peloncho.fis.ucm.es/~inaky -- AD 7B 30 D9 DD FF 3E 4C - --------------------------------- -- ----------------------- - The loneliness of the long distance runner .....

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html