From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6A403CF02E; Thu, 21 May 2026 12:25:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779366311; cv=none; b=AXsz1QONef3V41WXKKWhk0phFf24RqJn4x2XyuKYLIrq0XpH0yajGIhuqloFiwNpGuMcxwhnG0jK2IrsrA3vdu9MydVo9ptjut9byNXrExhoRCYEG4OnbKm6ChWfnsErhJf87QRTcmrkXbpurlNTqHC4Kn4p3qpI3JpaI7xnPcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779366311; c=relaxed/simple; bh=KUjCzoopzTTEwHIzusx3oU4AqEOvMG0KszjI0HD/+KY=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=jz4uSP6Gm0k++jiXROzY/qM0FAn/fT9ys3FXvLWrPsbny6cak5x+UntDeye1TufZxG99NmPeF5Nd8O2tYyO0ziUrv9+qi589TIYoEu2iDoUvAM/6QEZrAREygWWQLR/CaSNmLqYap3/w5j39BGxrvSYdaCBD0OKlcMI/igT5elw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZzPjrtOV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZzPjrtOV" 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) Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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.