Re: [PATCH] riscv: Allow PROT_WRITE-only mmap()
From: SS JieJi
Date: Thu Sep 08 2022 - 13:21:34 EST
> is unnecessary since RISC-V defines its protection_map such that PROT_WRITE
> maps to the same PTE permissions as PROT_WRITE|PROT_READ, and it is
> inconsistent with other architectures that don't support write-only PTEs,
> creating a potential software portability issue.
I don't believe that the check is unnecessary. The missing check is
discovered in realworld scenario, while we are fixing libaio's test
failure on RISC-V [1]. A minimum reproducible example is uploaded to
https://fars.ee/1sPb, showing *inconsistent* read results on -r- pages
before/after a write attempt performed by the kernel.
[1]: https://pagure.io/libaio/blob/1b18bfafc6a2f7b9fa2c6be77a95afed8b7be448/f/harness/cases/5.t
> - if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ)))
> - return -EINVAL;
> -
Just to mention, this revert patch is removing the check of exec
without read (--x), too.