Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Like Xu" <like.xu.linux@gmail.com>
Cc: "Oliver Upton" <oupton@kernel.org>,
	kvm@vger.kernel.org, kvmarm@lists.linux.dev,
	"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v2 3/3] KVM: selftests: arm64: Skip sea_to_user when EINJ places no poison
Date: Tue, 18 Aug 2026 11:41:02 +0000	[thread overview]
Message-ID: <20260818114103.433F01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818112920.26252-4-likexu@tencent.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The check skips the test unconditionally on any guest assertion failure, masking unrelated or future bugs.
--

--- Patch [3]: [PATCH v2 3/3] KVM: selftests: arm64: Skip sea_to_user when EINJ places no poison ---
commit 3bedaa634d562c6cc85fb3726d30fa40f0ed350d
Author: Like Xu <like.xu.linux@gmail.com>

KVM: selftests: arm64: Skip sea_to_user when EINJ places no poison

This commit modifies the sea_to_user selftest to skip rather than fail
when the firmware does not leave consumable poison in memory. It detects
this condition by checking if the exit reason is not KVM_EXIT_ARM_SEA
and a UCALL_ABORT is received from the guest.

> diff --git a/tools/testing/selftests/kvm/arm64/sea_to_user.c b/tools/testing/selftests/kvm/arm64/sea_to_user.c
> index 7cf95da8e594d..d4af6e0eed288 100644
> --- a/tools/testing/selftests/kvm/arm64/sea_to_user.c
> +++ b/tools/testing/selftests/kvm/arm64/sea_to_user.c
> @@ -215,13 +215,33 @@ static void run_vm(struct kvm_vm *vm, struct kvm_vcpu *vcpu)
>  
>  	ksft_print_msg("Dump kvm_run info about KVM_EXIT_%s\n",
>  		       exit_reason_str(run->exit_reason));
> +
> +	/*
> +	 * The guest's read of the injected location is expected to trap to KVM
> +	 * as an SEA. If it does not, the injected error was never placed as
> +	 * consumable poison: some firmware honours EINJ's notrigger request by
> +	 * arming the poison only as part of the (now skipped) trigger step, so
> +	 * nothing is left in memory for the guest to consume. The guest then
> +	 * reads back the sentinel value and reports it via GUEST_FAIL, which
> +	 * arm64 delivers as a ucall over MMIO (hence a KVM_EXIT_MMIO here).
> +	 * Treat that as "this platform cannot host the test" and skip, matching
> +	 * the requirement documented at the top of this file, rather than
> +	 * failing on a hardware/firmware limitation the test cannot control.
> +	 */
> +	if (run->exit_reason != KVM_EXIT_ARM_SEA &&
> +	    get_ucall(vcpu, &uc) == UCALL_ABORT) {

[Severity: Medium]
Does this unconditionally skip the test on any guest assertion failure,
masking unrelated or future bugs?

If KVM fails to exit to userspace and instead incorrectly injects a
Data Abort to the guest with an unexpected syndrome, the guest's SEA
handler might fail a GUEST_ASSERT_EQ check. This would emit a
UCALL_ABORT over MMIO.

The host loop here interprets any UCALL_ABORT during this phase as a
missing EINJ poison limitation, skipping the test instead of reporting
the failure.

Can we check the specific assertion failure reason or uc.buffer string
instead of catching all UCALL_ABORTs?

> +		ksft_print_msg("Guest consumed no SEA: %s", uc.buffer);
> +		ksft_exit_skip("EINJ notrigger placed no consumable poison on this platform\n");
> +	}
> +
> +	TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_ARM_SEA);
> +
> +	/* arm_sea holds valid data only for a KVM_EXIT_ARM_SEA exit. */
>  	ksft_print_msg("kvm_run.arm_sea: esr=%#llx, flags=%#llx\n",
>  		       run->arm_sea.esr, run->arm_sea.flags);
>  	ksft_print_msg("kvm_run.arm_sea: gva=%#llx, gpa=%#llx\n",

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818112920.26252-1-likexu@tencent.com?part=3

  reply	other threads:[~2026-08-18 11:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 11:29 [PATCH v2 0/3] KVM: selftests: arm64: Make sea_to_user skip cleanly Like Xu
2026-08-18 11:29 ` [PATCH v2 1/3] KVM: selftests: arm64: Fix EINJ handling in sea_to_user Like Xu
2026-08-18 11:29 ` [PATCH v2 2/3] KVM: selftests: arm64: Skip sea_to_user without 1GB hugepages Like Xu
2026-08-18 11:36   ` sashiko-bot
2026-08-18 12:49     ` Like Xu
2026-08-18 11:29 ` [PATCH v2 3/3] KVM: selftests: arm64: Skip sea_to_user when EINJ places no poison Like Xu
2026-08-18 11:41   ` sashiko-bot [this message]
2026-08-18 12:50     ` Like Xu

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=20260818114103.433F01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=like.xu.linux@gmail.com \
    --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