riscv: Make VM_WRITE imply VM_READ
authorAndrew Bresticker <abrestic@rivosinc.com>
Thu, 15 Sep 2022 19:37:01 +0000 (15:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:22 +0000 (12:34 +0200)
commitc657b70e80745d969ad88de5981ba4e595a52a4e
tree9a9a61b02b107223fcd065daece29f5c46416f33
parent3c3c4fa118a44d554c2eafd56bb99a529720234c
riscv: Make VM_WRITE imply VM_READ

commit 7ab72c597356be1e7f0f3d856e54ce78527f43c8 upstream.

RISC-V does not presently have write-only mappings as that PTE bit pattern
is considered reserved in the privileged spec, so allow handling of read
faults in VMAs that have VM_WRITE without VM_READ in order to be consistent
with other architectures that have similar limitations.

Fixes: 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid")
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220915193702.2201018-2-abrestic@rivosinc.com/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/mm/fault.c