ACK: [JAMMY][PATCH] UBUNTU: SAUCE: Revert "riscv: mmap with PROT_WRITE but no PROT_READ is invalid"

Cory Todd cory.todd at canonical.com
Tue Oct 11 17:19:18 UTC 2022


On Tue, Oct 11, 2022 at 06:02:27PM +0100, Dimitri John Ledkov wrote:
> This reverts commit 4fc4fa4f729dccbc36467bae17c3a037d59b95a4.
> 
> 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 8a7880b9c4..12f8a7fce7 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
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Cory Todd <cory.todd at canonical.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20221011/e478325d/attachment.sig>


More information about the kernel-team mailing list