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 03DFACD5BA4 for ; Thu, 21 May 2026 12:25:13 +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:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID: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=ZScC40Tjduxa/5ReiIAjgbr4BdCwyUKFutprZ4pKc30=; b=jpOf1drS9NHnEnqkr5zlPPQelR a2ge1XnhoRYb7K5JYRNn3lEUHgZmH+9dcpYklml1TzpHtj/XzwpLsvr8JM6ckuzrrB6szK22iWlCg aA25Ly52E06ZUeFfySivmiPxWXVyP8SOn3C5jY9IFdhMoYiQFrlrqGS7WmgzJAKg1whTt/ZNqNuO/ XujquoZfspxu9bL/TndnreIMcjYIPeWsyGEugQ9yGl/h0ngkZ+vvEt9DayaZ+QO3iEwYOHx/2nUh9 VZlI3HIkvbfsmY2Fhg+063479c/pKX6ocRcZFq085/eHqzWVrRauBKejGP6Qd0aBmYlNTmXT0t3c5 hczrhDug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wQ2SY-00000007iqt-3IPw; Thu, 21 May 2026 12:25:06 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wQ2SW-00000007iqR-1fbI for linux-arm-kernel@lists.infradead.org; Thu, 21 May 2026 12:25:05 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 906CE42CBD; Thu, 21 May 2026 12:25:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE181F000E9; Thu, 21 May 2026 12:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779366303; bh=ZScC40Tjduxa/5ReiIAjgbr4BdCwyUKFutprZ4pKc30=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=ZzPjrtOVYWsAP3dtI2Qfv4W+HKL6glXzSn0vgLGLL96rcCNiW7vjtM6nBPMb3Ng8H G9dj1AjDw1bFUJ8whfPC4CFsPxPFCrEI3kLw9CoUVEWNET76qN7kpJ+etLKwIP+73f jtt5BHbwTpTYYZ6unbI5iADz3+2BLKthRgI+qhfY2BaU+B29T9Li8VoBox+JR1HhIq jsnPQWLR4aUek2kcURFSfQ45a7IZELZzfhA5pfaY0SGrIjuJNhMhwxkGPS12QAhH7E UlD/wHlZdXyBDz89jSKxk9qAg465mBXIKU5TGMPoV3CzD97N0B7q7qwoeCQsJyLjYy 6VYcuIU70wL5A== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wQ2ST-00000004oOX-1jAK; Thu, 21 May 2026 12:25:01 +0000 Date: Thu, 21 May 2026 13:25:00 +0100 Message-ID: <86fr3lvtk3.wl-maz@kernel.org> From: Marc Zyngier To: Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo.Pieralisi2@arm.com Subject: Re: [PATCH v14 03/44] arm64: RME: Handle Granule Protection Faults (GPFs) In-Reply-To: <20260513131757.116630-4-steven.price@arm.com> References: <20260513131757.116630-1-steven.price@arm.com> <20260513131757.116630-4-steven.price@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: steven.price@arm.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, joey.gouly@arm.com, alexandru.elisei@arm.com, christoffer.dall@arm.com, tabba@google.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, gshan@redhat.com, sdonthineni@nvidia.com, alpergun@google.com, aneesh.kumar@kernel.org, fj0570is@fujitsu.com, vannapurve@google.com, WeiLin.Chang@arm.com, Lorenzo.Pieralisi2@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260521_052504_479303_3CB48A2A X-CRM114-Status: GOOD ( 26.26 ) 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 Wed, 13 May 2026 14:17:11 +0100, Steven Price wrote: > > If the host attempts to access granules that have been delegated for use > in a realm these accesses will be caught and will trigger a Granule > Protection Fault (GPF). > > A fault during a page walk signals a bug in the kernel and is handled by > oopsing the kernel. A non-page walk fault could be caused by user space > having access to a page which has been delegated to the kernel and will > trigger a SIGBUS to allow debugging why user space is trying to access a > delegated page. > > Reviewed-by: Suzuki K Poulose > Reviewed-by: Gavin Shan > Signed-off-by: Steven Price > --- > Changes since v10: > * Don't call arm64_notify_die() in do_gpf() but simply return 1. > Changes since v2: > * Include missing "Granule Protection Fault at level -1" > --- > arch/arm64/mm/fault.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index 0f3c5c7ca054..6358ea4787ba 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -905,6 +905,22 @@ static int do_tag_check_fault(unsigned long far, unsigned long esr, > return 0; > } > > +static int do_gpf_ptw(unsigned long far, unsigned long esr, struct pt_regs *regs) > +{ > + const struct fault_info *inf = esr_to_fault_info(esr); > + > + die_kernel_fault(inf->name, far, esr, regs); > + return 0; > +} > + > +static int do_gpf(unsigned long far, unsigned long esr, struct pt_regs *regs) > +{ > + if (!is_el1_instruction_abort(esr) && fixup_exception(regs, esr)) > + return 0; > + > + return 1; > +} > + > static const struct fault_info fault_info[] = { > { do_bad, SIGKILL, SI_KERNEL, "ttbr address size fault" }, > { do_bad, SIGKILL, SI_KERNEL, "level 1 address size fault" }, > @@ -941,12 +957,12 @@ static const struct fault_info fault_info[] = { > { do_bad, SIGKILL, SI_KERNEL, "unknown 32" }, > { do_alignment_fault, SIGBUS, BUS_ADRALN, "alignment fault" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 34" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 35" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 36" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 37" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 38" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 39" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 40" }, > + { do_gpf_ptw, SIGKILL, SI_KERNEL, "Granule Protection Fault at level -1" }, > + { do_gpf_ptw, SIGKILL, SI_KERNEL, "Granule Protection Fault at level 0" }, > + { do_gpf_ptw, SIGKILL, SI_KERNEL, "Granule Protection Fault at level 1" }, > + { do_gpf_ptw, SIGKILL, SI_KERNEL, "Granule Protection Fault at level 2" }, > + { do_gpf_ptw, SIGKILL, SI_KERNEL, "Granule Protection Fault at level 3" }, > + { do_gpf, SIGBUS, SI_KERNEL, "Granule Protection Fault not on table walk" }, It wouldn't hurt to align the textual description with what we have for other fault syndromes: "level X granule protection fault (translation table walk)" for the PTW-trigger faults, and "granule protection fault" for the non PTW case. Thanks, M. -- Without deviation from the norm, progress is not possible.