Compare commits
10 Commits
e8bcd2deca
...
0a21924ffb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a21924ffb | ||
|
|
9c7746105e | ||
|
|
5e3813c8f2 | ||
|
|
08936eb07c | ||
|
|
dd2569bc6f | ||
|
|
102fea48a5 | ||
|
|
4aa4c0680f | ||
|
|
b927b0ab36 | ||
|
|
33ecf3fbc7 | ||
|
|
0d197e7416 |
140
backport-0001-CVE-2023-33204.patch
Normal file
140
backport-0001-CVE-2023-33204.patch
Normal file
@ -0,0 +1,140 @@
|
||||
From c9a11d35df4aecfcf22aef827bac6cd57def9d4e Mon Sep 17 00:00:00 2001
|
||||
From: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
Date: Sun, 23 Oct 2022 16:22:28 +0200
|
||||
Subject: [PATCH] Add more overflow checks
|
||||
|
||||
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
|
||||
Reference:https://github.com/sysstat/sysstat/commit/c9a11d35df4aecfcf22aef827bac6cd57def9d4e
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
common.c | 45 +++++++++++++++++++++------------------------
|
||||
common.h | 4 ++--
|
||||
sa_common.c | 9 +++++++--
|
||||
sadc.c | 6 ++++++
|
||||
4 files changed, 36 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/common.c b/common.c
|
||||
index 1a84b052..27249772 100644
|
||||
--- a/common.c
|
||||
+++ b/common.c
|
||||
@@ -415,6 +415,27 @@ int check_dir(char *dirname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * **************************************************************************
|
||||
+ * Check if the multiplication of the 3 values may be greater than UINT_MAX.
|
||||
+ *
|
||||
+ * IN:
|
||||
+ * @val1 First value.
|
||||
+ * @val2 Second value.
|
||||
+ * @val3 Third value.
|
||||
+ ***************************************************************************
|
||||
+ */
|
||||
+void check_overflow(unsigned long long val1, unsigned long long val2,
|
||||
+ unsigned long long val3)
|
||||
+{
|
||||
+ if (val1 * val2 * val3 > UINT_MAX) {
|
||||
+#ifdef DEBUG
|
||||
+ fprintf(stderr, "%s: Overflow detected (%llu). Aborting...\n",
|
||||
+ __FUNCTION__, val1 * val2 * val3);
|
||||
+#endif
|
||||
+ exit(4);
|
||||
+ }
|
||||
+}
|
||||
|
||||
#ifndef SOURCE_SADC
|
||||
/*
|
||||
@@ -1656,28 +1677,4 @@ int parse_values(char *strargv, unsigned char bitmap[], int max_val, const char
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/*
|
||||
- ***************************************************************************
|
||||
- * Check if the multiplication of the 3 values may be greater than UINT_MAX.
|
||||
- *
|
||||
- * IN:
|
||||
- * @val1 First value.
|
||||
- * @val2 Second value.
|
||||
- * @val3 Third value.
|
||||
- ***************************************************************************
|
||||
- */
|
||||
-void check_overflow(size_t val1, size_t val2, size_t val3)
|
||||
-{
|
||||
- if ((unsigned long long) val1 *
|
||||
- (unsigned long long) val2 *
|
||||
- (unsigned long long) val3 > UINT_MAX) {
|
||||
-#ifdef DEBUG
|
||||
- fprintf(stderr, "%s: Overflow detected (%llu). Aborting...\n",
|
||||
- __FUNCTION__,
|
||||
- (unsigned long long) val1 * (unsigned long long) val2 * (unsigned long long) val3);
|
||||
-#endif
|
||||
- exit(4);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
#endif /* SOURCE_SADC undefined */
|
||||
diff --git a/common.h b/common.h
|
||||
index e8ab98ab..715b2da2 100644
|
||||
--- a/common.h
|
||||
+++ b/common.h
|
||||
@@ -258,10 +258,10 @@ int get_wwnid_from_pretty
|
||||
(char *, unsigned long long *, unsigned int *);
|
||||
int check_dir
|
||||
(char *);
|
||||
+void check_overflow
|
||||
+ (unsigned long long, unsigned long long, unsigned long long);
|
||||
|
||||
#ifndef SOURCE_SADC
|
||||
-void check_overflow
|
||||
- (size_t, size_t, size_t);
|
||||
int count_bits
|
||||
(void *, int);
|
||||
int count_csvalues
|
||||
diff --git a/sa_common.c b/sa_common.c
|
||||
index b2cec4ad..3460257a 100644
|
||||
--- a/sa_common.c
|
||||
+++ b/sa_common.c
|
||||
@@ -463,8 +463,9 @@ void allocate_structures(struct activity *act[])
|
||||
if (act[i]->nr_ini > 0) {
|
||||
|
||||
/* Look for a possible overflow */
|
||||
- check_overflow((size_t) act[i]->msize, (size_t) act[i]->nr_ini,
|
||||
- (size_t) act[i]->nr2);
|
||||
+ check_overflow((unsigned long long) act[i]->msize,
|
||||
+ (unsigned long long) act[i]->nr_ini,
|
||||
+ (unsigned long long) act[i]->nr2);
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
SREALLOC(act[i]->buf[j], void,
|
||||
@@ -529,6 +530,10 @@ void reallocate_all_buffers(struct activity *a, __nr_t nr_min)
|
||||
while (nr_realloc < nr_min);
|
||||
}
|
||||
|
||||
+ /* Look for a possible overflow */
|
||||
+ check_overflow((unsigned long long) a->msize, nr_realloc,
|
||||
+ (unsigned long long) a->nr2);
|
||||
+
|
||||
for (j = 0; j < 3; j++) {
|
||||
SREALLOC(a->buf[j], void,
|
||||
(size_t) a->msize * nr_realloc * (size_t) a->nr2);
|
||||
diff --git a/sadc.c b/sadc.c
|
||||
index 3458d089..123bf8e0 100644
|
||||
--- a/sadc.c
|
||||
+++ b/sadc.c
|
||||
@@ -360,6 +360,12 @@ void sa_sys_init(void)
|
||||
}
|
||||
|
||||
if (IS_COLLECTED(act[i]->options) && (act[i]->nr_ini > 0)) {
|
||||
+
|
||||
+ /* Look for a possible overflow */
|
||||
+ check_overflow((unsigned long long) act[i]->msize,
|
||||
+ (unsigned long long) act[i]->nr_ini,
|
||||
+ (unsigned long long) act[i]->nr2);
|
||||
+
|
||||
/* Allocate structures for current activity (using nr_ini and nr2 results) */
|
||||
SREALLOC(act[i]->_buf0, void,
|
||||
(size_t) act[i]->msize * (size_t) act[i]->nr_ini * (size_t) act[i]->nr2);
|
||||
|
||||
103
backport-0002-CVE-2023-33204.patch
Normal file
103
backport-0002-CVE-2023-33204.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From 44f1dc159242c1e434a3b836cda49f084c5a96cc Mon Sep 17 00:00:00 2001
|
||||
From: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
Date: Sun, 6 Nov 2022 15:48:16 +0100
|
||||
Subject: [PATCH] Make sure values to be compared are unsigned integers
|
||||
|
||||
It seems safer to make sure that input values are unsigned int before
|
||||
casting them to unsigned long long and making the comparison.
|
||||
|
||||
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
|
||||
Reference:https://github.com/sysstat/sysstat/commit/44f1dc159242c1e434a3b836cda49f084c5a96cc
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
common.c | 10 ++++++----
|
||||
common.h | 2 +-
|
||||
sa_common.c | 10 +++++-----
|
||||
sadc.c | 6 +++---
|
||||
4 files changed, 15 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/common.c b/common.c
|
||||
index 27249772..3b7fdcd5 100644
|
||||
--- a/common.c
|
||||
+++ b/common.c
|
||||
@@ -425,13 +425,15 @@ int check_dir(char *dirname)
|
||||
* @val3 Third value.
|
||||
***************************************************************************
|
||||
*/
|
||||
-void check_overflow(unsigned long long val1, unsigned long long val2,
|
||||
- unsigned long long val3)
|
||||
+void check_overflow(unsigned int val1, unsigned int val2,
|
||||
+ unsigned int val3)
|
||||
{
|
||||
- if (val1 * val2 * val3 > UINT_MAX) {
|
||||
+ if ((unsigned long long) val1 * (unsigned long long) val2 *
|
||||
+ (unsigned long long) val3 > UINT_MAX) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s: Overflow detected (%llu). Aborting...\n",
|
||||
- __FUNCTION__, val1 * val2 * val3);
|
||||
+ __FUNCTION__, (unsigned long long) val1 * (unsigned long long) val2 *
|
||||
+ (unsigned long long) val3);
|
||||
#endif
|
||||
exit(4);
|
||||
}
|
||||
diff --git a/common.h b/common.h
|
||||
index 715b2da2..fc8a1a0d 100644
|
||||
--- a/common.h
|
||||
+++ b/common.h
|
||||
@@ -259,7 +259,7 @@ int get_wwnid_from_pretty
|
||||
int check_dir
|
||||
(char *);
|
||||
void check_overflow
|
||||
- (unsigned long long, unsigned long long, unsigned long long);
|
||||
+ (unsigned int, unsigned int, unsigned int);
|
||||
|
||||
#ifndef SOURCE_SADC
|
||||
int count_bits
|
||||
diff --git a/sa_common.c b/sa_common.c
|
||||
index 3460257a..0ca8b039 100644
|
||||
--- a/sa_common.c
|
||||
+++ b/sa_common.c
|
||||
@@ -463,9 +463,9 @@ void allocate_structures(struct activity *act[])
|
||||
if (act[i]->nr_ini > 0) {
|
||||
|
||||
/* Look for a possible overflow */
|
||||
- check_overflow((unsigned long long) act[i]->msize,
|
||||
- (unsigned long long) act[i]->nr_ini,
|
||||
- (unsigned long long) act[i]->nr2);
|
||||
+ check_overflow((unsigned int) act[i]->msize,
|
||||
+ (unsigned int) act[i]->nr_ini,
|
||||
+ (unsigned int) act[i]->nr2);
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
SREALLOC(act[i]->buf[j], void,
|
||||
@@ -531,8 +531,8 @@ void reallocate_all_buffers(struct activity *a, __nr_t nr_min)
|
||||
}
|
||||
|
||||
/* Look for a possible overflow */
|
||||
- check_overflow((unsigned long long) a->msize, nr_realloc,
|
||||
- (unsigned long long) a->nr2);
|
||||
+ check_overflow((unsigned int) a->msize, (unsigned int) nr_realloc,
|
||||
+ (unsigned int) a->nr2);
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
SREALLOC(a->buf[j], void,
|
||||
diff --git a/sadc.c b/sadc.c
|
||||
index 123bf8e0..40a1e15b 100644
|
||||
--- a/sadc.c
|
||||
+++ b/sadc.c
|
||||
@@ -362,9 +362,9 @@ void sa_sys_init(void)
|
||||
if (IS_COLLECTED(act[i]->options) && (act[i]->nr_ini > 0)) {
|
||||
|
||||
/* Look for a possible overflow */
|
||||
- check_overflow((unsigned long long) act[i]->msize,
|
||||
- (unsigned long long) act[i]->nr_ini,
|
||||
- (unsigned long long) act[i]->nr2);
|
||||
+ check_overflow((unsigned int) act[i]->msize,
|
||||
+ (unsigned int) act[i]->nr_ini,
|
||||
+ (unsigned int) act[i]->nr2);
|
||||
|
||||
/* Allocate structures for current activity (using nr_ini and nr2 results) */
|
||||
SREALLOC(act[i]->_buf0, void,
|
||||
|
||||
44
backport-0003-CVE-2023-33204.patch
Normal file
44
backport-0003-CVE-2023-33204.patch
Normal file
@ -0,0 +1,44 @@
|
||||
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.
|
||||
|
||||
Reference:https://github.com/sysstat/sysstat/commit/6f8dc568e6ab072bb8205b732f04e685bf9237c0
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
common.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/common.c b/common.c
|
||||
index a932def..c121b79 100644
|
||||
--- a/common.c
|
||||
+++ b/common.c
|
||||
@@ -444,15 +444,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
|
||||
--
|
||||
2.27.0
|
||||
|
||||
112
backport-Try-to-avoid-negative-values.patch
Normal file
112
backport-Try-to-avoid-negative-values.patch
Normal file
@ -0,0 +1,112 @@
|
||||
From c43167cca3d27940e81bfed06f6645a864d00216 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
Date: Sun, 7 May 2023 10:16:40 +0200
|
||||
Subject: [PATCH] iostat: Try to avoid negative values (#355)
|
||||
|
||||
Check for negative values to avoir displaying large numbers.
|
||||
|
||||
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
|
||||
Reference:https://github.com/sysstat/sysstat/commit/c43167cca3d27940e81bfed06f6645a864d00216
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
iostat.c | 32 ++++++++++++++++++++++++--------
|
||||
rd_stats.c | 4 +++-
|
||||
2 files changed, 27 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/iostat.c b/iostat.c
|
||||
index 8174a93..bd21eb4 100644
|
||||
--- a/iostat.c
|
||||
+++ b/iostat.c
|
||||
@@ -1189,6 +1189,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
if ((hpart == 1) || !hpart) {
|
||||
/* r/s */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
+ ioi->rd_ios < ioj->rd_ios ? 0.0 :
|
||||
S_VALUE(ioj->rd_ios, ioi->rd_ios, itv));
|
||||
/* rkB/s */
|
||||
if (!DISPLAY_UNIT(flags)) {
|
||||
@@ -1212,6 +1213,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
if ((hpart == 2) || !hpart) {
|
||||
/* w/s */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
+ ioi->wr_ios < ioj->wr_ios ? 0.0 :
|
||||
S_VALUE(ioj->wr_ios, ioi->wr_ios, itv));
|
||||
/* wkB/s */
|
||||
if (!DISPLAY_UNIT(flags)) {
|
||||
@@ -1235,6 +1237,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
if ((hpart == 3) || !hpart) {
|
||||
/* d/s */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
+ ioi->dc_ios < ioj->dc_ios ? 0.0 :
|
||||
S_VALUE(ioj->dc_ios, ioi->dc_ios, itv));
|
||||
/* dkB/s */
|
||||
if (!DISPLAY_UNIT(flags)) {
|
||||
@@ -1258,6 +1261,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
if ((hpart == 4) || !hpart) {
|
||||
/* f/s */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
+ ioi->fl_ios < ioj->fl_ios ? 0.0 :
|
||||
S_VALUE(ioj->fl_ios, ioi->fl_ios, itv));
|
||||
/* f_await */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
@@ -1343,10 +1347,14 @@ void write_json_ext_stat(int tab, unsigned long long itv, int fctr,
|
||||
}
|
||||
else {
|
||||
printf("\"r/s\": %.2f, \"w/s\": %.2f, \"d/s\": %.2f, \"f/s\": %.2f, ",
|
||||
- S_VALUE(ioj->rd_ios, ioi->rd_ios, itv),
|
||||
- S_VALUE(ioj->wr_ios, ioi->wr_ios, itv),
|
||||
- S_VALUE(ioj->dc_ios, ioi->dc_ios, itv),
|
||||
- S_VALUE(ioj->fl_ios, ioi->fl_ios, itv));
|
||||
+ ioi->rd_ios < ioj->rd_ios ? 0.0
|
||||
+ : S_VALUE(ioj->rd_ios, ioi->rd_ios, itv),
|
||||
+ ioi->wr_ios < ioj->wr_ios ? 0.0
|
||||
+ : S_VALUE(ioj->wr_ios, ioi->wr_ios, itv),
|
||||
+ ioi->dc_ios < ioj->dc_ios ? 0.0
|
||||
+ : S_VALUE(ioj->dc_ios, ioi->dc_ios, itv),
|
||||
+ ioi->fl_ios < ioj->fl_ios ? 0.0
|
||||
+ : S_VALUE(ioj->fl_ios, ioi->fl_ios, itv));
|
||||
if (DISPLAY_MEGABYTES(flags)) {
|
||||
sprintf(line, "\"rMB/s\": %%.2f, \"wMB/s\": %%.2f, \"dMB/s\": %%.2f, ");
|
||||
}
|
||||
@@ -1454,10 +1462,18 @@ void write_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
compute_ext_disk_stats(&sdc, &sdp, itv, &xds);
|
||||
}
|
||||
|
||||
- /* rkB/s wkB/s dkB/s */
|
||||
- xios.rsectors = S_VALUE(ioj->rd_sectors, ioi->rd_sectors, itv);
|
||||
- xios.wsectors = S_VALUE(ioj->wr_sectors, ioi->wr_sectors, itv);
|
||||
- xios.dsectors = S_VALUE(ioj->dc_sectors, ioi->dc_sectors, itv);
|
||||
+ /*
|
||||
+ * rkB/s wkB/s dkB/s
|
||||
+ * Note: We've already tried to determine if a device had been
|
||||
+ * removed then added again (see write_stats() function).
|
||||
+ * Anyway we need to check again for possible negative values.
|
||||
+ */
|
||||
+ xios.rsectors = ioi->rd_sectors < ioj->rd_sectors ? 0.0 :
|
||||
+ S_VALUE(ioj->rd_sectors, ioi->rd_sectors, itv);
|
||||
+ xios.wsectors = ioi->wr_sectors < ioj->wr_sectors ? 0.0 :
|
||||
+ S_VALUE(ioj->wr_sectors, ioi->wr_sectors, itv);
|
||||
+ xios.dsectors = ioi->dc_sectors < ioj->dc_sectors ? 0.0 :
|
||||
+ S_VALUE(ioj->dc_sectors, ioi->dc_sectors, itv);
|
||||
|
||||
if (DISPLAY_SHORT_OUTPUT(flags)) {
|
||||
xios.sectors = xios.rsectors + xios.wsectors + xios.dsectors;
|
||||
diff --git a/rd_stats.c b/rd_stats.c
|
||||
index 245dc74..9c91dac 100644
|
||||
--- a/rd_stats.c
|
||||
+++ b/rd_stats.c
|
||||
@@ -377,7 +377,9 @@ void read_uptime(unsigned long long *uptime)
|
||||
void compute_ext_disk_stats(struct stats_disk *sdc, struct stats_disk *sdp,
|
||||
unsigned long long itv, struct ext_disk_stats *xds)
|
||||
{
|
||||
- xds->util = S_VALUE(sdp->tot_ticks, sdc->tot_ticks, itv);
|
||||
+ xds->util = sdc->tot_ticks < sdp->tot_ticks ?
|
||||
+ 0.0 :
|
||||
+ S_VALUE(sdp->tot_ticks, sdc->tot_ticks, itv);
|
||||
/*
|
||||
* Kernel gives ticks already in milliseconds for all platforms
|
||||
* => no need for further scaling.
|
||||
--
|
||||
2.33.0
|
||||
196
backport-Try-to-avoid-some-more-negative-values.patch
Normal file
196
backport-Try-to-avoid-some-more-negative-values.patch
Normal file
@ -0,0 +1,196 @@
|
||||
From 3442cec3872d6c07eda21d147ebdd35ef2fea620 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
Date: Sat, 27 May 2023 16:31:05 +0200
|
||||
Subject: [PATCH] iostat: Try to avoid some more negative values (#355)
|
||||
|
||||
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
|
||||
|
||||
Reference:https://github.com/sysstat/sysstat/commit/3442cec3872d6c07eda21d147ebdd35ef2fea620
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
iostat.c | 42 ++++++++++++++++++++++++++++++------------
|
||||
rd_stats.c | 4 ++--
|
||||
2 files changed, 32 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/iostat.c b/iostat.c
|
||||
index bd21eb4..9787e09 100644
|
||||
--- a/iostat.c
|
||||
+++ b/iostat.c
|
||||
@@ -1158,6 +1158,8 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
/* tps */
|
||||
/* Origin (unmerged) flush operations are counted as writes */
|
||||
cprintf_f(NO_UNIT, 1, 8, 2,
|
||||
+ ioi->rd_ios + ioi->wr_ios + ioi->dc_ios < ioj->rd_ios + ioj->wr_ios + ioj->dc_ios ?
|
||||
+ 0.0 :
|
||||
S_VALUE(ioj->rd_ios + ioj->wr_ios + ioj->dc_ios,
|
||||
ioi->rd_ios + ioi->wr_ios + ioi->dc_ios, itv));
|
||||
/* kB/s */
|
||||
@@ -1168,6 +1170,8 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
xios->sectors);
|
||||
/* rqm/s */
|
||||
cprintf_f(NO_UNIT, 1, 8, 2,
|
||||
+ ioi->rd_merges + ioi->wr_merges + ioi->dc_merges < ioj->rd_merges + ioj->wr_merges + ioj->dc_merges ?
|
||||
+ 0.0 :
|
||||
S_VALUE(ioj->rd_merges + ioj->wr_merges + ioj->dc_merges,
|
||||
ioi->rd_merges + ioi->wr_merges + ioi->dc_merges, itv));
|
||||
/* await */
|
||||
@@ -1178,6 +1182,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
xds->arqsz / 2);
|
||||
/* aqu-sz */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
+ ioi->rq_ticks < ioj->rq_ticks ? 0.0 :
|
||||
S_VALUE(ioj->rq_ticks, ioi->rq_ticks, itv) / 1000.0);
|
||||
/*
|
||||
* %util
|
||||
@@ -1199,6 +1204,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
xios->rsectors);
|
||||
/* rrqm/s */
|
||||
cprintf_f(NO_UNIT, 1, 8, 2,
|
||||
+ ioi->rd_merges < ioj->rd_merges ? 0.0 :
|
||||
S_VALUE(ioj->rd_merges, ioi->rd_merges, itv));
|
||||
/* %rrqm */
|
||||
cprintf_pc(DISPLAY_UNIT(flags), 1, 6, 2,
|
||||
@@ -1223,6 +1229,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
xios->wsectors);
|
||||
/* wrqm/s */
|
||||
cprintf_f(NO_UNIT, 1, 8, 2,
|
||||
+ ioi->wr_merges < ioj->wr_merges ? 0.0 :
|
||||
S_VALUE(ioj->wr_merges, ioi->wr_merges, itv));
|
||||
/* %wrqm */
|
||||
cprintf_pc(DISPLAY_UNIT(flags), 1, 6, 2,
|
||||
@@ -1247,6 +1254,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
xios->dsectors);
|
||||
/* drqm/s */
|
||||
cprintf_f(NO_UNIT, 1, 8, 2,
|
||||
+ ioi->dc_merges < ioj->dc_merges ? 0.0 :
|
||||
S_VALUE(ioj->dc_merges, ioi->dc_merges, itv));
|
||||
/* %drqm */
|
||||
cprintf_pc(DISPLAY_UNIT(flags), 1, 6, 2,
|
||||
@@ -1268,6 +1276,7 @@ void write_plain_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
xios->f_await);
|
||||
/* aqu-sz */
|
||||
cprintf_f(NO_UNIT, 1, 7, 2,
|
||||
+ ioi->rq_ticks < ioj->rq_ticks ? 0.0 :
|
||||
S_VALUE(ioj->rq_ticks, ioi->rq_ticks, itv) / 1000.0);
|
||||
/*
|
||||
* %util
|
||||
@@ -1325,6 +1334,8 @@ void write_json_ext_stat(int tab, unsigned long long itv, int fctr,
|
||||
if (DISPLAY_SHORT_OUTPUT(flags)) {
|
||||
printf("\"tps\": %.2f, \"",
|
||||
/* Origin (unmerged) flush operations are counted as writes */
|
||||
+ ioi->rd_ios + ioi->wr_ios + ioi->dc_ios < ioj->rd_ios + ioj->wr_ios + ioj->dc_ios ?
|
||||
+ 0.0 :
|
||||
S_VALUE(ioj->rd_ios + ioj->wr_ios + ioj->dc_ios,
|
||||
ioi->rd_ios + ioi->wr_ios + ioi->dc_ios, itv));
|
||||
if (DISPLAY_MEGABYTES(flags)) {
|
||||
@@ -1339,11 +1350,14 @@ void write_json_ext_stat(int tab, unsigned long long itv, int fctr,
|
||||
printf("\": %.2f, \"rqm/s\": %.2f, \"await\": %.2f, "
|
||||
"\"areq-sz\": %.2f, \"aqu-sz\": %.2f, ",
|
||||
xios->sectors /= fctr,
|
||||
+ ioi->rd_merges + ioi->wr_merges + ioi->dc_merges < ioj->rd_merges + ioj->wr_merges + ioj->dc_merges ?
|
||||
+ 0.0 :
|
||||
S_VALUE(ioj->rd_merges + ioj->wr_merges + ioj->dc_merges,
|
||||
ioi->rd_merges + ioi->wr_merges + ioi->dc_merges, itv),
|
||||
xds->await,
|
||||
xds->arqsz / 2,
|
||||
- S_VALUE(ioj->rq_ticks, ioi->rq_ticks, itv) / 1000.0);
|
||||
+ ioi->rq_ticks < ioj->rq_ticks ? 0.0
|
||||
+ : S_VALUE(ioj->rq_ticks, ioi->rq_ticks, itv) / 1000.0);
|
||||
}
|
||||
else {
|
||||
printf("\"r/s\": %.2f, \"w/s\": %.2f, \"d/s\": %.2f, \"f/s\": %.2f, ",
|
||||
@@ -1373,9 +1387,12 @@ void write_json_ext_stat(int tab, unsigned long long itv, int fctr,
|
||||
"\"r_await\": %.2f, \"w_await\": %.2f, \"d_await\": %.2f, \"f_await\": %.2f, "
|
||||
"\"rareq-sz\": %.2f, \"wareq-sz\": %.2f, \"dareq-sz\": %.2f, "
|
||||
"\"aqu-sz\": %.2f, ",
|
||||
- S_VALUE(ioj->rd_merges, ioi->rd_merges, itv),
|
||||
- S_VALUE(ioj->wr_merges, ioi->wr_merges, itv),
|
||||
- S_VALUE(ioj->dc_merges, ioi->dc_merges, itv),
|
||||
+ ioi->rd_merges < ioj->rd_merges ? 0.0
|
||||
+ : S_VALUE(ioj->rd_merges, ioi->rd_merges, itv),
|
||||
+ ioi->wr_merges < ioj->wr_merges ? 0.0
|
||||
+ : S_VALUE(ioj->wr_merges, ioi->wr_merges, itv),
|
||||
+ ioi->dc_merges < ioj->dc_merges ? 0.0
|
||||
+ : S_VALUE(ioj->dc_merges, ioi->dc_merges, itv),
|
||||
xios->rrqm_pc,
|
||||
xios->wrqm_pc,
|
||||
xios->drqm_pc,
|
||||
@@ -1386,7 +1403,8 @@ void write_json_ext_stat(int tab, unsigned long long itv, int fctr,
|
||||
xios->rarqsz / 2,
|
||||
xios->warqsz / 2,
|
||||
xios->darqsz / 2,
|
||||
- S_VALUE(ioj->rq_ticks, ioi->rq_ticks, itv) / 1000.0);
|
||||
+ ioi->rq_ticks < ioj->rq_ticks ? 0.0
|
||||
+ : S_VALUE(ioj->rq_ticks, ioi->rq_ticks, itv) / 1000.0);
|
||||
}
|
||||
|
||||
if (d->dev_tp > T_GROUP) {
|
||||
@@ -1486,11 +1504,11 @@ void write_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
((ioi->rd_merges - ioj->rd_merges) + (ioi->rd_ios - ioj->rd_ios)) * 100 :
|
||||
0.0;
|
||||
/* r_await */
|
||||
- xios.r_await = (ioi->rd_ios - ioj->rd_ios) ?
|
||||
+ xios.r_await = (ioi->rd_ios > ioj->rd_ios) ?
|
||||
(ioi->rd_ticks - ioj->rd_ticks) /
|
||||
((double) (ioi->rd_ios - ioj->rd_ios)) : 0.0;
|
||||
/* rareq-sz (still in sectors, not kB) */
|
||||
- xios.rarqsz = (ioi->rd_ios - ioj->rd_ios) ?
|
||||
+ xios.rarqsz = (ioi->rd_ios > ioj->rd_ios) ?
|
||||
(ioi->rd_sectors - ioj->rd_sectors) / ((double) (ioi->rd_ios - ioj->rd_ios)) :
|
||||
0.0;
|
||||
}
|
||||
@@ -1501,11 +1519,11 @@ void write_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
((ioi->wr_merges - ioj->wr_merges) + (ioi->wr_ios - ioj->wr_ios)) * 100 :
|
||||
0.0;
|
||||
/* w_await */
|
||||
- xios.w_await = (ioi->wr_ios - ioj->wr_ios) ?
|
||||
+ xios.w_await = (ioi->wr_ios > ioj->wr_ios) ?
|
||||
(ioi->wr_ticks - ioj->wr_ticks) /
|
||||
((double) (ioi->wr_ios - ioj->wr_ios)) : 0.0;
|
||||
/* wareq-sz (still in sectors, not kB) */
|
||||
- xios.warqsz = (ioi->wr_ios - ioj->wr_ios) ?
|
||||
+ xios.warqsz = (ioi->wr_ios > ioj->wr_ios) ?
|
||||
(ioi->wr_sectors - ioj->wr_sectors) / ((double) (ioi->wr_ios - ioj->wr_ios)) :
|
||||
0.0;
|
||||
}
|
||||
@@ -1516,17 +1534,17 @@ void write_ext_stat(unsigned long long itv, int fctr, int hpart,
|
||||
((ioi->dc_merges - ioj->dc_merges) + (ioi->dc_ios - ioj->dc_ios)) * 100 :
|
||||
0.0;
|
||||
/* d_await */
|
||||
- xios.d_await = (ioi->dc_ios - ioj->dc_ios) ?
|
||||
+ xios.d_await = (ioi->dc_ios > ioj->dc_ios) ?
|
||||
(ioi->dc_ticks - ioj->dc_ticks) /
|
||||
((double) (ioi->dc_ios - ioj->dc_ios)) : 0.0;
|
||||
/* dareq-sz (still in sectors, not kB) */
|
||||
- xios.darqsz = (ioi->dc_ios - ioj->dc_ios) ?
|
||||
+ xios.darqsz = (ioi->dc_ios > ioj->dc_ios) ?
|
||||
(ioi->dc_sectors - ioj->dc_sectors) / ((double) (ioi->dc_ios - ioj->dc_ios)) :
|
||||
0.0;
|
||||
}
|
||||
if ((hpart == 4) || !hpart) {
|
||||
/* f_await */
|
||||
- xios.f_await = (ioi->fl_ios - ioj->fl_ios) ?
|
||||
+ xios.f_await = (ioi->fl_ios > ioj->fl_ios) ?
|
||||
(ioi->fl_ticks - ioj->fl_ticks) /
|
||||
((double) (ioi->fl_ios - ioj->fl_ios)) : 0.0;
|
||||
}
|
||||
diff --git a/rd_stats.c b/rd_stats.c
|
||||
index 9c91dac..3905ac3 100644
|
||||
--- a/rd_stats.c
|
||||
+++ b/rd_stats.c
|
||||
@@ -385,10 +385,10 @@ void compute_ext_disk_stats(struct stats_disk *sdc, struct stats_disk *sdp,
|
||||
* => no need for further scaling.
|
||||
* Origin (unmerged) flush operations are counted as writes.
|
||||
*/
|
||||
- xds->await = (sdc->nr_ios - sdp->nr_ios) ?
|
||||
+ xds->await = (sdc->nr_ios > sdp->nr_ios) ?
|
||||
((sdc->rd_ticks - sdp->rd_ticks) + (sdc->wr_ticks - sdp->wr_ticks) + (sdc->dc_ticks - sdp->dc_ticks)) /
|
||||
((double) (sdc->nr_ios - sdp->nr_ios)) : 0.0;
|
||||
- xds->arqsz = (sdc->nr_ios - sdp->nr_ios) ?
|
||||
+ xds->arqsz = (sdc->nr_ios > sdp->nr_ios) ?
|
||||
((sdc->rd_sect - sdp->rd_sect) + (sdc->wr_sect - sdp->wr_sect) + (sdc->dc_sect - sdp->dc_sect)) /
|
||||
((double) (sdc->nr_ios - sdp->nr_ios)) : 0.0;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
28
sysstat.spec
28
sysstat.spec
@ -1,12 +1,17 @@
|
||||
Name: sysstat
|
||||
Version: 12.5.4
|
||||
Release: 6
|
||||
Release: 11
|
||||
Summary: System performance tools for the Linux operating system
|
||||
License: GPLv2+
|
||||
URL: http://sebastien.godard.pagesperso-orange.fr/
|
||||
Source0: https://github.com/sysstat/sysstat/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0000: backport-CVE-2022-39377.patch
|
||||
Patch6000: backport-CVE-2022-39377.patch
|
||||
Patch6001: backport-0001-CVE-2023-33204.patch
|
||||
Patch6002: backport-0002-CVE-2023-33204.patch
|
||||
Patch6003: backport-0003-CVE-2023-33204.patch
|
||||
Patch6004: backport-Try-to-avoid-negative-values.patch
|
||||
Patch6005: backport-Try-to-avoid-some-more-negative-values.patch
|
||||
|
||||
BuildRequires: gcc, gettext, lm_sensors-devel, systemd
|
||||
|
||||
@ -75,7 +80,9 @@ export compressafter="31"
|
||||
%systemd_postun sysstat.service sysstat-collect.timer sysstat-summary.timer
|
||||
|
||||
%posttrans
|
||||
/usr/bin/systemctl enable sysstat.service >/dev/null 2>&1
|
||||
if [ "$(systemctl is-enabled sysstat.service)" == "enabled" ] ; then
|
||||
/usr/bin/systemctl enable sysstat.service >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
%files -f %{name}.lang
|
||||
%doc CHANGES COPYING CREDITS FAQ.md README.md %{name}-%{version}.lsm
|
||||
@ -88,6 +95,21 @@ export compressafter="31"
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Thu Feb 29 2024 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 12.5.4-11
|
||||
- Fix the incorrect command 'is-enable' to 'is-enabled'.
|
||||
|
||||
* Wed Jan 10 2024 zhouwenpei <zhouwenpei1@h-partners.com> - 12.5.4-10
|
||||
- fix upgrade problem that sysstat.service changes from disable to enable
|
||||
|
||||
* Wed Jun 14 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 12.5.4-9
|
||||
- Try to avoid negative values
|
||||
|
||||
* Mon May 29 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 12.5.4-8
|
||||
- add missing patch
|
||||
|
||||
* Thu May 25 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 12.5.4-7
|
||||
- fix CVE-2023-33204
|
||||
|
||||
* Fri Apr 14 2023 wangjiang <wangjiang37@h-partners.com> - 12.5.4-6
|
||||
- service auto start after install
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user