From: sashiko-bot@kernel.org
To: "Christian Borntraeger" <borntraeger@linux.ibm.com>
Cc: KVM <kvm@vger.kernel.org>,
linux-s390 <linux-s390@vger.kernel.org>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [PATCH 2/2] KVM: selftests: Test that KVM_RUN fails for unresolvable host faults
Date: Tue, 20 Oct 2026 14:40:24 +0000 [thread overview]
Message-ID: <sashiko-outbox-179179@kernel.org> (raw)
In-Reply-To: <20261020143308.228328-3-borntraeger@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] KVM: selftests: missing gmem_flags argument to vm_mem_add() in main()
--
commit 3a1c0f90404979b6638dbd3c2769d7b78633b104
Author: Christian Borntraeger <borntraeger@linux.ibm.com>
KVM: selftests: Test that KVM_RUN fails for unresolvable host faults
This commit adds a selftest in which a guest writes to a shmem-backed
memslot beyond the end of the file to verify that KVM_RUN fails with
-EFAULT rather than retrying an asynchronous page fault indefinitely.
> diff --git a/tools/testing/selftests/kvm/faultin_sigbus_test.c b/tools/testing/selftests/kvm/faultin_sigbus_test.c
> new file mode 100644
> index 0000000000000..b9d673260ed5a
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/faultin_sigbus_test.c
> @@ -0,0 +1,168 @@
[ ... ]
> +int main(void)
> +{
> + struct sigaction sa = { .sa_handler = sig_alarm }; /* no SA_RESTART */
> + struct userspace_mem_region *region;
> + struct kvm_vcpu *vcpu;
> + struct kvm_vm *vm;
> + struct ucall uc;
> + gpa_t gpa;
> + gva_t gva;
> + u64 npages;
> + int r;
> +
> + vm = vm_create_with_one_vcpu(&vcpu, guest_code);
> +
> + /* After slot 0 and the page that some architectures use for ucalls. */
> + region = memslot2region(vm, 0);
> + gpa = align_up(region->region.guest_phys_addr +
> + region->region.memory_size + vm->page_size, TEST_SIZE);
> + npages = TEST_SIZE / vm->page_size;
> +
> + vm_mem_add(vm, VM_MEM_SRC_SHMEM, gpa, TEST_SLOT, npages, 0, -1, 0);
[Severity: Medium]
Does this fail to build when compiling KVM selftests?
In tools/testing/selftests/kvm/include/kvm_util.h (and
tools/testing/selftests/kvm/lib/kvm_util.c), vm_mem_add() takes 9
arguments following commit ee455183c92be7:
void vm_mem_add(struct kvm_vm *vm, enum vm_mem_backing_src_type src_type,
gpa_t gpa, u32 slot, u64 npages, u32 flags,
int gmem_fd, u64 gmem_offset, u64 gmem_flags);
Calling vm_mem_add() in main() with only 8 arguments omits the final
gmem_flags parameter and fails compilation with too few arguments to
function vm_mem_add. Should this pass the 9th argument (0), or use the
6-argument helper vm_userspace_mem_region_add(vm, VM_MEM_SRC_SHMEM, gpa,
TEST_SLOT, npages, 0) instead?
> + region = memslot2region(vm, TEST_SLOT);
> + /* Only the first host page is backed, everything behind it is SIGBUS. */
> + TEST_ASSERT(!ftruncate(region->fd, getpagesize()), "ftruncate() failed");
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261020143308.228328-1-borntraeger@linux.ibm.com?part=2
next prev parent reply other threads:[~2026-10-20 14:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 14:33 [PATCH 0/2] Fix error handling for async_pf Christian Borntraeger
2026-10-20 14:33 ` [PATCH 1/2] KVM: Set up async page faults only for faults that need to wait Christian Borntraeger
2026-10-20 14:38 ` sashiko-bot
2026-10-20 15:44 ` Sean Christopherson
2026-10-20 14:33 ` [PATCH 2/2] KVM: selftests: Test that KVM_RUN fails for unresolvable host faults Christian Borntraeger
2026-10-20 14:40 ` sashiko-bot [this message]
2026-10-20 14:45 ` Christian Borntraeger
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=sashiko-outbox-179179@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.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