<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/kvm/kvm_binary_stats_test.c, branch v6.6.132</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.132</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.132'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-07-29T15:05:30+00:00</updated>
<entry>
<title>KVM: selftests: Verify stats fd is usable after VM fd has been closed</title>
<updated>2023-07-29T15:05:30+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-11T23:01:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=211c0189ea18648a0cf23dea9f4ed745bc9252f6'/>
<id>urn:sha1:211c0189ea18648a0cf23dea9f4ed745bc9252f6</id>
<content type='text'>
Verify that VM and vCPU binary stats files are usable even after userspace
has put its last direct reference to the VM.  This is a regression test
for a UAF bug where KVM didn't gift the stats files a reference to the VM.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230711230131.648752-8-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Verify stats fd can be dup()'d and read</title>
<updated>2023-07-29T15:05:30+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-11T23:01:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=65f1f57f35e5e833c879a7afb9c862c603695917'/>
<id>urn:sha1:65f1f57f35e5e833c879a7afb9c862c603695917</id>
<content type='text'>
Expand the binary stats test to verify that a stats fd can be dup()'d
and read, to (very) roughly simulate userspace passing around the file.
Adding the dup() test is primarily an intermediate step towards verifying
that userspace can read VM/vCPU stats before _and_ after userspace closes
its copy of the VM fd; the dup() test itself is only mildly interesting.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230711230131.648752-7-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Verify userspace can create "redundant" binary stats files</title>
<updated>2023-07-29T15:05:30+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-11T23:01:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=47d1be8a78fb587fe5a8f0873244476700171403'/>
<id>urn:sha1:47d1be8a78fb587fe5a8f0873244476700171403</id>
<content type='text'>
Verify that KVM doesn't artificially limit KVM_GET_STATS_FD to a single
file per VM/vCPU.  There's no known use case for getting multiple stats
fds, but it should work, and more importantly creating multiple files will
make it easier to test that KVM correct manages VM refcounts for stats
files.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230711230131.648752-6-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Explicitly free vcpus array in binary stats test</title>
<updated>2023-07-29T15:05:29+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-11T23:01:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=33b02704071b0972a62ec32516847f91cab6cb8f'/>
<id>urn:sha1:33b02704071b0972a62ec32516847f91cab6cb8f</id>
<content type='text'>
Explicitly free the all-encompassing vcpus array in the binary stats test
so that the test is consistent with respect to freeing all dynamically
allocated resources (versus letting them be freed on exit).

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230711230131.648752-5-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Clean up stats fd in common stats_test() helper</title>
<updated>2023-07-29T15:05:29+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-11T23:01:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=87d53582bc8be30a11654a45fac0a257ed830ea8'/>
<id>urn:sha1:87d53582bc8be30a11654a45fac0a257ed830ea8</id>
<content type='text'>
Move the stats fd cleanup code into stats_test() and drop the
superfluous vm_stats_test() and vcpu_stats_test() helpers in order to
decouple creation of the stats file from consuming/testing the file
(deduping code is a bonus).  This will make it easier to test various
edge cases related to stats, e.g. that userspace can dup() a stats fd,
that userspace can have multiple stats files for a singleVM/vCPU, etc.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230711230131.648752-4-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Use pread() to read binary stats header</title>
<updated>2023-07-29T15:05:28+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-11T23:01:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=625646aede90554fed8d46fd0e081238e071ac5e'/>
<id>urn:sha1:625646aede90554fed8d46fd0e081238e071ac5e</id>
<content type='text'>
Use pread() with an explicit offset when reading the header and the header
name for a binary stats fd so that the common helper and the binary stats
test don't subtly rely on the file effectively being untouched, e.g. to
allow multiple reads of the header, name, etc.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230711230131.648752-3-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Stop assuming stats are contiguous in kvm_binary_stats_test</title>
<updated>2023-01-24T18:06:34+00:00</updated>
<author>
<name>Jing Zhang</name>
<email>jingzhangos@google.com</email>
</author>
<published>2023-01-17T22:27:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=78332517a5dab54514ae719805eec218715de1fc'/>
<id>urn:sha1:78332517a5dab54514ae719805eec218715de1fc</id>
<content type='text'>
Remove the assumption from kvm_binary_stats_test that all stats are
laid out contiguously in memory. The current stats in KVM are
contiguously laid out in memory, but that may change in the future and
the ABI specifically allows holes in the stats data (since each stat
exposes its own offset).

While here drop the check that each stats' offset is less than
size_data, as that is now always true by construction.

Link: https://lore.kernel.org/kvm/20221208193857.4090582-9-dmatlack@google.com/
Fixes: 0b45d58738cd ("KVM: selftests: Add selftest for KVM statistics data binary interface")
Signed-off-by: Jing Zhang &lt;jingzhangos@google.com&gt;
[dmatlack: Re-worded the commit message.]
Signed-off-by: David Matlack &lt;dmatlack@google.com&gt;
Link: https://lore.kernel.org/r/20230117222707.3949974-1-dmatlack@google.com
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Use TAP interface in the kvm_binary_stats_test</title>
<updated>2022-12-29T20:33:14+00:00</updated>
<author>
<name>Thomas Huth</name>
<email>thuth@redhat.com</email>
</author>
<published>2022-10-04T09:31:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8125b6cda9b17f5a0163cca3904c430f4f03591b'/>
<id>urn:sha1:8125b6cda9b17f5a0163cca3904c430f4f03591b</id>
<content type='text'>
The kvm_binary_stats_test test currently does not have any output (unless
one of the TEST_ASSERT statement fails), so it's hard to say for a user
how far it did proceed already. Thus let's make this a little bit more
user-friendly and include some TAP output via the kselftest.h interface.

Signed-off-by: Thomas Huth &lt;thuth@redhat.com&gt;
Reviewed-by: Andrew Jones &lt;andrew.jones@linux.dev&gt;
Message-Id: &lt;20221004093131.40392-2-thuth@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: KVM: Add exponent check for boolean stats</title>
<updated>2022-08-01T12:01:23+00:00</updated>
<author>
<name>Oliver Upton</name>
<email>oupton@google.com</email>
</author>
<published>2022-07-19T14:31:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dd4d1c3bb3f1cd91a7a67ed3d73299ecb273ff92'/>
<id>urn:sha1:dd4d1c3bb3f1cd91a7a67ed3d73299ecb273ff92</id>
<content type='text'>
The only sensible exponent for a boolean stat is 0. Add a test assertion
requiring all boolean statistics to have an exponent of 0.

Signed-off-by: Oliver Upton &lt;oupton@google.com&gt;
Reviewed-by: Andrew Jones &lt;andrew.jones@linux.dev&gt;
Message-Id: &lt;20220719143134.3246798-4-oliver.upton@linux.dev&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: KVM: Provide descriptive assertions in kvm_binary_stats_test</title>
<updated>2022-08-01T12:01:22+00:00</updated>
<author>
<name>Oliver Upton</name>
<email>oupton@google.com</email>
</author>
<published>2022-07-19T14:31:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7eebae78bc9754564779927976f37d04c2c01b64'/>
<id>urn:sha1:7eebae78bc9754564779927976f37d04c2c01b64</id>
<content type='text'>
As it turns out, tests sometimes fail. When that is the case, packing
the test assertion with as much relevant information helps track down
the problem more quickly.

Sharpen up the stat descriptor assertions in kvm_binary_stats_test to
more precisely describe the reason for the test assertion and which
stat is to blame.

Signed-off-by: Oliver Upton &lt;oupton@google.com&gt;
Reviewed-by: Andrew Jones &lt;andrew.jones@linux.dev&gt;
Message-Id: &lt;20220719143134.3246798-3-oliver.upton@linux.dev&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
