From: "Maciej W. Rozycki" <macro@wdc.com>
To: Lichao Liu <liulichao@loongson.cn>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-mips@vger.kernel.org,
"Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: [PATCH] MIPS: Grant pte read permission, even if vma only have VM_WRITE permission.
Date: Fri, 31 Jul 2020 23:37:29 +0100 (BST) [thread overview]
Message-ID: <alpine.LFD.2.21.2007312312300.24175@redsun52.ssa.fujisawa.hgst.com> (raw)
In-Reply-To: <c42085fa-43f7-c845-79d7-8b30eefb78da@loongson.cn>
On Fri, 24 Jul 2020, Lichao Liu wrote:
> > IMHO it's exactly the point of RIXI enabled CPUs to support a
> > writeonly mapping even if most of other archs aren't able to
> > support it. So if there is no real good reason to change this,
> > I'm going to leave it this way.
[...]
> I think there are have two solutions to the problem:
> 1)modify fault_in_user_writeable(),
> must claim read permission when claiming write permission.
> 2)Grant pte read permission, even if vma only have VM_WRITE permission.
>
> But not sure which one is more suitable.
Well, the internal documentation is clear:
* fault_in_user_writeable() - Fault in user address and verify RW access
so if it does only verify W rather than RW access, then it has to be fixed
and verify both kinds of access at a time. Presumably:
mmap_read_lock(mm);
ret = fixup_user_fault(current, mm, (unsigned long)uaddr, 0, NULL);
if (!ret)
ret = fixup_user_fault(current, mm, (unsigned long)uaddr,
FAULT_FLAG_WRITE, NULL);
mmap_read_unlock(mm);
at the minimum or perhaps by expanding the interface of `fixup_user_fault'
to also support FAULT_FLAG_RW so as to avoid the double call.
As Thomas says silently expanding access permissions beyond what has been
granted would be a security breach.
Maciej
next prev parent reply other threads:[~2020-07-31 22:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 9:55 [PATCH] MIPS: Grant pte read permission, even if vma only have VM_WRITE permission Lichao Liu
2020-07-22 9:36 ` Thomas Bogendoerfer
2020-07-24 1:50 ` Lichao Liu
2020-07-31 22:37 ` Maciej W. Rozycki [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-06-30 0:58 Lichao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.21.2007312312300.24175@redsun52.ssa.fujisawa.hgst.com \
--to=macro@wdc.com \
--cc=linux-mips@vger.kernel.org \
--cc=liulichao@loongson.cn \
--cc=macro@linux-mips.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).