Sebastien GODARD [Sat, 12 Dec 2015 10:36:54 +0000 (11:36 +0100)]
sar: Check for items upper limit before reading a datafile
Commit 7ebfd7e added a check for items upper limit used by sadc before
appending data to a file.
This commit adds the same kind of check used by sar before reading a
data file.
Sebastien GODARD [Wed, 11 Nov 2015 17:38:46 +0000 (18:38 +0100)]
Fix default value for number of subitems for A_PWR_WGHFREQ activity
Default value should be -1 for nr2 field (number of different
frequencies for A_PWR_WGHFREQ activity).
A values of -1 means that the corresponding number has still not been
calculated by the f_count2() function.
This is consistent with default values used for nr field.
mpstat's option -I now accepts a list of comma-separated arguments (SUM,
CPU, SCPU, ALL).
Eg. "mpstat -I SUM,SCPU".
Previous syntax can still be used ("mpstat -I SUM -I SCPU").
Rework mpstat's code (especially code that handles per-CPU interrupts
statistics: mpstat -I { CPU | SCPU }).
This new code better deals with special cases than can occur for per
processor interrupts statistics:
1) If the last interrupt in list (ie. in file /proc/interrupts or
/proc/softirqs) was unregistered then the header line was not updated.
This is now fixed.
2) If at least two consecutive interrupts were unregistered in the same
time interval then the statistics for all the following interrupts
couldn't be calculated for one period (values were displayed as "N/A").
This is now fixed.
3) If at least two consecutive interrupts were newly registered in the
same time interval then the statistics for all the following interrupts
couldn't be calculated for one period (values were displayed as "N/A").
This is now fixed.
4) When a new interrupt was registered (ie. appeared in file
/proc/interrupts or /proc/softirqs) then its value was displayed as not
available (N/A) for the first period. Now assume that its counter has
started from zero so that a value can be displayed.
Sebastien GODARD [Sun, 25 Oct 2015 15:00:20 +0000 (16:00 +0100)]
sar: Check min size of sa data file header
The size of an sa data file header may be greater than expected (should
we read a data file from eg. a future sysstat version), but it cannot be
smaller than current version's header size (else we wouldn't be able to
interpret the header contents).
Sebastien GODARD [Sun, 25 Oct 2015 14:13:59 +0000 (15:13 +0100)]
sadc: Fix insecure data handling, really
Commit 7ebfd7e checked upper bounds of values read from a possibly
tainted data file.
Add a lower bounds check to really fix the insecure data handling.
CID #29720.
Sebastien GODARD [Fri, 16 Oct 2015 09:22:23 +0000 (11:22 +0200)]
sar/sadc: Check for items upper limits
Check for items upper limits before displaying stats or creating an sa
data file.
This is made necessary because we check for these same limits when we
read data from a possibly tainted sa data file.
Also rename constant names to indicate that their values are actually
the maximum number of items that sar/sadc can handle.
Sebastien GODARD [Sun, 11 Oct 2015 14:14:05 +0000 (16:14 +0200)]
sadc: Fix insecure data handling
In open_ofile() function in sadc.c: Some values were read from a
(possibly tainted) sa datafile then used to allocate memory without
being checked before.
So set some limits for each possible items, and check that their number
(as read from an sa datafile) doesn't exceed their corresponding limit.
Add new S_COLORS_SGR environment variable to give the user the
possibility to customize the colors used to display statistics for
iostat, mpstat and sar commands.
Sysstat now takes into account the following values for S_COLOR
environment variable:
"never": Don't use colorization
"always": Always use colorization
"auto" (or any other value different from "never" and "always"): Use
colorization only if stdout is a terminal.
Add color support: Common functions and definitions
Add color support.
Colors will be used when S_COLORS environment variable is set (later,
this variable could contain the path to a file to allow user to cutomize
colors).
For now, a value of zero will be printed in faint yellow, whereas a non
zero value will be printed in bold yellow.
Percentages values are handled differently when they are greater than
50: A value greater than 75% is printed in bold red, or printed in bold
blue if greater than 50%.
Each sysstat command needs now to be modified to take into account these
new rules.
Colorization could also be applied to time stamps, headers, etc.
Make sysstat build on musl (non-glibc) environment
Building sysstat on musl needs two additional header files in common.h:
<limits.h>
<sys/sysmacros.h> (add an autoconf check for this because I don't know
whether all platforms have it)
There was no possibility to disable report generation without
modifying sa2 script.
So add a new variable (REPORTS) to sysstat configuration file which can
be set to false to disable reports generation.
Close #81.
Peter Schiffer [Thu, 27 Aug 2015 15:52:53 +0000 (17:52 +0200)]
Pidstat outputs values > 100% for %CPU
On systems with many short living processes pidstat could run out of
pre-allocated space for PIDs. This patch increases NR_PID_PREALLOC constant so
more space for PIDs is pre-allocated, but also adds possibility to re-allocate
this space if needed.
Sebastien GODARD [Wed, 26 Aug 2015 19:07:59 +0000 (21:07 +0200)]
tapestat: Fix issue when st driver is unloaded then loaded again
tapestat didn't look for the stats dropping back to zero when the st
driver is unloaded then loaded again, so you get one really line of
really large values when that happens. Fix this problem by
adding a check to see if the new stats are less than the old ones and
marking any tape where that happens as having invalid stats. The
information for that drive will disappear until we have all valid stats
again (it's the test for read_time, write_time, and other_time)
The test is only needed for those three since if any of them are less than
the previously read stats someone has unloaded and reloaded the driver
since that's the only time they can reduce in value).
Signed-off-by: Shane M. SEYMOUR <shane.seymour@hp.com> Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
Sebastien GODARD [Tue, 25 Aug 2015 19:18:57 +0000 (21:18 +0200)]
Fix header files included in tapestat
The list of files included in tapestat needs some changes:
- regexp.h is deprecated, use regex.h instead
- strncmp needs string.h
- sigaction/SIGALRM needs signal.h
Sebastien GODARD [Mon, 24 Aug 2015 15:49:24 +0000 (17:49 +0200)]
sysstat-11.1.6
sysstat version 11.1.6 final packaging.
lsm and spec files updated.
Changelog added.
CREDITS file updated.
.gitignore and README files updated to take into account new tapestat
command.
NOTE: A stable version (11.0.6) also exists and will be available for
download from my web site:
http://pagesperso-orange.fr/sebastien.godard/
The stable version includes only the bug fixes added in sysstat 11.1.6
but not the new features.
Sebastien GODARD [Sat, 15 Aug 2015 12:39:21 +0000 (14:39 +0200)]
Check /proc/net/snmp format for ICMP statistics
"InCsumErrors" field was added following "InErrors" in the ICMP line of
statistics. So we may have two different formats to deal with: The old
one, where "InCsumErrors" doesn't exist, and the new one including
"InCsumErrors" field.
This patch adds a check to know which format it is and read the various
statistics at their right position.
The program could exit without freeing variable buffer. Yet this
variable could have been allocated on a previous iteration in the loop.
So free it before leaving.
There is a race condition in sysstat that
sometimes causes it to record events that
happen at 23:59:59 as if they actually happened at 00:00:00 and
they end up in the report for the wrong day.
This change prevents isag from choking on the bug.
cifsiostat: Fix possible integer overflowed argument
In io_sys_init(): cifs_nr is used as argument to calloc() function
though it may have a negative value (adding NR_CIFS_PREALLOC constant
may make it overflow). So test the value before using it.
Sebastien GODARD [Fri, 22 May 2015 19:26:54 +0000 (21:26 +0200)]
sa_conv.c: Fix untrusted loop bound
Variable file_hdr.sa_act_nr was used to allocate memory and as
a loop boundary in upgrade_header_section() function.
Its value is read from an untrusted source, so check its value before
using it.
Sebastien GODARD [Fri, 22 May 2015 19:06:09 +0000 (21:06 +0200)]
sa_common.c: Fix untrusted values used as arguments
In check_file_actlst() function: file_magic->header_size and
file_hdr->sa_act_nr values were used as arguments to allocate memory via
SREALLOC although they hadn't been tested before.
The argument could be controlled by an attacker, who could invoke the
function with arbitrary values (for example, a very high or negative
buffer size).