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

Andrew Bresticker abrestic at rivosinc.com
Thu Sep 8 12:18:02 PDT 2022


On Thu, Sep 8, 2022 at 2:57 PM SS JieJi <c141028 at gmail.com> 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



More information about the linux-riscv mailing list