Browse Source

enh: replace shell wildcard by a find to avoid potiental error (list of args too long)

pull/327/head
Stéphane Lesimple 2 years ago
parent
commit
8ddf6b2d6d
  1. 5
      spectre-meltdown-checker.sh

5
spectre-meltdown-checker.sh

@ -4099,8 +4099,9 @@ check_CVE_2018_3639_linux()
if [ "$kernel_ssbd_enabled" = 1 ]; then
_info_nol "* SSB mitigation currently active for selected processes: "
# silence grep's stderr here to avoid ENOENT errors from processes that have exited since the shell's expansion of the *
mitigated_processes=$(grep -El 'Speculation.?Store.?Bypass:[[:space:]]+thread (force )?mitigated' /proc/*/status 2>/dev/null \
| sed s/status/exe/ | xargs -r -n1 readlink -f | xargs -r -n1 basename | sort -u | tr "\n" " " | sed 's/ $//')
mitigated_processes=$(find /proc -mindepth 2 -maxdepth 2 -type f -name status -print0 2>/dev/null \
| xargs -r0 grep -El 'Speculation.?Store.?Bypass:[[:space:]]+thread (force )?mitigated' 2>/dev/null \
| sed s/status/exe/ | xargs -r -n1 readlink -f 2>/dev/null | xargs -r -n1 basename | sort -u | tr "\n" " " | sed 's/ $//')
if [ -n "$mitigated_processes" ]; then
pstatus green YES "$mitigated_processes"
else

Loading…
Cancel
Save