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

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

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux