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

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Tue Oct 11 17:22:54 UTC 2022


On Tue, Oct 11, 2022 at 06:02:27PM +0100, Dimitri John Ledkov wrote:
> This reverts commit 4fc4fa4f729dccbc36467bae17c3a037d59b95a4.
, which is commit 2139619bcad7ac44cc8f6f749089120594056613 upstream.

Just usual to mention what upstream commit is being reverted.

Acked-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>

The ACK is also valid to apply it on top of linux-riscv derivative directly.

> 
> 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



More information about the kernel-team mailing list