lkml.org 
[lkml]   [2020]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [V9fs-developer] [RFC PATCH] 9p: create writeback fid on shared mmap
 ---- 在 星期一, 2020-12-07 19:24:10 Dominique Martinet <asmadeus@codewreck.org> 撰写 ----
> 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.
>

Thanks for the review, I'll send revised version later.

Thanks,
Chengguang

\
 
 \ /
  Last update: 2020-12-07 14:16    [W:0.052 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site