Re: [PATCH v2] riscv: Make mmap() with PROT_WRITE imply PROT_READ

From: Andrew Bresticker
Date: Thu Sep 08 2022 - 15:18:19 EST


On Thu, Sep 8, 2022 at 2:57 PM SS JieJi <c141028@xxxxxxxxx> wrote:
>
> The v2 patch looks great,
> > - if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ)))
> > - return -EINVAL;
> > -
> This also removes the check for --x pages, which used to be present in
> previous versions (before the submission of the to-be-reverted patch).
> Is this intended? Thanks!

There's no change in behavior for --X mappings; those have always been
allowed as it's a valid set of PTE permissions.

This patch does allow -WX mappings, which were originally disallowed
in commit e0d17c842c0f ("RISC-V: Don't allow write+exec only page
mapping request in mmap"), by implying read permissions for such
mappings as well. I have a note in the commit message about this.

-Andrew