All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jack Thomson" <jackabt.amazon@gmail.com>
Cc: kvm@vger.kernel.org, "Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>,
	kvmarm@lists.linux.dev
Subject: Re: [PATCH v5 5/5] KVM: selftests: Add nested pre-fault test for arm64
Date: Fri, 12 Jun 2026 16:35:49 +0000	[thread overview]
Message-ID: <20260612163550.28AB91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260612162354.73378-6-jackabt.amazon@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `KVM_PRE_FAULT_MEMORY` ioctl loop in `pre_fault()` fails to handle partial success, causing spurious test failures if the ioctl yields or is interrupted.
--

commit ee1e827d8efbd103bf9ab1322ee50ba8c3895869
Author: Jack Thomson <jackabt@amazon.com>

KVM: selftests: Add nested pre-fault test for arm64

This commit adds an arm64 nested-virt selftest for KVM_PRE_FAULT_MEMORY to
verify that prefaulting correctly targets the canonical stage-2 when the
guest's last-run context has a nested/shadow stage-2 MMU.

> diff --git a/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c b/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c
> new file mode 100644
> index 0000000000000..2bbd5540599c0
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c

[ ... ]

> +static void pre_fault(struct kvm_vcpu *vcpu, u64 gpa, u64 size)
> +{
> +	struct kvm_pre_fault_memory range = {
> +		.gpa = gpa,
> +		.size = size,
> +	};
> +	int ret;
> +
> +	do {
> +		ret = __vcpu_ioctl(vcpu, KVM_PRE_FAULT_MEMORY, &range);
> +	} while (ret < 0 && errno == EINTR);

[Severity: Medium]
Does this loop handle partial successes correctly? If the ioctl is interrupted
by a signal or yields after successfully mapping at least one page, it returns
0 and updates range.size with the remaining bytes to process.

If that happens, this loop will exit immediately and the test will spuriously
fail the TEST_ASSERT_EQ(range.size, 0) assertion below. Should this loop
continue as long as ret == 0 and range.size > 0?

> +
> +	TEST_ASSERT(!ret, "KVM_PRE_FAULT_MEMORY failed, ret: %d errno: %d",
> +		    ret, errno);
> +	TEST_ASSERT_EQ(range.size, 0);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260612162354.73378-1-jackabt.amazon@gmail.com?part=5

      reply	other threads:[~2026-06-12 16:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 16:23 [PATCH v5 0/5] KVM: arm64: Add KVM_PRE_FAULT_MEMORY support Jack Thomson
2026-06-12 16:23 ` [PATCH v5 1/5] KVM: arm64: Pass walk flags to kvm_pgtable_get_leaf() Jack Thomson
2026-06-12 16:23 ` [PATCH v5 2/5] KVM: arm64: Add pre_fault_memory implementation Jack Thomson
2026-07-08 15:25   ` Alexandru Elisei
2026-07-10 16:00     ` Alexandru Elisei
2026-07-10 16:03   ` Alexandru Elisei
2026-06-12 16:23 ` [PATCH v5 3/5] KVM: selftests: Enable pre_fault_memory_test for arm64 Jack Thomson
2026-06-12 16:23 ` [PATCH v5 4/5] KVM: selftests: Add option for different backing in pre-fault tests Jack Thomson
2026-06-12 16:23 ` [PATCH v5 5/5] KVM: selftests: Add nested pre-fault test for arm64 Jack Thomson
2026-06-12 16:35   ` sashiko-bot [this message]

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=20260612163550.28AB91F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jackabt.amazon@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.