lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210317074552.8550-1-eesposit@redhat.com>
Date:   Wed, 17 Mar 2021 08:45:52 +0100
From:   Emanuele Giuseppe Esposito <eesposit@...hat.com>
To:     linux-kselftest@...r.kernel.org
Cc:     Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Andrew Jones <drjones@...hat.com>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: [PATCH] selftests/kvm: add test for KVM_GET_MSR_FEATURE_INDEX_LIST

Extend the kvm_get_feature_msr function to cover also
KVM_GET_MSR_FEATURE_INDEX_LIST.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@...hat.com>
---
 tools/testing/selftests/kvm/lib/x86_64/processor.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index a8906e60a108..3eaa6b0172a9 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -688,13 +688,20 @@ uint64_t kvm_get_feature_msr(uint64_t msr_index)
 		struct kvm_msr_entry entry;
 	} buffer = {};
 	int r, kvm_fd;
+	struct kvm_msr_list features_list;
 
 	buffer.header.nmsrs = 1;
 	buffer.entry.index = msr_index;
+	features_list.nmsrs = 1;
+
 	kvm_fd = open(KVM_DEV_PATH, O_RDONLY);
 	if (kvm_fd < 0)
 		exit(KSFT_SKIP);
 
+	r = ioctl(kvm_fd, KVM_GET_MSR_FEATURE_INDEX_LIST, &features_list);
+	TEST_ASSERT(r < 0 && r != -E2BIG, "KVM_GET_MSR_FEATURE_INDEX_LIST IOCTL failed,\n"
+		"  rc: %i errno: %i", r, errno);
+
 	r = ioctl(kvm_fd, KVM_GET_MSRS, &buffer.header);
 	TEST_ASSERT(r == 1, "KVM_GET_MSRS IOCTL failed,\n"
 		"  rc: %i errno: %i", r, errno);
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ