MMAP: How a driver can get called on mprotect()

From: Aritz Bastida
Date: Sun Mar 05 2006 - 13:10:00 EST


Hello, i have a driver which lets a region of its memory to be mmaped.
The memory can be read and written to from user processes, but sometimes
i just want to let read it, not write it.

I can do that playing with VM_READ and VM_WRITE in the driver's mmap() function,
and refuse to mmap if the user process tries to mmap for writing.

The problem is that, those flags can be changed from userspace with
mprotect() and my mapping count (vma's open and close functions) got
corrupted. Is there any way to get called when the process issues
mprotect(). Should I turn off VM_MAYWRITE and that kind of flags?

I hope my question is clear
Thank you
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/