From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Wed, 28 May 2014 06:29:35 -0700 Subject: Capturing all writes as fault on a memory mapped page. In-Reply-To: References: Message-ID: <20140528132935.GA21480@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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