mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 1/2] riscv: Make VM_WRITE imply VM_READ
@ 2022-09-09 21:27 Andrew Bresticker
  2022-09-09 21:27 ` [PATCH v3 2/2] riscv: Allow PROT_WRITE-only mmap() Andrew Bresticker
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Bresticker @ 2022-09-09 21:27 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Paul Walmsley, Celeste Liu, dram, Ruizhe Pan, linux-riscv,
	linux-kernel, Andrew Bresticker, Atish Patra

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.

Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
---
 arch/riscv/mm/fault.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index f2fbd1400b7c..d86f7cebd4a7 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -184,7 +184,8 @@ static inline bool access_error(unsigned long cause, struct vm_area_struct *vma)
 		}
 		break;
 	case EXC_LOAD_PAGE_FAULT:
-		if (!(vma->vm_flags & VM_READ)) {
+		/* Write implies read */
+		if (!(vma->vm_flags & (VM_READ | VM_WRITE))) {
 			return true;
 		}
 		break;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-15 17:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09 21:27 [PATCH v3 1/2] riscv: Make VM_WRITE imply VM_READ Andrew Bresticker
2022-09-09 21:27 ` [PATCH v3 2/2] riscv: Allow PROT_WRITE-only mmap() Andrew Bresticker
2022-09-15 16:56   ` Conor.Dooley
2022-09-15 17:27     ` Andrew Bresticker
2022-09-15 17:40       ` Conor.Dooley
2022-09-15 17:51         ` Vivian Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®