[packages/sysstat] Rel 2. Backport upstream security fixes for crafted input.
arekm
arekm at pld-linux.org
Thu Oct 29 09:09:31 CET 2026
commit d10b8bef927458e0a6a3f75ee18aeecb2542d1ff
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 29 00:38:52 2026 +0100
Rel 2. Backport upstream security fixes for crafted input.
sysstat-ioconf-overflow.patch | 29 ++++++++++++++++++++
sysstat-mapsize-overflow.patch | 60 ++++++++++++++++++++++++++++++++++++++++++
sysstat-wwnid-nullcheck.patch | 21 +++++++++++++++
sysstat.spec | 8 +++++-
4 files changed, 117 insertions(+), 1 deletion(-)
---
diff --git a/sysstat.spec b/sysstat.spec
index d8a8243..ef839be 100644
--- a/sysstat.spec
+++ b/sysstat.spec
@@ -9,13 +9,16 @@ Summary(zh_CN.UTF-8): sar, iostat 等系统监视工具
# an odd one (12.7.x) is the development series
Name: sysstat
Version: 12.8.0
-Release: 1
+Release: 2
License: GPL v2
Group: Applications/System
Source0: https://github.com/sysstat/sysstat/archive/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 653ce9e613a0a60c8bb1e0d739dc58ca
Source2: %{name}.init
Source3: crontab
+Patch0: %{name}-mapsize-overflow.patch
+Patch1: %{name}-ioconf-overflow.patch
+Patch2: %{name}-wwnid-nullcheck.patch
URL: https://sysstat.github.io/
BuildRequires: autoconf >= 2.53
BuildRequires: automake
@@ -61,6 +64,9 @@ sieciowych i innych operacji wejścia/wyjścia.
%prep
%setup -q
+%patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
%build
%{__aclocal}
diff --git a/sysstat-ioconf-overflow.patch b/sysstat-ioconf-overflow.patch
new file mode 100644
index 0000000..eb6d752
--- /dev/null
+++ b/sysstat-ioconf-overflow.patch
@@ -0,0 +1,29 @@
+Upstream c27b1cf1af: ioc_init() parses sysstat.ioconf with unbounded
+"%[^:]" sscanf conversions; an over-long field overflows blkp->name /
+cfmt / dfmt / pfmt. A '%'-prefixed disk format also wrote two bytes past
+blkp->dfmt via strcat. Add sscanf field widths and keep room for "%s".
+https://github.com/sysstat/sysstat/commit/c27b1cf1affcb67396b82958bda633acac02ddea
+diff --git a/ioconf.c b/ioconf.c
+index 3e03d173..5ef7c9c7 100644
+--- a/ioconf.c
++++ b/ioconf.c
+@@ -234,7 +234,8 @@ int ioc_init(void)
+
+ /* maybe it's a full record? */
+
+- i = sscanf(buf, "%u:%[^:]:%[^:]:%u:%[^:]:%u:%[^:]:%u:%63s",
++ /* Field widths must match IOC_NAMELEN, IOC_FMTLEN and IOC_DESCLEN */
++ i = sscanf(buf, "%u:%31[^:]:%15[^:]:%u:%15[^:]:%u:%15[^:]:%u:%63s",
+ &major, blkp->name,
+ cfmt, &iocp->ctrlno,
+ dfmt, &blkp->dcount,
+@@ -316,7 +317,8 @@ int ioc_init(void)
+ break;
+
+ case '%':
+- strncpy(blkp->dfmt, dfmt + 1, sizeof(blkp->dfmt) - 1);
++ /* Keep room for the "%s" string appended below */
++ strncpy(blkp->dfmt, dfmt + 1, sizeof(blkp->dfmt) - 3);
+ /* fallthrough to next case */
+ case 'd':
+ blkp->cconv = ioc_ito10;
diff --git a/sysstat-mapsize-overflow.patch b/sysstat-mapsize-overflow.patch
new file mode 100644
index 0000000..f529a1c
--- /dev/null
+++ b/sysstat-mapsize-overflow.patch
@@ -0,0 +1,60 @@
+Upstream 73cfff6daf: crafted sa datafile causes OOB read/write past a
+16-byte heap allocation. MAP_SIZE() multiplied in 32-bit so a types_nr[]
+value like 0x20000001 wrapped to 16 and bypassed the "MAP_SIZE > size"
+checks. Evaluate in 64-bit so such files are rejected.
+https://github.com/sysstat/sysstat/commit/73cfff6daf45e560713f725e0e3ac8eacdb75456
+diff --git a/rd_stats.h b/rd_stats.h
+index 71cbd9f2..89c3f310 100644
+--- a/rd_stats.h
++++ b/rd_stats.h
+@@ -120,9 +120,16 @@
+ #define UL_ALIGNMENT_WIDTH SIZEOF_LONG_64BIT
+ #define U_ALIGNMENT_WIDTH 4
+
+-#define MAP_SIZE(m) ((m[0] * ULL_ALIGNMENT_WIDTH) + \
+- (m[1] * UL_ALIGNMENT_WIDTH) + \
+- (m[2] * U_ALIGNMENT_WIDTH))
++/*
++ * NB: the multiplications below are done in 64-bit arithmetic on purpose.
++ * types_nr[] is read straight from the datafile and is fully attacker
++ * controlled; computing this in 32-bit "unsigned int" lets a crafted value
++ * such as 0x20000001 wrap to a small result and sail through the callers'
++ * "MAP_SIZE(...) > size" sanity checks.
++ */
++#define MAP_SIZE(m) (((unsigned long long) (m)[0] * ULL_ALIGNMENT_WIDTH) + \
++ ((unsigned long long) (m)[1] * UL_ALIGNMENT_WIDTH) + \
++ ((unsigned long long) (m)[2] * U_ALIGNMENT_WIDTH))
+
+ /*
+ * Structure for CPU statistics.
+diff --git a/sa_common.c b/sa_common.c
+index 4c121615..4c0c7252 100644
+--- a/sa_common.c
++++ b/sa_common.c
+@@ -2065,7 +2065,7 @@ int sa_open_read_magic(int *fd, char *dfile, struct file_magic *file_magic,
+ /* hdr_types_nr field exists only for sysstat versions 11.7.1 and later */
+ if (MAP_SIZE(file_magic->hdr_types_nr) > file_magic->header_size) {
+ #ifdef DEBUG
+- fprintf(stderr, "%s: map_size=%u header_size=%u\n",
++ fprintf(stderr, "%s: map_size=%llu header_size=%u\n",
+ __FUNCTION__, MAP_SIZE(file_magic->hdr_types_nr), file_magic->header_size);
+ #endif
+ handle_invalid_sa_file(*fd, file_magic, dfile, n);
+@@ -2184,7 +2184,7 @@ void check_file_actlst(int *ifd, char *dfile, struct activity *act[], uint64_t f
+ (MAP_SIZE(file_hdr->act_types_nr) > file_hdr->act_size) ||
+ (MAP_SIZE(file_hdr->rec_types_nr) > file_hdr->rec_size)) {
+ #ifdef DEBUG
+- fprintf(stderr, "%s: sa_act_nr=%u act_size=%u rec_size=%u map_size(act)=%u map_size(rec)=%u\n",
++ fprintf(stderr, "%s: sa_act_nr=%u act_size=%u rec_size=%u map_size(act)=%llu map_size(rec)=%llu\n",
+ __FUNCTION__, file_hdr->sa_act_nr, file_hdr->act_size, file_hdr->rec_size,
+ MAP_SIZE(file_hdr->act_types_nr), MAP_SIZE(file_hdr->rec_types_nr));
+ #endif
+@@ -2290,7 +2290,7 @@ void check_file_actlst(int *ifd, char *dfile, struct activity *act[], uint64_t f
+
+ if (MAP_SIZE(fal->types_nr) > fal->size) {
+ #ifdef DEBUG
+- fprintf(stderr, "%s: id=%u size=%d map_size=%u\n",
++ fprintf(stderr, "%s: id=%u size=%d map_size=%llu\n",
+ __FUNCTION__, fal->id, fal->size, MAP_SIZE(fal->types_nr));
+ #endif
+ goto format_error;
diff --git a/sysstat-wwnid-nullcheck.patch b/sysstat-wwnid-nullcheck.patch
new file mode 100644
index 0000000..2e13998
--- /dev/null
+++ b/sysstat-wwnid-nullcheck.patch
@@ -0,0 +1,21 @@
+Upstream dbfbe021ec: extract_wwnid() called strlen(name) before the
+NULL check on name, making the guard useless. Move the strlen() after it.
+https://github.com/sysstat/sysstat/commit/dbfbe021ec38b99d256805d2e4f8ecde1e72715e
+diff --git a/common.c b/common.c
+index 846268f3..6a5bfcd2 100644
+--- a/common.c
++++ b/common.c
+@@ -313,11 +313,12 @@ int extract_wwnid(char *name, unsigned long long *wwn, unsigned int *part_nr)
+ {
+ char id[WWN_SHORT_LEN + 1];
+ char *s;
+- int wwnlen = strlen(name);
++ int wwnlen;
+
+ if ((name == NULL) || (wwn == NULL) || (part_nr == NULL))
+ return -1;
+
++ wwnlen = strlen(name);
+ *wwn = *(wwn + 1) = 0ULL;
+ *part_nr = 0;
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/sysstat.git/commitdiff/d10b8bef927458e0a6a3f75ee18aeecb2542d1ff
More information about the pld-cvs-commit
mailing list