--- B Srinivas <b.srinivas@xxxxxxxxxxxx> ha scritto: > > > Hi all, > I'm developing a LKM. I'm working on threads that, > as > obvious, share the same process address space. I' ve > already setted the shared portion of memory as not > writable. > Now I've to manage the access to this memory by > having > a notification any time a thread tries to write on. > I think the solution is to change an exception > handler > but I've not an idea of what exception handler is > called when a process tries to write on a "not > writable" portion of memory... > >> AFAIK it is the page fault handler which is called >> while traversing the page table. > > Can anyone help me or give me other suggests? > Thanks. > Vincenzo. > I know that the page fault handler is the one called also when a COW occurres. So I've implemented a function like this: asmlinkage void cmc_handler(struct pt_regs * regs,long err_code) { void (*cmc_old_int_handler)(struct pt_regs *,long) = (void *) cmc_old_handler; printk(KERN_DEBUG "Hijacking of page_fault\n"); (*cmc_old_int_handler)(regs,err_code); return; } that, later in the module, substitues the do_page_handler function (cmc_old_handler) in the idt. I then prove a user mode program by wich I try to write on a not writable memory region. I try also a user mode program that do a fork. Theorically, the "Hijacking of page fault" string must be returned in these cases, but no string of this type is returned. Can anyone suggest me a solution? Thanks. Vincenzo Mallozzi. P.S. What's about general_protection handler? ___________________________________ Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica? Scaricalo ora! http://it.messenger.yahoo.it -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/