[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201207112410.GA26628@nautica>
Date: Mon, 7 Dec 2020 12:24:10 +0100
From: Dominique Martinet <asmadeus@...ewreck.org>
To: Chengguang Xu <cgxu519@...ernel.net>
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
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
Powered by blists - more mailing lists