lkml.org 
[lkml]   [2006]   [Mar]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSun, 05 Mar 2006 15:18:33 -0500
FromBrice Goglin <>
SubjectRe: MMAP: How a driver can get called on mprotect()
Aritz Bastida wrote:

>Nonetheless the question is the same: a char device with mmap
>implemented can get called any time a new vma is created or destroyed
>(a process creating a new mmap):  vma_open() and vma_close().
>
>But if a user process changes the mmap protections calling mprotect()?
>How can the driver know about that? Is there any way to do that?
> 
>

You probably want to remove VM_MAYWRITE from vma->vm_flags in the mmap
vm_op of your char device.
For instance, see how the DRM device mmap protection is set when you're
not admin and the device is read-only:
    http://sosdg.org/~coywolf/lxr/source/drivers/char/drm/drm_vm.c#L570

Brice

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

\
 
 \ /
  Last update: 2006-03-05 21:11    [W:0.067 / U:0.340 seconds]
©2003-2008 Jasper Spaans