From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46289C433FE for ; Sun, 16 Oct 2022 09:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229663AbiJPJaY (ORCPT ); Sun, 16 Oct 2022 05:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbiJPJaW (ORCPT ); Sun, 16 Oct 2022 05:30:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAEE42FC0B for ; Sun, 16 Oct 2022 02:30:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 623A9B80B68 for ; Sun, 16 Oct 2022 09:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76328C433D6; Sun, 16 Oct 2022 09:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665912619; bh=dfmfSgKmvnNu04kMNmkNkShQ6YP4Ww/py5f8Foq/oNc=; h=Subject:To:Cc:From:Date:From; b=y19AhU3SgG7/4j8BjDQi0S+CRXjaoqrC2gIXoff93Gux3eVbA04x8R28KPYZIAOMZ M0UOmL0KynfW9FjXhwJDt+i4gtid/dC5tX3ugTlgmhFgLKyxGOU9a7dRR/XYGWhZet bBd38AlUURceWHHNSbCKx9U8NvXtOhTx6VJu5SpI= Subject: FAILED: patch "[PATCH] riscv: Make VM_WRITE imply VM_READ" failed to apply to 5.4-stable tree To: abrestic@rivosinc.com, atishp@rivosinc.com, palmer@rivosinc.com Cc: From: Date: Sun, 16 Oct 2022 11:31:02 +0200 Message-ID: <166591266223349@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Possible dependencies: 7ab72c597356 ("riscv: Make VM_WRITE imply VM_READ") afb8c6fee8ce ("riscv/mm/fault: Move access error check to function") 6747430197ed ("riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault()") ac416a724f11 ("riscv/mm/fault: Move vmalloc fault handling to vmalloc_fault()") a51271d99cdd ("riscv/mm/fault: Move bad area handling to bad_area()") cac4d1dc85be ("riscv/mm/fault: Move no context handling to no_context()") d8ed45c5dcd4 ("mmap locking API: use coccinelle to convert mmap_sem rwsem call sites") 7ae77150d94d ("Merge tag 'powerpc-5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 7ab72c597356be1e7f0f3d856e54ce78527f43c8 Mon Sep 17 00:00:00 2001 From: Andrew Bresticker Date: Thu, 15 Sep 2022 15:37:01 -0400 Subject: [PATCH] riscv: Make VM_WRITE imply VM_READ 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 Signed-off-by: Andrew Bresticker Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220915193702.2201018-2-abrestic@rivosinc.com/ Signed-off-by: Palmer Dabbelt 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;