<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/kvm, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-03-29T10:52:08+00:00</updated>
<entry>
<title>tools/kvm_stat: use canonical ftrace path</title>
<updated>2023-03-29T10:52:08+00:00</updated>
<author>
<name>Ross Zwisler</name>
<email>zwisler@google.com</email>
</author>
<published>2023-03-13T21:17:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c2f92e8b2d24615acda3fc571180d8b44a710df5'/>
<id>urn:sha1:c2f92e8b2d24615acda3fc571180d8b44a710df5</id>
<content type='text'>
The canonical location for the tracefs filesystem is at /sys/kernel/tracing.

But, from Documentation/trace/ftrace.rst:

  Before 4.1, all ftrace tracing control files were within the debugfs
  file system, which is typically located at /sys/kernel/debug/tracing.
  For backward compatibility, when mounting the debugfs file system,
  the tracefs file system will be automatically mounted at:

  /sys/kernel/debug/tracing

A comment in kvm_stat still refers to this older debugfs path, so let's
update it to avoid confusion.

Link: https://lkml.kernel.org/r/20230313211746.1541525-3-zwisler@kernel.org

Cc: "Tobin C. Harding" &lt;me@tobin.cc&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Tycho Andersen &lt;tycho@tycho.pizza&gt;
Acked-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Reviewed-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Reviewed-by: Mukesh Ojha &lt;quic_mojha@quicinc.com&gt;
Signed-off-by: Ross Zwisler &lt;zwisler@google.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace</title>
<updated>2022-11-09T17:26:52+00:00</updated>
<author>
<name>Rong Tao</name>
<email>rongtao@cestc.cn</email>
</author>
<published>2022-11-07T14:52:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c1b54348a63096d4d4677743fba7a6d5fda9476'/>
<id>urn:sha1:2c1b54348a63096d4d4677743fba7a6d5fda9476</id>
<content type='text'>
Update EXIT_REASONS from source, including VMX_EXIT_REASONS,
SVM_EXIT_REASONS, AARCH64_EXIT_REASONS, USERSPACE_EXIT_REASONS.

Signed-off-by: Rong Tao &lt;rongtao@cestc.cn&gt;
Message-Id: &lt;tencent_00082C8BFA925A65E11570F417F1CD404505@qq.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: fix incorrect detection of debugfs</title>
<updated>2022-11-09T17:26:52+00:00</updated>
<author>
<name>Matthias Gerstner</name>
<email>matthias.gerstner@suse.de</email>
</author>
<published>2022-11-03T13:59:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8e1071d0ad300fcce2e2b4e46cb15e41d0166bdc'/>
<id>urn:sha1:8e1071d0ad300fcce2e2b4e46cb15e41d0166bdc</id>
<content type='text'>
The first field in /proc/mounts can be influenced by unprivileged users
through the widespread `fusermount` setuid-root program. Example:

```
user$ mkdir ~/mydebugfs
user$ export _FUSE_COMMFD=0
user$ fusermount ~/mydebugfs -ononempty,fsname=debugfs
user$ grep debugfs /proc/mounts
debugfs /home/user/mydebugfs fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=100 0 0
```

If there is no debugfs already mounted in the system then this can be
used by unprivileged users to trick kvm_stat into using a user
controlled file system location for obtaining KVM statistics.
Even though the root user is not allowed to access non-root FUSE mounts
for security reasons, the unprivileged user can unmount the FUSE mount
before kvm_stat uses the mounted path.  If it wins the race, kvm_stat
will read from the location where the FUSE mount resided.

Note that the files in debugfs are only opened for reading, so the
attacker can cause very large data to be read in by kvm_stat, or fake
data to be processed, but there should be no viable way to turn this
into a privilege escalation.

The fix is simply to use the file system type field instead. Whitespace
in the mount path is escaped in /proc/mounts thus no further safety
measures in the parsing should be necessary to make this correct.

Message-Id: &lt;20221103135927.13656-1-matthias.gerstner@suse.de&gt;
Signed-off-by: Matthias Gerstner &lt;matthias.gerstner@suse.de&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: fix display of error when multiple processes are found</title>
<updated>2022-06-15T12:14:20+00:00</updated>
<author>
<name>Dmitry Klochkov</name>
<email>kdmitry556@gmail.com</email>
</author>
<published>2022-06-14T12:11:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=933b5f9f98da29af646b51b36a0753692908ef64'/>
<id>urn:sha1:933b5f9f98da29af646b51b36a0753692908ef64</id>
<content type='text'>
Instead of printing an error message, kvm_stat script fails when we
restrict statistics to a guest by its name and there are multiple guests
with such name:

  # kvm_stat -g my_vm
  Traceback (most recent call last):
    File "/usr/bin/kvm_stat", line 1819, in &lt;module&gt;
      main()
    File "/usr/bin/kvm_stat", line 1779, in main
      options = get_options()
    File "/usr/bin/kvm_stat", line 1718, in get_options
      options = argparser.parse_args()
    File "/usr/lib64/python3.10/argparse.py", line 1825, in parse_args
      args, argv = self.parse_known_args(args, namespace)
    File "/usr/lib64/python3.10/argparse.py", line 1858, in parse_known_args
      namespace, args = self._parse_known_args(args, namespace)
    File "/usr/lib64/python3.10/argparse.py", line 2067, in _parse_known_args
      start_index = consume_optional(start_index)
    File "/usr/lib64/python3.10/argparse.py", line 2007, in consume_optional
      take_action(action, args, option_string)
    File "/usr/lib64/python3.10/argparse.py", line 1935, in take_action
      action(self, namespace, argument_values, option_string)
    File "/usr/bin/kvm_stat", line 1649, in __call__
      ' to specify the desired pid'.format(" ".join(pids)))
  TypeError: sequence item 0: expected str instance, int found

To avoid this, it's needed to convert pids int values to strings before
pass them to join().

Signed-off-by: Dmitry Klochkov &lt;kdmitry556@gmail.com&gt;
Message-Id: &lt;20220614121141.160689-1-kdmitry556@gmail.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: kvm_stat: do not show halt_wait_ns</title>
<updated>2021-10-18T18:07:18+00:00</updated>
<author>
<name>Christian Borntraeger</name>
<email>borntraeger@de.ibm.com</email>
</author>
<published>2021-10-06T12:17:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=01c7d2672a84dbdfa8050d073c3ea466437578fd'/>
<id>urn:sha1:01c7d2672a84dbdfa8050d073c3ea466437578fd</id>
<content type='text'>
Similar to commit 111d0bda8eeb ("tools/kvm_stat: Exempt time-based
counters"), we should not show timer values in kvm_stat. Remove the new
halt_wait_ns.

Fixes: 87bcc5fa092f ("KVM: stats: Add halt_wait_ns stats for all architectures")
Cc: Jing Zhang &lt;jingzhangos@google.com&gt;
Cc: Stefan Raspl &lt;raspl@de.ibm.com&gt;
Signed-off-by: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Reviewed-by: Stefan Raspl &lt;raspl@linux.ibm.com&gt;
Message-Id: &lt;20211006121724.4154-1-borntraeger@de.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: Fix documentation typo</title>
<updated>2021-05-07T10:06:22+00:00</updated>
<author>
<name>Stefan Raspl</name>
<email>raspl@linux.ibm.com</email>
</author>
<published>2021-05-06T14:03:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b26990987ffce0525abbd84b36595869cfdbbfe6'/>
<id>urn:sha1:b26990987ffce0525abbd84b36595869cfdbbfe6</id>
<content type='text'>
Makes the dash in front of option '-z' disappear in the generated
man-page.

Signed-off-by: Stefan Raspl &lt;raspl@linux.ibm.com&gt;
Message-Id: &lt;20210506140352.4178789-1-raspl@linux.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: Add restart delay</title>
<updated>2021-03-30T17:07:09+00:00</updated>
<author>
<name>Stefan Raspl</name>
<email>raspl@linux.ibm.com</email>
</author>
<published>2021-03-25T12:29:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=75f94ecbd0dfd2ac4e671f165f5ae864b7301422'/>
<id>urn:sha1:75f94ecbd0dfd2ac4e671f165f5ae864b7301422</id>
<content type='text'>
If this service is enabled and the system rebooted, Systemd's initial
attempt to start this unit file may fail in case the kvm module is not
loaded. Since we did not specify a delay for the retries, Systemd
restarts with a minimum delay a number of times before giving up and
disabling the service. Which means a subsequent kvm module load will
have kvm running without monitoring.
Adding a delay to fix this.

Signed-off-by: Stefan Raspl &lt;raspl@linux.ibm.com&gt;
Message-Id: &lt;20210325122949.1433271-1-raspl@linux.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: Exempt time-based counters</title>
<updated>2020-12-12T00:18:51+00:00</updated>
<author>
<name>Stefan Raspl</name>
<email>raspl@de.ibm.com</email>
</author>
<published>2020-12-08T21:08:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=111d0bda8eeb4b54e0c63897b071effbf9fd9251'/>
<id>urn:sha1:111d0bda8eeb4b54e0c63897b071effbf9fd9251</id>
<content type='text'>
The new counters halt_poll_success_ns and halt_poll_fail_ns do not count
events. Instead they provide a time, and mess up our statistics. Therefore,
we should exclude them.
Removal is currently implemented with an exempt list. If more counters like
these appear, we can think about a more general rule like excluding all
fields name "*_ns", in case that's a standing convention.

Signed-off-by: Stefan Raspl &lt;raspl@linux.ibm.com&gt;
Tested-and-reported-by: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Message-Id: &lt;20201208210829.101324-1-raspl@linux.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: add sample systemd unit file</title>
<updated>2020-04-21T13:13:12+00:00</updated>
<author>
<name>Stefan Raspl</name>
<email>raspl@de.ibm.com</email>
</author>
<published>2020-04-02T08:57:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=997b7e98990cd44243651827e4efa366d9885907'/>
<id>urn:sha1:997b7e98990cd44243651827e4efa366d9885907</id>
<content type='text'>
Add a sample unit file as a basis for systemd integration of kvm_stat
logs.

Signed-off-by: Stefan Raspl &lt;raspl@de.ibm.com&gt;
Message-Id: &lt;20200402085705.61155-4-raspl@linux.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>tools/kvm_stat: Add command line switch '-L' to log to file</title>
<updated>2020-04-21T13:13:12+00:00</updated>
<author>
<name>Stefan Raspl</name>
<email>raspl@de.ibm.com</email>
</author>
<published>2020-04-02T08:57:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3754afe7cf7cc3693a9c9ff795e9bd97175ca639'/>
<id>urn:sha1:3754afe7cf7cc3693a9c9ff795e9bd97175ca639</id>
<content type='text'>
To integrate with logrotate, we have a signal handler that will re-open
the logfile.
Assuming we have a systemd unit file with
     ExecStart=kvm_stat -dtc -s 10 -L /var/log/kvm_stat.csv
     ExecReload=/bin/kill -HUP $MAINPID
and a logrotate config featuring
     postrotate
        /bin/systemctl reload kvm_stat.service
     endscript
Then the overall flow will look like this:
(1) systemd starts kvm_stat, logging to A.
(2) At some point, logrotate runs, moving A to B.
    kvm_stat continues to write to B at this point.
(3) After rotating, logrotate restarts the kvm_stat unit via systemctl.
(4) The kvm_stat unit sends a SIGHUP to kvm_stat, finally making it
    switch over to writing to A again.
Note that in order to keep the structure of the cvs output in tact, we
make sure to, in contrast to the standard log format, only write the
header once at the beginning of a file. This implies that the header is
suppressed when appending to an existing file. Unlike with the standard
format, where we append to an existing file by starting out with a
header.

Signed-off-by: Stefan Raspl &lt;raspl@de.ibm.com&gt;
Message-Id: &lt;20200402085705.61155-3-raspl@linux.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
