Re: [V9fs-developer] [RFC PATCH] 9p: create writeback fid on shared mmap

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

 



Chengguang Xu wrote on Mon, Dec 07, 2020:
>  > , VM_MAYWRITE is set anytime we have a shared map where file has
>  > been opened read-write, which seems to be what you want with regards to
>  > protecting from mprotect calls.
>  > 
>  > How about simply changing check from WRITE to MAYWRITE?
> 
> It would be fine and based on the code in do_mmap(), it  seems we even don't
> need extra check here.  The condition (vma->vm_flags & VM_SHARED) will be enough.
> Am I missing something?

VM_MAYWRITE is unset if the file hasn't been open for writing (in which
case the mapping can't be mprotect()ed to writable map), so checking it
is a bit more efficient.

Anyway I'd like to obsolete the writeback fid uses now that fids have a
refcount (this usecase can be a simple refcount increase), in which case
efficiency is less of a problem, but we're not there yet...

Please resend with MAYWRITE if you want authorship and I'll try to take
some time to test incl. the mprotect usecase.

-- 
Dominique



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux