[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1763d55f12b.11abdd4431975.7848752990749710617@mykernel.net>
Date: Mon, 07 Dec 2020 21:13:31 +0800
From: Chengguang Xu <cgxu519@...ernel.net>
To: "Dominique Martinet" <asmadeus@...ewreck.org>
Cc: "ericvh" <ericvh@...il.com>, "lucho" <lucho@...kov.net>,
"linux-fsdevel" <linux-fsdevel@...r.kernel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
"v9fs-developer" <v9fs-developer@...ts.sourceforge.net>
Subject: Re: [V9fs-developer] [RFC PATCH] 9p: create writeback fid on shared
mmap
---- 在 星期一, 2020-12-07 19:24:10 Dominique Martinet <asmadeus@...ewreck.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
Powered by blists - more mailing lists