diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2018-05-09 15:33:14 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-06 16:01:55 +0100 |
commit | ca3bec9ada0bb0542cb71a8f808aebd101600564 (patch) | |
tree | e9fbbff89393ed6adadad98ba09458b514182c34 | |
parent | eb216d15f1df579fd810aa077dee4230deffb878 (diff) | |
download | sos-ca3bec9ada0bb0542cb71a8f808aebd101600564.tar.gz |
[kernel] Avoid capturing blanket 'find -ls'
Previously, if sos was run in an environment where '/lib/modules/*' did
not exist, the kernel plugin would pass an empty extra_mod_paths list to
'find -ls', which would in turn cause sos to execute 'find -ls' on the
entire filesystem.
While this situation may seem rare, this is a possiblity whenever sos is
run in a container that does not have the proper environment variable
set that indicates to the active policy that sos is in fact in a
container. On top of generating a sosreport with little to useful
information in this case, the generated sosreport could potentially be
very large due to the collection of a blanket 'find -ls'.
This prevents this from occuring, by not running 'find -ls' if the
extra_mod_paths list is empty.
Resolves: #1288
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/kernel.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py index 4ea3af15..719a6e1c 100644 --- a/sos/plugins/kernel.py +++ b/sos/plugins/kernel.py @@ -71,11 +71,13 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): for pattern in extra_mod_patterns: extra_mod_paths.extend(glob.glob(pattern)) + if extra_mod_paths: + self.add_cmd_output("find %s -ls" % " ".join(extra_mod_paths)) + self.add_cmd_output([ "dmesg", "sysctl -a", - "dkms status", - "find %s -ls" % " ".join(extra_mod_paths) + "dkms status" ]) clocksource_path = "/sys/devices/system/clocksource/clocksource0/" |