write-protecting a kernel page

From: Borislav Deianov (borislav@lix.polytechnique.fr)
Date: Thu Feb 10 2000 - 11:49:16 EST


Hi,

I'm trying to write-protect a kernel page, for debugging purposes. I
want to get an oops when something (in ther kernel) tries to write to
it. Here is what I have (ptr points to the start of the page):

unsigned long address = (unsigned long)ptr;
pgd_t *src_pgd = pgd_offset_k(address);
pmd_t *src_pmd = pmd_offset(src_pgd, address);
pte_t *src_pte = pte_offset(src_pmd, address);
pte_t pte = *src_pte;
pte = pte_wrprotect(pte);
set_pte(src_pte, pte);
flush_tlb_all();

The problem is I can still write to the page after that. What am I
doing wrong? This is on a dual PIII machine, btw.

Thanks,
Borislav

-
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.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:18 EST