Sync from SUSE:ALP:Source:Standard:1.0 sysstat revision 0e9511f6274ca11918ced099b4f5a71b

This commit is contained in:
Adrian Schröter 2023-08-04 15:53:30 +02:00
commit defbcec24d
10 changed files with 1757 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,22 @@
Index: sysstat-12.4.3/sysstat.service.in
===================================================================
--- sysstat-12.4.3.orig/sysstat.service.in
+++ sysstat-12.4.3/sysstat.service.in
@@ -10,6 +10,17 @@ Description=Resets System Activity Logs
After=remote-fs.target local-fs.target
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
Type=oneshot
RemainAfterExit=yes
User=@CRON_OWNER@

9
isag.desktop Normal file
View File

@ -0,0 +1,9 @@
[Desktop Entry]
Version=1.0
Name=Isag System Activity Grapher
GenericName=System Monitor
Comment=Interactive System Activity Grapher for sysstat
Exec=isag
Icon=utilities-system-monitor
Type=Application
Categories=System;Monitor;

BIN
sysstat-12.6.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,15 @@
Index: sysstat-11.6.1/common.h
===================================================================
--- sysstat-11.6.1.orig/common.h
+++ sysstat-11.6.1/common.h
@@ -178,8 +178,8 @@ extern unsigned int kb_shift;
* kB <-> number of pages.
* Page size depends on machine architecture (4 kB, 8 kB, 16 kB, 64 kB...)
*/
-#define KB_TO_PG(k) ((k) >> kb_shift)
-#define PG_TO_KB(k) ((k) << kb_shift)
+#define KB_TO_PG(k) ((k) / (getpagesize()/1024))
+#define PG_TO_KB(k) ((k) * (getpagesize()/1024))
/* Type of persistent device names used in sar and iostat */
extern char persistent_name_type[MAX_FILE_LEN];

View File

@ -0,0 +1,58 @@
Index: sysstat-12.6.0/sa1.in
===================================================================
--- sysstat-12.6.0.orig/sa1.in
+++ sysstat-12.6.0/sa1.in
@@ -31,8 +31,14 @@ then
LONG_NAME=y
fi
+set -e
ENDIR=@SA_LIB_DIR@
cd ${ENDIR}
+LOCKFILE=/var/run/sysstat/sadc.LOCK
+mkdir -p /var/run/sysstat
+lockfile -r2 -30 "$LOCKFILE" 2>/dev/null
+trap "/bin/rm -f $LOCKFILE" EXIT
+
[ "$1" = "--boot" ] && shift && BOOT=y || BOOT=n
[ "$1" = "--sleep" ] && shift && SLEEP=y || SLEEP=n
@@ -51,13 +57,13 @@ fi
if [ "${SLEEP}" = "y" ]
then
- exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} -C "LINUX SLEEP MODE ($*)" ${SA_DIR}
+ ${ENDIR}/sadc -F -L ${SADC_OPTIONS} -C "LINUX SLEEP MODE ($*)" ${SA_DIR}
elif [ $# = 0 ] && [ "${BOOT}" = "n" ]
then
# Note: Stats are written at the end of previous file *and* at the
# beginning of the new one (when there is a file rotation) only if
# outfile has not been explicitly specified on the command line...
- exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} 1 1 ${SA_DIR}
+ ${ENDIR}/sadc -F -L ${SADC_OPTIONS} 1 1 ${SA_DIR}
else
- exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} $* ${SA_DIR}
+ ${ENDIR}/sadc -F -L ${SADC_OPTIONS} $* ${SA_DIR}
fi
Index: sysstat-12.6.0/sa2.in
===================================================================
--- sysstat-12.6.0.orig/sa2.in
+++ sysstat-12.6.0/sa2.in
@@ -59,6 +59,17 @@ fi
[ -f "${DFILE}" ] || exit 0
cd ${ENDIR}
+
+LOCKFILE=/var/run/sysstat/sadc.LOCK
+mkdir -p /var/run/sysstat
+if ! lockfile -r6 -600 $LOCKFILE 2>/dev/null; then
+ if test `find $LOCKFILE -mmin +180 2>/dev/null`; then
+ rm -f $LOCKFILE
+ logger -p cron.alert "$0: detected an old lockfile \"$LOCKFILE\"."
+ fi
+fi
+trap "/bin/rm -f $LOCKFILE" EXIT
+
if [ x${REPORTS} != xfalse ]
then
${ENDIR}/sar $* -f ${DFILE} > ${RPT}

View File

@ -0,0 +1,38 @@
From 954ff2e2673cef48f0ed44668c466eab041db387 Mon Sep 17 00:00:00 2001
From: Pavel Kopylov <pkopylov@cloudlinux.com>
Date: Wed, 17 May 2023 11:33:45 +0200
Subject: [PATCH] Fix an overflow which is still possible for some values.
---
common.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: sysstat-12.6.2/common.c
===================================================================
--- sysstat-12.6.2.orig/common.c
+++ sysstat-12.6.2/common.c
@@ -447,15 +447,17 @@ int check_dir(char *dirname)
void check_overflow(unsigned int val1, unsigned int val2,
unsigned int val3)
{
- if ((unsigned long long) val1 * (unsigned long long) val2 *
- (unsigned long long) val3 > UINT_MAX) {
+ if ((val1 != 0) && (val2 != 0) && (val3 != 0) &&
+ (((unsigned long long) UINT_MAX / (unsigned long long) val1 <
+ (unsigned long long) val2) ||
+ ((unsigned long long) UINT_MAX / ((unsigned long long) val1 * (unsigned long long) val2) <
+ (unsigned long long) val3))) {
#ifdef DEBUG
- fprintf(stderr, "%s: Overflow detected (%llu). Aborting...\n",
- __FUNCTION__, (unsigned long long) val1 * (unsigned long long) val2 *
- (unsigned long long) val3);
+ fprintf(stderr, "%s: Overflow detected (%u,%u,%u). Aborting...\n",
+ __FUNCTION__, val1, val2, val3);
#endif
- exit(4);
- }
+ exit(4);
+ }
}
#ifndef SOURCE_SADC

20
sysstat-service.patch Normal file
View File

@ -0,0 +1,20 @@
Index: sysstat-12.0.6/sysstat.service.in
===================================================================
--- sysstat-12.0.6.orig/sysstat.service.in
+++ sysstat-12.0.6/sysstat.service.in
@@ -7,12 +7,15 @@
[Unit]
Description=Resets System Activity Logs
+After=remote-fs.target local-fs.target
[Service]
Type=oneshot
RemainAfterExit=yes
User=@CRON_OWNER@
ExecStart=@SA_LIB_DIR@/sa1 --boot
+ExecStop=@SA_LIB_DIR@/sa1 1 1
+StandardOutput=null
[Install]
WantedBy=multi-user.target

1387
sysstat.changes Normal file

File diff suppressed because it is too large Load Diff

182
sysstat.spec Normal file
View File

@ -0,0 +1,182 @@
#
# spec file for package sysstat
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: sysstat
Version: 12.6.2
Release: 0
Summary: Sar and Iostat Commands for Linux
License: GPL-2.0-or-later
Group: System/Monitoring
URL: https://github.com/sysstat/sysstat
Source: https://github.com/sysstat/sysstat/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: isag.desktop
# PATCH-FIX-OPENSUSE should be upstreamed
# add locking to scripts sa1 and sa2 (bnc#7861)
Patch0: sysstat-8.1.6-sa1sa2lock.diff
# PATCH-FIX-OPENSUSE should be upstreamed
# use getpagesize() instead of kb_shift for hugetable archs
Patch2: sysstat-8.0.4-pagesize.diff
# PATCH-FIX-OPENSUSE bsc#1151453
Patch3: sysstat-service.patch
Patch4: harden_sysstat.service.patch
# PATCH-FIX-UPSTREAM CVE-2023-33204, bsc#1211507 https://github.com/sysstat/sysstat/pull/360.patch
Patch5: sysstat-CVE-2023-33204.patch
BuildRequires: findutils
BuildRequires: gettext-runtime
BuildRequires: libpcp-devel
BuildRequires: libpcp_import1
BuildRequires: pkgconfig
BuildRequires: sed
BuildRequires: systemd-rpm-macros
BuildRequires: update-desktop-files
Requires: procmail
Requires: xz
%{?systemd_ordering}
%ifnarch s390 s390x
BuildRequires: libsensors4-devel
%endif
%description
Sar and Iostat commands for Linux. The sar command collects and reports
system activity information. The iostat command reports CPU statistics
and I/O statistics for TTY devices and disks. The information
collected by sar and iostat can be saved in a binary file for future
inspection. Both commands now support SMP machines when displaying CPU
utilization.
%package isag
Summary: Interactive System Activity Grapher for sysstat
Group: System/Monitoring
Requires: gnuplot
Requires: sysstat = %{version}
Requires: tk
%description isag
This package includes the isag command, which graphically displays the
system activity data stored in a binary data produced by a sar command
from a sysstat package.
%prep
%setup -q
%patch0 -p1
%patch2 -p1
%patch3 -p1
cp %{SOURCE1} .
# remove date and time from objects
find ./ -name \*.c -exec sed -i -e 's: " compiled " __DATE__ " " __TIME__::g' {} \;
%patch4 -p1
%patch5 -p1
%build
export conf_dir="%{_sysconfdir}/sysstat"
export sa_lib_dir="%{_libdir}/sa"
export cron_owner=root
export LFLAGS="-L. -lsyscom"
export history="60"
export sadc_options="-S ALL"
%configure \
--with-systemdsystemunitdir=%{_unitdir} \
--with-systemdsleepdir=%{_systemd_util_dir}/system-sleep \
--enable-install-cron \
--disable-silent-rules \
--enable-nls \
--disable-man-group \
--enable-copy-only \
--disable-file-attr \
--enable-debug-info \
--enable-pcp \
%ifnarch s390 s390x
--enable-sensors \
%endif
--disable-stripping
%make_build
%install
mkdir -p %{buildroot}%{_localstatedir}/log/sa %{buildroot}%{_sbindir}
%make_install
install -D -m 0644 isag.desktop %{buildroot}%{_datadir}/applications/isag.desktop
%suse_update_desktop_file isag
cp contrib/isag/isag %{buildroot}%{_bindir}
cp contrib/isag/isag.1 %{buildroot}%{_mandir}/man1
rm -rf %{buildroot}%{_datadir}/doc/sysstat*
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcsysstat
%find_lang %{name}
%check
# Newer versions only have simulation tests
# make %%{?_smp_mflags} test
%pre
%service_add_pre sysstat.service sysstat-collect.timer sysstat-summary.timer
%post
%service_add_post sysstat.service sysstat-collect.timer sysstat-summary.timer
# Earlier versions used cron, remove leftover
rm -f /etc/cron.d/sysstat || :
%preun
%service_del_preun sysstat.service sysstat-collect.timer sysstat-summary.timer
[ "$1" -gt 0 ] || rm -rf %{_localstatedir}/log/sa/*
%postun
%service_del_postun sysstat.service sysstat-collect.timer sysstat-summary.timer
%if 0%{?suse_version} < 1500
%post isag
%desktop_database_post
%postun isag
%desktop_database_postun
%endif
%files -f "%{name}.lang"
%license COPYING
%doc CHANGES CREDITS FAQ.md README.md
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%exclude %{_mandir}/man1/isag*
%dir %{_sysconfdir}/sysstat
%dir %{_systemd_util_dir}/system-sleep
%config(noreplace) %{_sysconfdir}/sysstat/sysstat
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/sysstat/sysstat.ioconf
%{_bindir}/cifsiostat
%{_bindir}/iostat
%{_bindir}/mpstat
%{_bindir}/pidstat
%{_bindir}/sadf
%{_bindir}/sar
%{_bindir}/tapestat
%exclude %{_bindir}/isag
%{_libdir}/sa
%{_unitdir}/sysstat.service
%{_unitdir}/sysstat-collect.service
%{_unitdir}/sysstat-collect.timer
%{_unitdir}/sysstat-summary.service
%{_unitdir}/sysstat-summary.timer
%{_systemd_util_dir}/system-sleep/sysstat.sleep
%dir %{_localstatedir}/log/sa
%{_sbindir}/rcsysstat
%files isag
%doc contrib/isag/README-isag
%{_mandir}/man1/isag*
%{_bindir}/isag
%{_datadir}/applications/isag.desktop
%changelog