diff --git a/SOURCES/0001-sadc-Fix-segfault-that-may-happen-when-appending-dat.patch b/SOURCES/0001-sadc-Fix-segfault-that-may-happen-when-appending-dat.patch new file mode 100644 index 0000000..913522f --- /dev/null +++ b/SOURCES/0001-sadc-Fix-segfault-that-may-happen-when-appending-dat.patch @@ -0,0 +1,59 @@ +From c2b36aa61e333e2492ced8beaa84f6f19b8cf6ed Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Sat, 30 Dec 2017 11:16:32 +0100 +Subject: [PATCH] sadc: Fix segfault that may happen when appending data to + file + +Buffers need to be allocated according to activities present in file so +that we can append data to that file. + +Signed-off-by: Sebastien GODARD + +(cherry-picked from commit 1cf6596368da94ac48656dbb117f4e8c0cde58b9) +--- + sadc.c | 29 +++++++++++++++-------------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/sadc.c b/sadc.c +index 53e9175..fa94d1f 100644 +--- a/sadc.c ++++ b/sadc.c +@@ -824,20 +824,21 @@ void open_ofile(int *ofd, char ofile[]) + for (i = 0; i < file_hdr.sa_nr_act; i++) { + + p = get_activity_position(act, file_act[i].id); +- +- if ((act[p]->nr != file_act[i].nr) || (act[p]->nr2 != file_act[i].nr2)) { +- /* +- * Force number of items (serial lines, network interfaces...) +- * and sub-items to that of the file, and reallocate structures. +- */ +- act[p]->nr = file_act[i].nr; +- act[p]->nr2 = file_act[i].nr2; +- SREALLOC(act[p]->_buf0, void, act[p]->msize * act[p]->nr * act[p]->nr2); +- } +- +- /* Save activity sequence */ +- id_seq[i] = file_act[i].id; +- act[p]->options |= AO_COLLECTED; ++ ++ act[p]->nr = file_act[i].nr; ++ /* ++ * Force number of sub-items to that of the file, and reallocate structures. ++ * Note: Structures have been allocated in sa_sys_init() only for activities ++ * that are collected. But since activities from file now prevail over them, ++ * we need to reallocate. ++ */ ++ act[p]->nr2 = file_act[i].nr2; ++ SREALLOC(act[p]->_buf0, void, ++ (size_t) act[p]->msize * (size_t) act[p]->nr * (size_t) act[p]->nr2); ++ ++ /* Save activity sequence */ ++ id_seq[i] = file_act[i].id; ++ act[p]->options |= AO_COLLECTED; + } + } + } +-- +2.21.0 + diff --git a/SPECS/sysstat.spec b/SPECS/sysstat.spec index 8df4360..041afdd 100644 --- a/SPECS/sysstat.spec +++ b/SPECS/sysstat.spec @@ -1,7 +1,7 @@ Summary: Collection of performance monitoring tools for Linux Name: sysstat Version: 10.1.5 -Release: 18%{?dist} +Release: 18%{?dist}.1 License: GPLv2+ Group: Applications/System URL: http://sebastien.godard.pagesperso-orange.fr/ @@ -72,6 +72,8 @@ Patch40: 0001-ignoring-autofs-as-real-filesystem-by-counting-numbe.patch Patch41: 0001-man-use-correct-preposition.patch # fix CPU usage reporting Patch42: 0001-pidstat-Now-handle-processes-with-spaces-in-their-na.patch +# patch fix segfault when appending to sa file +Patch43: 0001-sadc-Fix-segfault-that-may-happen-when-appending-dat.patch Requires: /etc/cron.d, fileutils, grep, sh-utils, textutils Requires(post): systemd, systemd-sysv @@ -144,6 +146,7 @@ The cifsiostat command reports I/O statistics for CIFS file systems. %patch40 -p1 %patch41 -p1 %patch42 -p1 +%patch43 -p1 iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux mv CREDITS.aux CREDITS @@ -205,6 +208,9 @@ fi %{_localstatedir}/log/sa %changelog +* Mon Jan 20 2020 Michal Sekletár - 10.1.5-18.1 +- fix possible segfault when appending to data file (#1793580) + * Thu Mar 28 2019 Michal Sekletár - 10.1.5-18 - add -f flag to force fdatasync() after sa file update (#1662094) - don't call filesystem count functions when we are not collecting fs statistics (#1670060)