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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44812CD343D for ; Tue, 3 Sep 2024 14:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bDqnEweAQ91ZaX2BP7Rb9KWNWhs+lCN9D8yckPy3xkQ=; b=vnsxnXQxfXisyhEaIDJiaQxwgw +wZPAq7ZGNWJ2aDBdHyGrFLCzD1ibSmfSxJusdOsuekEiQiTefcUQiJ4xzHm1EJJdd967yc/xHQGY xBRNbLDeTlNTuOx0z9iuTZT6Cd0NzPpu/oLnhjcByY/nzVADzz4TiKknEUsrfd6bJfmedSYRitkBl IqhjInpS/7ExPCwG71Mo67mA/HBVsKixtKL6+LUZ3MPX4ZQx+hYraXXl0kPHVKQmFUx+iYCwKMxc4 XkQE1WzAg1BJcmczoh8oWB2HihH6PHl3cOPjIRbb432HTu4dW6GJk/pB3p9k8Mp4NRHbDn4RgVNMG 0KCM2X9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUsw-00000000gCo-2z7b; Tue, 03 Sep 2024 14:51:58 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUs2-00000000fvj-3hLe for linux-arm-kernel@bombadil.infradead.org; Tue, 03 Sep 2024 14:51:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bDqnEweAQ91ZaX2BP7Rb9KWNWhs+lCN9D8yckPy3xkQ=; b=IZpvqSGDQEkGaXbAplelNMjx2m 98OGYgHt7mk+OVkioCUmQy7rL+XCivLFtOzo6mb9UO9H0hbWaa4QDV8P3NywN2Rh9rSVNFd57f9pV xinnSFnX31Bkf5rot045Qo4+dACj0dUJU5SAkjA6Y/qketUeZn6HHOwdpvoU+WfncUHhclJo4nUxs 3rqyJDN3+4K2DZf3CIDupvVBu3EtEv8eISc99wjSzHkSGBwBiri/BObNjBl8ZFMWD71TwVPrpgm2/ A+ShYPv8bg6RO5q1rJ1yqMd72mTbDxdbpohfxYMphqg5tN/Rl6BfLLLXvYVb/XI4p7Xh6AsWNdLKI ufYUoF6Q==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUrz-0000000CLYx-1tgK for linux-arm-kernel@lists.infradead.org; Tue, 03 Sep 2024 14:51:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 16944FEC; Tue, 3 Sep 2024 07:51:21 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54B823F66E; Tue, 3 Sep 2024 07:50:51 -0700 (PDT) Date: Tue, 3 Sep 2024 15:50:46 +0100 From: Joey Gouly To: Mark Brown Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, anshuman.khandual@arm.com, bp@alien8.de, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, skhan@linuxfoundation.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v5 16/30] arm64: handle PKEY/POE faults Message-ID: <20240903144823.GA3669886@e124191.cambridge.arm.com> References: <20240822151113.1479789-1-joey.gouly@arm.com> <20240822151113.1479789-17-joey.gouly@arm.com> <40600b75-68eb-421a-a122-256bd20afb89@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40600b75-68eb-421a-a122-256bd20afb89@sirena.org.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_155059_725945_6052CA0C X-CRM114-Status: GOOD ( 16.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 29, 2024 at 06:55:07PM +0100, Mark Brown wrote: > On Thu, Aug 22, 2024 at 04:10:59PM +0100, Joey Gouly wrote: > > > +static bool fault_from_pkey(unsigned long esr, struct vm_area_struct *vma, > > + unsigned int mm_flags) > > +{ > > + unsigned long iss2 = ESR_ELx_ISS2(esr); > > + > > + if (!system_supports_poe()) > > + return false; > > + > > + if (iss2 & ESR_ELx_Overlay) > > + return true; > > Does this need an is_data_abort() && is_instruction_abort() check? > Overlay doesn't appear to be defined for all exception types and it > wasn't clear enough to me that the callers have done this check. The only callers are in do_page_fault(), which should only be data or instruction aborts. I talked with Catalin and he said it's fine to not check again here. I can add a permissions check though: commit 033270f5a9462e998b4dee11fc91b43ac7929756 Author: Joey Gouly Date: Tue Sep 3 15:45:59 2024 +0100 fixup! arm64: handle PKEY/POE faults diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index a68055150950..f651553a8ab8 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -495,6 +495,9 @@ static bool fault_from_pkey(unsigned long esr, struct vm_area_struct *vma, if (!system_supports_poe()) return false; + if (!esr_fsc_is_permission_fault(esr)) + return false; + if (iss2 & ESR_ELx_Overlay) return true; Since the ESR_EL1 documentation says: If a memory access generates a Data Abort for a Permission fault, then this field holds information about the fault. Thanks, Joey