write protect kernel page problem

From: Joel Hollingsworth (jkholl@CS.WM.EDU)
Date: Wed Mar 08 2000 - 16:46:17 EST


Hi,

I'm using the following code in an attempt to write protect
a kernel page dependent on a particular address:

char *ptr;
unsigned long addr;
pgd_t *kpgd;
pmd_t *kpmd;
pte_t *kpte;
pte_t pte;

ptr = kmalloc(sizeof(int),GFP_ATOMIC);
addr = (unsigned long)ptr;
kpgd = pgd_offset_k(addr);
kpmd = pmd_offset(kpgd,addr);
kpte = pte_offset(kpmd,addr);
pte = *kpte;
pte = pte_wrprotect(pte);
set_pte(kpte,pte);
flush_tlb_all();

Using 2.2.14 and have edited linux/arch/i386/mm/init.c to remove
the use of the 4MB kernel page tables. Everything seems to work
until the set_pte(kpte,pte) call. I crash the kernel at that point.

I followed a similar thread on this list concerning a 2.3.x
kernel, but am still a bit confused as to the problem I'm creating
here. Any thoughts or suggestions would be most appreciated.

Please cc to me, as I am not currently on the list.

thanks.

-joel
jkholl@cs.wm.edu

-
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 : Wed Mar 15 2000 - 21:00:14 EST