From: Conor Dooley <conor@kernel.org>
To: Andrew Bresticker <abrestic@rivosinc.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Celeste Liu <coelacanthus@outlook.com>,
dram <dramforever@live.com>, Ruizhe Pan <c141028@gmail.com>,
Conor.Dooley@microchip.com, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 0/2] Make mmap() with PROT_WRITE imply PROT_READ
Date: Tue, 11 Oct 2022 18:04:02 +0100 [thread overview]
Message-ID: <Y0WiAgnN5IcQDrez@spud> (raw)
In-Reply-To: <20220915193702.2201018-1-abrestic@rivosinc.com>
Hey Palmer,
On Thu, Sep 15, 2022 at 03:37:00PM -0400, Andrew Bresticker wrote:
> Commit 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is
> invalid") made mmap() reject mappings with only PROT_WRITE set in an
> attempt to fix an observed inconsistency in behavior when attempting
> to read from a PROT_WRITE-only mapping. The root cause of this behavior
> was actually that while RISC-V's protection_map maps VM_WRITE to
> readable PTE permissions (since write-only PTEs are considered reserved
> by the privileged spec), the page fault handler considered loads from
> VM_WRITE-only VMAs illegal accesses. Fix the underlying cause by
> handling faults in VM_WRITE-only VMAs (patch 1) and then re-enable
> use of mmap(PROT_WRITE) (patch 2), making RISC-V's behavior consistent
> with all other architectures that don't support write-only PTEs.
>
> Both patches are tagged as fixes for the aforementioned commit since that
> commit made a userspace visible change that will break any software relying
> on mmap(PROT_WRITE). (Also cc: stable since the offending commit was
> itself backported to stable).
The patch that these commits fix has hit the distros & manifests as a
userspace breakage for openJDK:
https://lore.kernel.org/linux-riscv/a69ee775-e565-3d72-eb5f-8378616694d3@gmail.com/
https://lore.kernel.org/linux-riscv/d6c9e249-08bd-4439-7dcc-371b32e7b851@canonical.com/
Eva tested these patches and reported that their problem was fixed:
https://lore.kernel.org/linux-riscv/20282242-5cad-42be-ce6c-834b0e7ef269@gmail.com/
I asked them for a T-b but I don't see one on lore etc, but it would be
from Eva Kotova <nyandarknessgirl@gmail.com> if you consider their
comments their sufficient for a T-B
Thanks,
Conor.
>
> v1 -> v2: Allow handling of load faults in VM_WRITE VMAs
> v2 -> v3: Split into two pathces
> v3 -> v4: Fixes tags (+ this cover letter)
>
> Andrew Bresticker (2):
> riscv: Make VM_WRITE imply VM_READ
> riscv: Allow PROT_WRITE-only mmap()
>
> arch/riscv/kernel/sys_riscv.c | 3 ---
> arch/riscv/mm/fault.c | 3 ++-
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> --
> 2.25.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2022-10-11 17:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 19:37 [PATCH v4 0/2] Make mmap() with PROT_WRITE imply PROT_READ Andrew Bresticker
2022-09-15 19:37 ` [PATCH v4 1/2] riscv: Make VM_WRITE imply VM_READ Andrew Bresticker
2022-09-15 19:37 ` [PATCH v4 2/2] riscv: Allow PROT_WRITE-only mmap() Andrew Bresticker
2022-10-11 17:04 ` Conor Dooley [this message]
2022-10-13 21:01 ` [PATCH v4 0/2] Make mmap() with PROT_WRITE imply PROT_READ Palmer Dabbelt
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=Y0WiAgnN5IcQDrez@spud \
--to=conor@kernel.org \
--cc=Conor.Dooley@microchip.com \
--cc=abrestic@rivosinc.com \
--cc=c141028@gmail.com \
--cc=coelacanthus@outlook.com \
--cc=dramforever@live.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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).