commit kvm_stat for openSUSE:Factory

2024-02-22 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2024-02-22 21:02:09

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.1706 (New)


Package is "kvm_stat"

Thu Feb 22 21:02:09 2024 rev:23 rq:1149596 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2022-12-31 
11:23:06.852526149 +0100
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.1706/kvm_stat.changes  
2024-02-22 21:02:54.468793402 +0100
@@ -1,0 +2,5 @@
+Thu Feb 22 12:42:08 UTC 2024 - Dominique Leuenberger 
+
+- Use %patch -P N instead of deprecated %patchN.
+
+---



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.h7DylP/_old  2024-02-22 21:02:54.992812494 +0100
+++ /var/tmp/diff_new_pack.h7DylP/_new  2024-02-22 21:02:54.996812640 +0100
@@ -75,20 +75,20 @@
 
 # Patches present upstream, since 5.7
 %if "%(echo `echo -e "%{version}\\n5.7.0" | sort -V | head -n1 2> /dev/null`)" 
!= "5.7.0"
-%patch01 -p1
-%patch02 -p1
-%patch03 -p1
-%patch04 -p1
+%patch -P 01 -p1
+%patch -P 02 -p1
+%patch -P 03 -p1
+%patch -P 04 -p1
 %endif
 # Patches present upstream, since 5.8
 %if "%(echo `echo -e "%{version}\\n5.8.0" | sort -V | head -n1 2> /dev/null`)" 
!= "5.8.0"
-%patch05 -p1
-%patch06 -p1
-%patch07 -p1
-%patch08 -p1
+%patch -P 05 -p1
+%patch -P 06 -p1
+%patch -P 07 -p1
+%patch -P 08 -p1
 %endif
 %if %{pkg_vcmp kernel-source < 6.1}
-%patch09 -p1
+%patch -P 09 -p1
 %endif
 
 %build


commit kvm_stat for openSUSE:Factory

2022-12-31 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2022-12-31 11:23:05

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.1563 (New)


Package is "kvm_stat"

Sat Dec 31 11:23:05 2022 rev:22 rq:1045846 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2022-10-28 
19:32:32.899539410 +0200
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.1563/kvm_stat.changes  
2022-12-31 11:23:06.852526149 +0100
@@ -1,0 +2,6 @@
+Fri Dec 30 11:39:21 UTC 2022 - Dominique Leuenberger 
+
+- Apply tools-kvm_stat-fix-attack-vector-with-user-controlle.patch
+  only on kernel < 6.1. Starting with 6.1, the fix is included.
+
+---



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.Pdd305/_old  2022-12-31 11:23:07.968532832 +0100
+++ /var/tmp/diff_new_pack.Pdd305/_new  2022-12-31 11:23:07.972532856 +0100
@@ -87,7 +87,9 @@
 %patch07 -p1
 %patch08 -p1
 %endif
+%if %{pkg_vcmp kernel-source < 6.1}
 %patch09 -p1
+%endif
 
 %build
 make -C tools/kvm/kvm_stat %{?_smp_mflags}


commit kvm_stat for openSUSE:Factory

2022-10-28 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2022-10-28 19:32:06

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.2275 (New)


Package is "kvm_stat"

Fri Oct 28 19:32:06 2022 rev:21 rq:1031978 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2022-09-02 
21:57:17.668405608 +0200
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.2275/kvm_stat.changes  
2022-10-28 19:32:32.899539410 +0200
@@ -1,0 +2,7 @@
+Fri Oct 28 14:24:29 UTC 2022 - Dario Faggioli 
+
+- Fix security issue about debugfs described in bsc#1202924
+  * Added patches:
+tools-kvm_stat-fix-attack-vector-with-user-controlle.patch
+
+---

New:

  tools-kvm_stat-fix-attack-vector-with-user-controlle.patch



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.kZRNBJ/_old  2022-10-28 19:32:33.399541917 +0200
+++ /var/tmp/diff_new_pack.kZRNBJ/_new  2022-10-28 19:32:33.403541937 +0200
@@ -47,6 +47,8 @@
 Patch06:add-command-line-switch-L-to-log-file.patch
 Patch07:add-sample-systemd-unit.patch
 Patch08:add-restart-delay.patch
+# PAtch 09 is for bsc#1202924
+Patch09:tools-kvm_stat-fix-attack-vector-with-user-controlle.patch
 
 %define XXX This package provides a userspace tool "kvm_stat", which displays 
KVM vm exit \
 information as a means of monitoring vm behavior. The data is taken from the\
@@ -85,6 +87,7 @@
 %patch07 -p1
 %patch08 -p1
 %endif
+%patch09 -p1
 
 %build
 make -C tools/kvm/kvm_stat %{?_smp_mflags}

++ tools-kvm_stat-fix-attack-vector-with-user-controlle.patch ++
>From 210cdcac0d41a340475400b852fb1cb43182c349 Mon Sep 17 00:00:00 2001
From: Matthias Gerstner 
Date: Thu, 1 Sep 2022 15:34:00 +0200
Subject: [PATCH] tools/kvm_stat: fix attack vector with user controlled FUSE
 mounts

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.

To exploit this also a race condition has to be won, since the code
checks for the existence of the 'kvm' subdirectory of the resulting
path. This doesn't work on a FUSE mount, because the root user is not
allowed to access non-root FUSE mounts for security reasons. If an
attacker manages to unmount the FUSE mount in time again then kvm_stat
would be using the resulting path, though.

The impact if winning the race condition is mostly a denial-of-service
or damaged information integrity. 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 by kvm_stat. I don't see any
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.
---
 tools/kvm/kvm_stat/kvm_stat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 9c366b3a676d..88a73999aa58 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1756,7 +1756,7 @@ def assign_globals():
 
 debugfs = ''
 for line in open('/proc/mounts'):
-if line.split(' ')[0] == 'debugfs':
+if line.split(' ')[2] == 'debugfs':
 debugfs = line.split(' ')[1]
 break
 if debugfs == '':
-- 
2.35.1


commit kvm_stat for openSUSE:Factory

2022-09-02 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2022-09-02 21:56:54

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.2083 (New)


Package is "kvm_stat"

Fri Sep  2 21:56:54 2022 rev:20 rq:1000889 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2022-06-21 
16:33:18.123889490 +0200
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.2083/kvm_stat.changes  
2022-09-02 21:57:17.668405608 +0200
@@ -1,0 +2,6 @@
+Wed Aug 31 13:38:21 UTC 2022 - Stefan Schubert 
+
+- Migration to /usr/etc: Saving user changed configuration files
+  in /etc and restoring them while an RPM update.
+
+---



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.G945i0/_old  2022-09-02 21:57:18.104406664 +0200
+++ /var/tmp/diff_new_pack.G945i0/_new  2022-09-02 21:57:18.108406673 +0200
@@ -105,6 +105,20 @@
 
 %pre
 %service_add_pre kvm_stat.service
+%if 0%{?suse_version} > 1500
+# Prepare for migration to /usr/etc; save any old .rpmsave
+for i in logrotate.d/kvm_stat ; do
+   test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave 
%{_sysconfdir}/${i}.rpmsave.old ||:
+done
+%endif
+
+%if 0%{?suse_version} > 1500
+%posttrans
+# Migration to /usr/etc, restore just created .rpmsave
+for i in logrotate.d/kvm_stat ; do
+   test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave 
%{_sysconfdir}/${i} ||:
+done
+%endif
 
 %post
 %service_add_post kvm_stat.service


commit kvm_stat for openSUSE:Factory

2022-06-21 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2022-06-21 16:33:09

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.1548 (New)


Package is "kvm_stat"

Tue Jun 21 16:33:09 2022 rev:19 rq:984176 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2021-07-24 
20:39:19.284403872 +0200
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.1548/kvm_stat.changes  
2022-06-21 16:33:18.123889490 +0200
@@ -1,0 +2,6 @@
+Tue Jun 21 12:31:22 UTC 2022 - Stefan Schubert 
+
+- Moved logrotate files from user specific directory /etc/logrotate.d
+  to vendor specific directory /usr/etc/logrotate.d.
+
+---



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.yiqCSR/_old  2022-06-21 16:33:18.651890265 +0200
+++ /var/tmp/diff_new_pack.yiqCSR/_new  2022-06-21 16:33:18.655890271 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package kvm_stat
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -93,7 +93,12 @@
 # OBS checks don't like /usr/bin/env in script interpreter lines
 sed -re '1 { s_^#! */usr/bin/env +/_#!/_ ; s_^#! */usr/bin/env 
+([^/])_#!/usr/bin/\1_ }' -i "tools/kvm/kvm_stat/kvm_stat"
 make -C tools kvm_stat_install INSTALL_ROOT=%{buildroot}
+%if 0%{?suse_version} > 1500
+mkdir -p %{buildroot}%{_distconfdir}/logrotate.d
+install -D -m 644 %{SOURCE1} %{buildroot}%{_distconfdir}/logrotate.d/kvm_stat
+%else
 install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/kvm_stat
+%endif
 install -D -m 644 tools/kvm/kvm_stat/kvm_stat.service 
%{buildroot}%{_unitdir}/kvm_stat.service
 install -d %{buildroot}%{_sbindir}
 ln -sf service %{buildroot}%{_sbindir}/rckvm_stat
@@ -114,7 +119,11 @@
 %defattr(-, root, root)
 %license COPYING
 %{_unitdir}/kvm_stat.service
+%if 0%{?suse_version} > 1500
+%{_distconfdir}/logrotate.d/kvm_stat
+%else
 %config(noreplace) %{_sysconfdir}/logrotate.d/kvm_stat
+%endif
 %{_sbindir}/rckvm_stat
 %{_bindir}/kvm_stat
 %{_mandir}/man1/kvm_stat*


commit kvm_stat for openSUSE:Factory

2021-07-24 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2021-07-24 20:39:08

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.1899 (New)


Package is "kvm_stat"

Sat Jul 24 20:39:08 2021 rev:18 rq:908083 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2021-01-30 
13:57:48.726401580 +0100
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.1899/kvm_stat.changes  
2021-07-24 20:39:19.284403872 +0200
@@ -1,0 +2,10 @@
+Wed Jul  7 09:27:37 UTC 2021 - Al Cho 
+
+- If the kvm service is enabled and the system rebooted,
+  Systemd's initial attempt to start the kvm unit file may
+  fail in case the kvm module is not loaded.
+  Add an appropriate delay in the unit file. (bsc#1185945)
+  * Add patches:
+* add-restart-delay.patch 
+
+---

New:

  add-restart-delay.patch



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.fgLnWr/_old  2021-07-24 20:39:19.672403422 +0200
+++ /var/tmp/diff_new_pack.fgLnWr/_new  2021-07-24 20:39:19.672403422 +0200
@@ -46,6 +46,7 @@
 Patch05:add-command-line-switch-z-skip-zero-records.patch
 Patch06:add-command-line-switch-L-to-log-file.patch
 Patch07:add-sample-systemd-unit.patch
+Patch08:add-restart-delay.patch
 
 %define XXX This package provides a userspace tool "kvm_stat", which displays 
KVM vm exit \
 information as a means of monitoring vm behavior. The data is taken from the\
@@ -82,6 +83,7 @@
 %patch05 -p1
 %patch06 -p1
 %patch07 -p1
+%patch08 -p1
 %endif
 
 %build

++ add-restart-delay.patch ++
From: Stefan Raspl 
Date: Thu, 25 Mar 2021 13:29:49 +0100
Subject: [PATCH] tools/kvm_stat: Add restart delay
Patch-mainline: v5.12-rc6
Git-commit: 75f94ecbd0dfd2ac4e671f165f5ae864b7301422
References: bsc#1185945

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 
Message-Id: <20210325122949.1433271-1-ra...@linux.ibm.com>
Signed-off-by: Paolo Bonzini 
Acked-by: Cho, Yu-Chen 
---
 tools/kvm/kvm_stat/kvm_stat.service | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/kvm/kvm_stat/kvm_stat.service 
b/tools/kvm/kvm_stat/kvm_stat.service
index 71aabaffe779..8f13b843d5b4 100644
--- a/tools/kvm/kvm_stat/kvm_stat.service
+++ b/tools/kvm/kvm_stat/kvm_stat.service
@@ -9,6 +9,7 @@ Type=simple
 ExecStart=/usr/bin/kvm_stat -dtcz -s 10 -L /var/log/kvm_stat.csv
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=always
+RestartSec=60s
 SyslogIdentifier=kvm_stat
 SyslogLevel=debug
 
-- 
2.31.1


commit kvm_stat for openSUSE:Factory

2021-01-30 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2021-01-30 13:56:44

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.28504 (New)


Package is "kvm_stat"

Sat Jan 30 13:56:44 2021 rev:17 rq:867817 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2021-01-28 
21:22:31.243649080 +0100
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.28504/kvm_stat.changes 
2021-01-30 13:57:48.726401580 +0100
@@ -1,0 +2,6 @@
+Thu Jan 28 14:59:15 UTC 2021 - Dominique Leuenberger 
+
+- Add a dummy -rebuild package: give OBS/Tumbleweed a hint to tell
+  when this package needs a rebuild (boo#1178493).
+
+---



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.0Ri8mc/_old  2021-01-30 13:57:49.454402808 +0100
+++ /var/tmp/diff_new_pack.0Ri8mc/_new  2021-01-30 13:57:49.458402814 +0100
@@ -55,6 +55,17 @@
 %description
 %{XXX}
 
+%package rebuild
+Summary:Empty package to ensure rebuilding kvm_stat in OBS
+Group:  System/Monitoring
+%requires_eq kernel-source
+
+%description rebuild
+This is empty package that ensures kvm_stat is rebuilt every time
+kernel-default is rebuilt in OBS.
+
+There is no reason to install this package.
+
 %prep
 # copy necessary files from kernel-source
 (tar -C /usr/src/linux -c COPYING tools scripts) | tar -x
@@ -106,4 +117,7 @@
 %{_bindir}/kvm_stat
 %{_mandir}/man1/kvm_stat*
 
+%files rebuild
+%license COPYING
+
 %changelog


commit kvm_stat for openSUSE:Factory

2021-01-28 Thread Source-Sync
Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2021-01-28 21:22:29

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.28504 (New)


Package is "kvm_stat"

Thu Jan 28 21:22:29 2021 rev:16 rq:867342 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2021-01-08 
17:40:39.521063842 +0100
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.28504/kvm_stat.changes 
2021-01-28 21:22:31.243649080 +0100
@@ -1,0 +2,9 @@
+Thu Jan 28 01:55:12 UTC 2021 - Dario Faggioli 
+
+- Install the systemd unit file in the proper place, so that the
+  service can be started right away, if the user wants that, without
+  having to copy the file in the units directory.
+- Integrate with logrotate, by providing a  logrotate config file, as
+  the logs can easily become very big.
+
+---

New:

  logrotate.kvm_stat



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.EZI0nm/_old  2021-01-28 21:22:31.763649904 +0100
+++ /var/tmp/diff_new_pack.EZI0nm/_new  2021-01-28 21:22:31.767649910 +0100
@@ -30,6 +30,7 @@
 BuildRequires:  libxslt-tools
 
 Requires:   python3-curses
+Recommends: logrotate
 
 Recommends: kernel >= 5.2.0
 Conflicts:  qemu < 2.6.90
@@ -37,6 +38,7 @@
 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
 # Patches 01 to 07 are for jsc#SLE-13784
+Source1:logrotate.kvm_stat
 Patch01:rework-command-line-sequence.patch
 Patch02:switch-to-argparse.patch
 Patch03:add-command-line-switch-s-to-update.patch
@@ -78,14 +80,30 @@
 # OBS checks don't like /usr/bin/env in script interpreter lines
 sed -re '1 { s_^#! */usr/bin/env +/_#!/_ ; s_^#! */usr/bin/env 
+([^/])_#!/usr/bin/\1_ }' -i "tools/kvm/kvm_stat/kvm_stat"
 make -C tools kvm_stat_install INSTALL_ROOT=%{buildroot}
-install -d -m 755 %{buildroot}/%{_datadir}/kvm_stat
-install -m 644 tools/kvm/kvm_stat/kvm_stat.service 
%{buildroot}/%{_datadir}/kvm_stat/
+install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/kvm_stat
+install -D -m 644 tools/kvm/kvm_stat/kvm_stat.service 
%{buildroot}%{_unitdir}/kvm_stat.service
+install -d %{buildroot}%{_sbindir}
+ln -sf service %{buildroot}%{_sbindir}/rckvm_stat
+
+%pre
+%service_add_pre kvm_stat.service
+
+%post
+%service_add_post kvm_stat.service
+
+%preun
+%service_del_preun kvm_stat.service
+
+%postun
+%service_del_postun kvm_stat.service
 
 %files
 %defattr(-, root, root)
 %license COPYING
+%{_unitdir}/kvm_stat.service
+%config(noreplace) %{_sysconfdir}/logrotate.d/kvm_stat
+%{_sbindir}/rckvm_stat
 %{_bindir}/kvm_stat
 %{_mandir}/man1/kvm_stat*
-%{_datadir}/kvm_stat
 
 %changelog

++ logrotate.kvm_stat ++
/var/log/kvm_stat.csv {
compress
delaycompress
dateext
maxage 365
rotate 14
daily
minsize 50M
notifempty
missingok
copytruncate
}


commit kvm_stat for openSUSE:Factory

2020-12-05 Thread User for buildservice source handling
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2020-12-05 20:36:53

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.5913 (New)


Package is "kvm_stat"

Sat Dec  5 20:36:53 2020 rev:13 rq:853172 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2020-11-15 
15:27:34.487527442 +0100
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.5913/kvm_stat.changes  
2020-12-05 20:37:46.434744792 +0100
@@ -1,0 +2,7 @@
+Fri Dec  4 17:40:20 UTC 2020 - Dario Faggioli 
+
+- Include the example service file in the package
+  * install it in /usr/share/kvm_stat
+  * this deals properly with bsc#1179469
+
+---



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.Vgsb7b/_old  2020-12-05 20:37:46.862745227 +0100
+++ /var/tmp/diff_new_pack.Vgsb7b/_new  2020-12-05 20:37:46.866745231 +0100
@@ -78,11 +78,14 @@
 
 %install
 make -C tools kvm_stat_install INSTALL_ROOT=%{buildroot}
+install -d -m 755 %{buildroot}/%{_datadir}/kvm_stat
+install -m 644 tools/kvm/kvm_stat/kvm_stat.service 
%{buildroot}/%{_datadir}/kvm_stat/
 
 %files
 %defattr(-, root, root)
 %license COPYING
 %{_bindir}/kvm_stat
 %{_mandir}/man1/kvm_stat*
+%{_datadir}/kvm_stat
 
 %changelog
___
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org


[opensuse-commit] commit kvm_stat for openSUSE:Factory

2020-11-15 Thread User for buildservice source handling
Hello community,

here is the log from the commit of package kvm_stat for openSUSE:Factory 
checked in at 2020-11-15 15:26:11

Comparing /work/SRC/openSUSE:Factory/kvm_stat (Old)
 and  /work/SRC/openSUSE:Factory/.kvm_stat.new.24930 (New)


Package is "kvm_stat"

Sun Nov 15 15:26:11 2020 rev:12 rq:848402 version:MACRO

Changes:

--- /work/SRC/openSUSE:Factory/kvm_stat/kvm_stat.changes2020-03-11 
22:04:53.901995023 +0100
+++ /work/SRC/openSUSE:Factory/.kvm_stat.new.24930/kvm_stat.changes 
2020-11-15 15:27:34.487527442 +0100
@@ -1,0 +2,14 @@
+Fri Nov 13 17:45:02 UTC 2020 - Dario Faggioli 
+
+- Implement jsc#SLE-13784
+  * Add patches:
+* rework-command-line-sequence.patch
+* switch-to-argparse.patch
+* add-command-line-switch-s-to-update.patch
+* add-command-line-switch-c-to-csv.patch
+* add-command-line-switch-z-skip-zero-records.patch
+* add-command-line-switch-L-to-log-file.patch
+* add-sample-systemd-unit.patch
+  * patching is conditional, depending on kernel version 
+
+---

New:

  add-command-line-switch-L-to-log-file.patch
  add-command-line-switch-c-to-csv.patch
  add-command-line-switch-s-to-update.patch
  add-command-line-switch-z-skip-zero-records.patch
  add-sample-systemd-unit.patch
  rework-command-line-sequence.patch
  switch-to-argparse.patch



Other differences:
--
++ kvm_stat.spec ++
--- /var/tmp/diff_new_pack.VTZNX2/_old  2020-11-15 15:27:35.139528139 +0100
+++ /var/tmp/diff_new_pack.VTZNX2/_new  2020-11-15 15:27:35.143528143 +0100
@@ -37,6 +37,14 @@
 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
 Patch00:tools-kvm_stat-explicitly-reference-python3.patch
+# Patches 01 to 07 are for jsc#SLE-13784
+Patch01:rework-command-line-sequence.patch
+Patch02:switch-to-argparse.patch
+Patch03:add-command-line-switch-s-to-update.patch
+Patch04:add-command-line-switch-c-to-csv.patch
+Patch05:add-command-line-switch-z-skip-zero-records.patch
+Patch06:add-command-line-switch-L-to-log-file.patch
+Patch07:add-sample-systemd-unit.patch
 
 %define XXX This package provides a userspace tool "kvm_stat", which displays 
KVM vm exit \
 information as a means of monitoring vm behavior. The data is taken from the\
@@ -51,6 +59,19 @@
 (tar -C /usr/src/linux -c COPYING tools scripts) | tar -x
 
 %patch00 -p1
+# Patches present upstream, since 5.7
+%if "%{version}" < "5.7.0"
+%patch01 -p1
+%patch02 -p1
+%patch03 -p1
+%patch04 -p1
+%endif
+%if "%{version}" < "5.8.0"
+# Patches present upstream, since 5.8
+%patch05 -p1
+%patch06 -p1
+%patch07 -p1
+%endif
 
 %build
 make -C tools/kvm/kvm_stat %{?_smp_mflags}

++ add-command-line-switch-L-to-log-file.patch ++
commit 3754afe7cf7cc3693a9c9ff795e9bd97175ca639
Author: Stefan Raspl 
Date:   Thu Apr 2 10:57:04 2020 +0200

tools/kvm_stat: Add command line switch '-L' to log to file

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 
Message-Id: <20200402085705.61155-3-ra...@linux.ibm.com>
Signed-off-by: Paolo Bonzini 

diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index d6cced4e1ef4..d199a3694be8 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -32,6 +32,7 @@ import resource
 import struct
 import re
 import subprocess
+import signal
 from collections import defaultdict, namedtuple
 from functools import reduce
 from datetime import datetime
@@ -228,6 +229,8 @@ IOCTL_NUMBERS = {
 'RESET':   0x2403,
 }
 
+signal_received = False
+
 ENCODING =