当前的 Meltdown Intel 处理器漏洞目前已通过启用页表隔离进行补救。有一个问题如何关闭它:如何禁用页表隔离以恢复由于英特尔 CPU 安全漏洞补丁而丢失的性能?
我的问题是相反的:有没有办法检查正在运行的系统上 PTI 机制是否对系统有效,从而保护系统?我专门寻找cat /proc/somethingor cat /sys/something,而不是检查内核版本或配置参数等。
N0r*_*ert 63
按照Raniz 的建议在内核配置中使用 Grepping CONFIG_PAGE_TABLE_ISOLATION对桌面 Ubuntu 没有帮助,但可能对云实例有所帮助:
grep CONFIG_PAGE_TABLE_ISOLATION=y /boot/config-`uname -r` && \
echo "patched :)" || echo "unpatched :("
Run Code Online (Sandbox Code Playgroud)您可以/proc/cpuinfo按照JonasCz 的建议进行检查:
grep -q "cpu_insecure\|cpu_meltdown\|kaiser" /proc/cpuinfo && echo "patched :)" \
|| echo "unpatched :("
Run Code Online (Sandbox Code Playgroud)或来自dmesg(感谢Jason Creighton):
dmesg | grep -q "Kernel/User page tables isolation: enabled" \
&& echo "patched :)" || echo "unpatched :("
Run Code Online (Sandbox Code Playgroud)您可以从Raphael Carvalho编译测试程序以进行熔断检测:
sudo apt-get install git build-essential
cd /tmp
git clone https://github.com/raphaelsc/Am-I-affected-by-Meltdown.git
cd Am-I-affected-by-Meltdown
make
sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
./meltdown-checker
Run Code Online (Sandbox Code Playgroud)在修补系统上,它应该以输出结束
...
so far so good (i.e. meltdown safe) ...
System not affected (take it with a grain of salt though as false negative
may be reported for specific environments; Please consider running it once again).
Run Code Online (Sandbox Code Playgroud)
使用https://github.com/speed47/spectre-meltdown-checker 中的工具进行检查:
cd /tmp
wget https://raw.githubusercontent.com/speed47/spectre-meltdown-checker/master/spectre-meltdown-checker.sh
sudo sh /tmp/spectre-meltdown-checker.sh
Run Code Online (Sandbox Code Playgroud)在修补系统上,它应该显示以下内容:
Spectre and Meltdown mitigation detection tool v0.27
Checking for vulnerabilities against live running kernel Linux 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64
...
CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: YES
> STATUS: NOT VULNERABLE (PTI mitigates the vulnerability)
Run Code Online (Sandbox Code Playgroud)
正如Robie Basak 已经写过的那样,有一个关于Ubuntu 中 Spectre 和 Meltdown 漏洞状态的页面。
还有:
Aad*_* RF 18
运行以下命令:
dmesg | grep 'page tables isolation'
Run Code Online (Sandbox Code Playgroud)
如果显示已启用,则 PTI 已启用。如果未显示任何内容或您在终端中看到“已禁用”,则 PTI 已禁用。Ubuntu 尚未发布补丁,因此不会显示任何消息。
Jon*_*sCz 13
您可以检查cat /proc/cpuinfo,如果它cpu_insecure在“错误”下报告,则启用了 PTI。
如果它是空白的(或者只是没有列出cpu_insecure),那么很可能你正在运行一个尚未打补丁的内核(Ubuntu 还没有),或者你有一个 AMD 处理器(可以预见这将不会被启用,因为它们'不脆弱)。
目前,所有 CPU在最新的 4.15 内核中都被视为易受攻击的。
小智 8
我发现了这个很棒的 sh 脚本来测试您系统上的 Meltdown/Spectre 漏洞:
https://github.com/speed47/spectre-meltdown-checker
该脚本会检查您的系统是否存在系统上已知的 Meltdown 和 Spectre 补丁,以告诉您这些漏洞现在是否已被您的操作系统缓解
您可以运行以下命令来查看所有可用的缓解措施(不仅针对 PTI,还针对其他漏洞):
$ cat /sys/devices/system/cpu/vulnerabilities/*
Mitigation: PTE Inversion
Mitigation: Clear CPU buffers; SMT vulnerable
Mitigation: PTI
Mitigation: Speculative Store Bypass disabled via prctl and seccomp
Mitigation: usercopy/swapgs barriers and __user pointer sanitization
Mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
34942 次 |
| 最近记录: |