* [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c
@ 2024-10-24 9:59 Patrick Roy
2024-10-24 10:19 ` Gowans, James
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Patrick Roy @ 2024-10-24 9:59 UTC (permalink / raw)
To: pbonzini, shuah, kvm, linux-kselftest, linux-kernel
Cc: Patrick Roy, chao.p.peng, ackerleytng, seanjc, graf, jgowans
The loop in test_create_guest_memfd_invalid that is supposed to test
that nothing is accepted as a valid flag to KVM_CREATE_GUEST_MEMFD was
initializing `flag` as 0 instead of BIT(0). This caused the loop to
immediately exit instead of iterating over BIT(0), BIT(1), ... .
Fixes: 8a89efd43423 ("KVM: selftests: Add basic selftest for guest_memfd()")
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
---
tools/testing/selftests/kvm/guest_memfd_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c
index ba0c8e9960358..ce687f8d248fc 100644
--- a/tools/testing/selftests/kvm/guest_memfd_test.c
+++ b/tools/testing/selftests/kvm/guest_memfd_test.c
@@ -134,7 +134,7 @@ static void test_create_guest_memfd_invalid(struct kvm_vm *vm)
size);
}
- for (flag = 0; flag; flag <<= 1) {
+ for (flag = BIT(0); flag; flag <<= 1) {
fd = __vm_create_guest_memfd(vm, page_size, flag);
TEST_ASSERT(fd == -1 && errno == EINVAL,
"guest_memfd() with flag '0x%lx' should fail with EINVAL",
--
2.47.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c
2024-10-24 9:59 [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c Patrick Roy
@ 2024-10-24 10:19 ` Gowans, James
2024-10-26 8:59 ` Muhammad Usama Anjum
2024-10-31 19:51 ` Sean Christopherson
2 siblings, 0 replies; 5+ messages in thread
From: Gowans, James @ 2024-10-24 10:19 UTC (permalink / raw)
To: kvm@vger.kernel.org, pbonzini@redhat.com, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Roy, Patrick
Cc: ackerleytng@google.com, Graf (AWS), Alexander,
chao.p.peng@linux.intel.com, seanjc@google.com
On Thu, 2024-10-24 at 10:59 +0100, Patrick Roy wrote:
> The loop in test_create_guest_memfd_invalid that is supposed to test
> that nothing is accepted as a valid flag to KVM_CREATE_GUEST_MEMFD was
> initializing `flag` as 0 instead of BIT(0). This caused the loop to
> immediately exit instead of iterating over BIT(0), BIT(1), ... .
>
> Fixes: 8a89efd43423 ("KVM: selftests: Add basic selftest for guest_memfd()")
> Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
> ---
> tools/testing/selftests/kvm/guest_memfd_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c
> index ba0c8e9960358..ce687f8d248fc 100644
> --- a/tools/testing/selftests/kvm/guest_memfd_test.c
> +++ b/tools/testing/selftests/kvm/guest_memfd_test.c
> @@ -134,7 +134,7 @@ static void test_create_guest_memfd_invalid(struct kvm_vm *vm)
> size);
> }
>
> - for (flag = 0; flag; flag <<= 1) {
> + for (flag = BIT(0); flag; flag <<= 1) {
> fd = __vm_create_guest_memfd(vm, page_size, flag);
> TEST_ASSERT(fd == -1 && errno == EINVAL,
> "guest_memfd() with flag '0x%lx' should fail with EINVAL",
Reviewed-by: James Gowans <jgowans@amazon.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c
2024-10-24 9:59 [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c Patrick Roy
2024-10-24 10:19 ` Gowans, James
@ 2024-10-26 8:59 ` Muhammad Usama Anjum
2024-10-31 19:51 ` Sean Christopherson
2 siblings, 0 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-10-26 8:59 UTC (permalink / raw)
To: Patrick Roy, pbonzini, shuah, kvm, linux-kselftest, linux-kernel
Cc: Usama.Anjum, chao.p.peng, ackerleytng, seanjc, graf, jgowans
On 10/24/24 2:59 PM, Patrick Roy wrote:
> The loop in test_create_guest_memfd_invalid that is supposed to test
> that nothing is accepted as a valid flag to KVM_CREATE_GUEST_MEMFD was
> initializing `flag` as 0 instead of BIT(0). This caused the loop to
> immediately exit instead of iterating over BIT(0), BIT(1), ... .
>
> Fixes: 8a89efd43423 ("KVM: selftests: Add basic selftest for guest_memfd()")
> Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
> ---
> tools/testing/selftests/kvm/guest_memfd_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c
> index ba0c8e9960358..ce687f8d248fc 100644
> --- a/tools/testing/selftests/kvm/guest_memfd_test.c
> +++ b/tools/testing/selftests/kvm/guest_memfd_test.c
> @@ -134,7 +134,7 @@ static void test_create_guest_memfd_invalid(struct kvm_vm *vm)
> size);
> }
>
> - for (flag = 0; flag; flag <<= 1) {
> + for (flag = BIT(0); flag; flag <<= 1) {
> fd = __vm_create_guest_memfd(vm, page_size, flag);
> TEST_ASSERT(fd == -1 && errno == EINVAL,
> "guest_memfd() with flag '0x%lx' should fail with EINVAL",
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c
2024-10-24 9:59 [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c Patrick Roy
2024-10-24 10:19 ` Gowans, James
2024-10-26 8:59 ` Muhammad Usama Anjum
@ 2024-10-31 19:51 ` Sean Christopherson
2024-11-05 5:53 ` Sean Christopherson
2 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2024-10-31 19:51 UTC (permalink / raw)
To: Sean Christopherson, pbonzini, shuah, kvm, linux-kselftest,
linux-kernel, Patrick Roy
Cc: chao.p.peng, ackerleytng, graf, jgowans
On Thu, 24 Oct 2024 10:59:53 +0100, Patrick Roy wrote:
> The loop in test_create_guest_memfd_invalid that is supposed to test
> that nothing is accepted as a valid flag to KVM_CREATE_GUEST_MEMFD was
> initializing `flag` as 0 instead of BIT(0). This caused the loop to
> immediately exit instead of iterating over BIT(0), BIT(1), ... .
Applied to kvm-x86 fixes, thanks!
[1/1] kvm: selftest: fix noop test in guest_memfd_test.c
https://github.com/kvm-x86/linux/commit/fd5b88cc7fbf
--
https://github.com/kvm-x86/linux/tree/next
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c
2024-10-31 19:51 ` Sean Christopherson
@ 2024-11-05 5:53 ` Sean Christopherson
0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2024-11-05 5:53 UTC (permalink / raw)
To: pbonzini, shuah, kvm, linux-kselftest, linux-kernel, Patrick Roy
Cc: chao.p.peng, ackerleytng, graf, jgowans
On Thu, Oct 31, 2024, Sean Christopherson wrote:
> On Thu, 24 Oct 2024 10:59:53 +0100, Patrick Roy wrote:
> > The loop in test_create_guest_memfd_invalid that is supposed to test
> > that nothing is accepted as a valid flag to KVM_CREATE_GUEST_MEMFD was
> > initializing `flag` as 0 instead of BIT(0). This caused the loop to
> > immediately exit instead of iterating over BIT(0), BIT(1), ... .
>
> Applied to kvm-x86 fixes, thanks!
>
> [1/1] kvm: selftest: fix noop test in guest_memfd_test.c
> https://github.com/kvm-x86/linux/commit/fd5b88cc7fbf
FYI, I rebased "fixes" onto 6.12-rc5 to avoid several pointless conflicts in
other patches. New hash:
[1/1] KVM: selftests: fix unintentional noop test in guest_memfd_test.c
https://github.com/kvm-x86/linux/commit/945bdae20be5
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-05 5:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-24 9:59 [PATCH] kvm: selftest: fix noop test in guest_memfd_test.c Patrick Roy
2024-10-24 10:19 ` Gowans, James
2024-10-26 8:59 ` Muhammad Usama Anjum
2024-10-31 19:51 ` Sean Christopherson
2024-11-05 5:53 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox