[KINETIC][PATCH] UBUNTU: SAUCE: Revert "riscv: mmap with PROT_WRITE but no PROT_READ is invalid"
Dimitri John Ledkov
dimitri.ledkov at canonical.com
Tue Oct 11 17:00:05 UTC 2022
This reverts commit 9795ca67b5d3eeeb4b602cbc34f72f41af6df142.
Upstream reported riscv regression of userspace (OpenJDK).
BugLink: https://bugs.launchpad.net/bugs/1992484
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
arch/riscv/kernel/sys_riscv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c
index 571556bb92..9c0194f176 100644
--- a/arch/riscv/kernel/sys_riscv.c
+++ b/arch/riscv/kernel/sys_riscv.c
@@ -18,8 +18,9 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len,
if (unlikely(offset & (~PAGE_MASK >> page_shift_offset)))
return -EINVAL;
- if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ)))
- return -EINVAL;
+ if ((prot & PROT_WRITE) && (prot & PROT_EXEC))
+ if (unlikely(!(prot & PROT_READ)))
+ return -EINVAL;
return ksys_mmap_pgoff(addr, len, prot, flags, fd,
offset >> (PAGE_SHIFT - page_shift_offset));
--
2.34.1
More information about the kernel-team
mailing list