Capturing all writes as fault on a memory mapped page.

Greg KH greg at kroah.com
Wed May 28 09:29:35 EDT 2014


On Wed, May 28, 2014 at 06:47:24PM +0530, Pranay Srivastava wrote:
> Hi
> 
> I need to capture all writes on page which is memory mapped by the
> user program.

For what and what are you going to do with them once you "capture" them?

Are you trying to capture them in the kernel or in userspace?

> I've tried setting the vm_page_prot by disabling the
> VM_WRITE flag but even then the page fault occurs only once during the
> first write. VM_SHARED is set to stop COW in the __do_fault.
> 
> I was also trying to set_memory_ro(this may not be available for all
> archs?)  however I can't do that while handling the fault since the
> page table entries are created later after the
> vm_operations_struct->fault has installed the page for the fault.
> 
> I'm not having any clues on how to do this. Any help would be really
> helpful on this.

I don't think this is going to be possible, sorry, please go revisit
the reason you think you want to do this.

greg k-h



More information about the Kernelnewbies mailing list