Re: memory descriptor of threads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Vincenzo Mallozzi wrote:

> I'm developing a LKM to monitor threads sharing the same memory descriptor.

What do you call "memory descriptor" ? The mm_struct
(http://lxr.linux.no/source/include/linux/sched.h#L207) or the
vm_area_struct (http://lxr.linux.no/source/include/linux/mm.h#L61) ?

> I set this descriptor (or parts of it) as not writable and then catch the page 
> fault exception caused by one (or more) threads when trying to write on it.

When you say "set this descriptor as not writable", you mean changing
vm_area_struct->vm_page_prot ?

> The problem is that I've to catch only page fault exception caused by accesses 
> to global variable and not by accesses to local variables of each thread.
> To do this, I've to know precisely what are the vmas of the shared memory 
> descriptor in which are stored the local data of threads.

The local variables are stored on the stack. Simply don't mark the vma
covering the stack as read-only, or skip your code when a page fault
occurs in the stack.

Sincerly,

Thomas
-- 
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux