mirror of
https://github.com/speed47/spectre-meltdown-checker.git
synced 2026-09-11 05:13:56 +02:00
fix: another attempt to avoid sigpipe on grep (#519)
Take this opportunity to factorize all the greps in /proc/cpuinfo
into a helper that avoids using a pipe to entirely avoid SIGPIPE
on a possibly gigantic /proc/cpuinfo
(cherry picked from commit 5bbffaf053)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
pti_performance_check() {
|
||||
local ret pcid invpcid
|
||||
pr_info_nol " * Reduced performance impact of PTI: "
|
||||
if [ -e "$g_procfs/cpuinfo" ] && grep ^flags "$g_procfs/cpuinfo" | grep -qw pcid; then
|
||||
if cpuinfo_has_flag pcid; then
|
||||
pcid=1
|
||||
else
|
||||
read_cpuid 0x1 0x0 "$ECX" 17 1 1
|
||||
@@ -21,7 +21,7 @@ pti_performance_check() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "$g_procfs/cpuinfo" ] && grep ^flags "$g_procfs/cpuinfo" | grep -qw invpcid; then
|
||||
if cpuinfo_has_flag invpcid; then
|
||||
invpcid=1
|
||||
else
|
||||
read_cpuid 0x7 0x0 "$EBX" 10 1 1
|
||||
@@ -110,11 +110,11 @@ check_CVE_2017_5754_linux() {
|
||||
dmesg_grep="$dmesg_grep|x86/pti: Unmapping kernel while in userspace"
|
||||
# aarch64
|
||||
dmesg_grep="$dmesg_grep|CPU features: detected( feature)?: Kernel page table isolation \(KPTI\)"
|
||||
if grep ^flags "$g_procfs/cpuinfo" | grep -qw pti; then
|
||||
if cpuinfo_has_flag pti; then
|
||||
# vanilla PTI patch sets the 'pti' flag in cpuinfo
|
||||
pr_debug "kpti_enabled: found 'pti' flag in $g_procfs/cpuinfo"
|
||||
kpti_enabled=1
|
||||
elif grep ^flags "$g_procfs/cpuinfo" | grep -qw kaiser; then
|
||||
elif cpuinfo_has_flag kaiser; then
|
||||
# kernel line 4.9 sets the 'kaiser' flag in cpuinfo
|
||||
pr_debug "kpti_enabled: found 'kaiser' flag in $g_procfs/cpuinfo"
|
||||
kpti_enabled=1
|
||||
|
||||
Reference in New Issue
Block a user