Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
	kvm@vger.kernel.org, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v2 01/13] arm64: Add ESR fault helpers
Date: Mon, 14 Sep 2026 12:41:12 +0000	[thread overview]
Message-ID: <20260914124113.07ED01F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914-kvm-arm-prefault-v2-1-26fb47f74b73@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Generic ESR helpers `esr_trap_is_iabt()` and `esr_abt_is_exec_fault()` silently ignore instruction aborts from the current Exception level (`ESR_ELx_EC_IABT_CUR`).
--

commit 5b92bb137f8d48a92e83b6486d7d57faacb410df
Author: Lorenzo Stoakes (ARM) <ljs@kernel.org>

arm64: Add ESR fault helpers

This commit adds helper functions that operate directly on ESR values, mirroring
equivalent KVM vCPU wrappers to allow KVM's stage-2 fault handling to operate
on plain ESR values.

> diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h
> index f816f5d77f1a5..9c0205983d9a8 100644
> --- a/arch/arm64/include/asm/esr.h
> +++ b/arch/arm64/include/asm/esr.h
> @@ -437,6 +437,50 @@
>  #ifndef __ASSEMBLER__
>  #include <asm/types.h>
>  
> +static __always_inline u8 esr_get_ec(unsigned long esr)
> +{
> +	return ESR_ELx_EC(esr);
> +}
> +
> +static __always_inline bool esr_trap_is_iabt(unsigned long esr)
> +{
> +	return esr_get_ec(esr) == ESR_ELx_EC_IABT_LOW;
> +}

[Severity: Low]
Does this intentionally ignore instruction aborts originating from the current
Exception level (ESR_ELx_EC_IABT_CUR)?

While this is safe for the current KVM stage-2 fault handling which only
processes LOW traps, moving this to a generic architectural header with a
generic name introduces a trap for future callers evaluating host kernel
page faults. It also contrasts with esr_is_data_abort() in the same file,
which correctly checks both LOW and CUR variants.

[ ... ]

> +static __always_inline bool esr_abt_is_exec_fault(unsigned long esr)
> +{
> +	return esr_trap_is_iabt(esr) && !esr_abt_is_s1ptw(esr);
> +}

[Severity: Low]
Because this relies on esr_trap_is_iabt(), does this mean it will also
misclassify current-EL execution faults?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-kvm-arm-prefault-v2-0-26fb47f74b73@kernel.org?part=1

  reply	other threads:[~2026-09-14 12:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 12:26 [PATCH v2 00/13] KVM: arm64: Add KVM_PRE_FAULT_MEMORY support Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 01/13] arm64: Add ESR fault helpers Lorenzo Stoakes (ARM)
2026-09-14 12:41   ` sashiko-bot [this message]
2026-09-14 12:26 ` [PATCH v2 02/13] KVM: arm64: Use ESR helpers in guest abort handling Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 03/13] KVM: arm64: Propagate and use esr in s2fd when handling guest aborts Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 04/13] KVM: arm64: Propagate and use mmu " Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 05/13] KVM: arm64: Propagate and use kvm_s2_fault_result on S2 fault Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 06/13] KVM: arm64: Size the stage-2 memcache from the fault MMU Lorenzo Stoakes (ARM)
2026-09-14 13:26   ` sashiko-bot
2026-09-14 12:26 ` [PATCH v2 07/13] KVM: arm64: Propagate EHWPOISON in kvm_s2_fault_pin_pfn() Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 08/13] KVM: arm64: Pass walk flags to kvm_pgtable_get_leaf() Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 09/13] KVM: arm64: Implement KVM_PRE_FAULT_MEMORY Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 10/13] Documentation: KVM: document arm64 KVM_PRE_FAULT_MEMORY Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 11/13] KVM: selftests: Enable pre_fault_memory_test for arm64 Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 12/13] KVM: selftests: Add option for different backing in pre-fault tests Lorenzo Stoakes (ARM)
2026-09-14 12:26 ` [PATCH v2 13/13] KVM: selftests: Add nested pre-fault test for arm64 Lorenzo Stoakes (ARM)
2026-09-22  9:58 ` [PATCH v2 00/13] KVM: arm64: Add KVM_PRE_FAULT_MEMORY support Aneesh Kumar K.V
2026-09-22 12:52   ` Lorenzo Stoakes (ARM)
2026-09-22 13:07     ` Aneesh Kumar K.V
2026-09-22 13:53       ` Lorenzo Stoakes (ARM)
2026-09-22 14:22         ` Aneesh Kumar K.V
2026-09-22 14:26           ` Lorenzo Stoakes (ARM)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260914124113.07ED01F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=ljs@kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox