内核页表隔离

本页使用了标题或全文手工转换
维基百科,自由的百科全书

内核页表隔离Kernel page-table isolation,缩写KPTI,也简称PTI,旧称KAISER)是Linux内核中的一种强化英语Hardening (computing)技术,旨在更好地隔离用户空间与内核空间的内存来提高安全性,缓解现代x86 CPU中的“熔毁(Meltdown)”硬件安全缺陷。[1][2]

前身[编辑]

KPTI补丁基于KAISER,它是一个用于缓解不太重要问题的早期补丁,当时业界还未了解到Meltdown的存在。

如果没有KPTI,每当执行用户空间代码(应用程序)时,Linux会在其分页表中保留整个内核内存的映射,并保护其访问。这样做的优点是当应用程序向内核发送系统调用或收到中断时,内核页表始终存在,可以避免绝大多数上下文交换相关的开销(TLB刷新、页表交换等)。

2005年,Linux内核采用了位址空间配置随机载入(KASLR)隐匿用户空间中的相关内核地址,增加了利用其他内核漏洞的难度[3][4]。尽管阻止了对这些内核映射的访问,但在此后发现,现有的英特尔x86处理器(截至2017年12月[5])还存在着多处可能泄露这些内存位置的旁路攻击,可能绕过KASLR。[2][6][7][8]AMD称其处理器不受这些攻击的影响,所以不需要KPTI作为缓解措施。[9][10][11][12][9][10][11]

Meltdown漏洞与KPTI[编辑]

2018年1月,影响Intel x86处理器的熔毁漏洞被公布。KAISER补丁改为修复此问题,并更名为KPTI,因为新型攻击很类似,尽管更为严重。

实现[编辑]

KPTI通过完全分离用户空间与内核空间页表来解决页表泄露。支持进程上下文标识符(PCID)特性的x86处理器可以用它来避免TLB刷新,但即便如此,它依然有很高的性能成本。据KAISER原作者称,其开销为0.28%[2];一名Linux开发者称大多数工作负载下测得约为5%,但即便有PCID优化,在某些情况下开销高达30%。[1]

KPTI在2018年早期被合并到Linux内核4.15版[13][14],并被反向移植到Linux内核4.14.11。Windows[15]macOS[16]也发布了类似的更新。

使用内核启动选项“pti=off”可以部分禁用内核页表隔离。依规定也可对已修复漏洞的新款处理器禁用内核页表隔离[13]

参见[编辑]

参考文献[编辑]

  1. ^ 1.0 1.1 Corbet, Jonathan. KAISER: hiding the kernel from user space. LWN.net. 15 November 2017 [2018-01-03]. (原始内容存档于2020-12-08). 
  2. ^ 2.0 2.1 2.2 Gruss, Daniel; Lipp, Moritz; Schwarz, Michael; Fellner, Richard; Maurice, Clémentine; Mangard, Stefan. KASLR is Dead: Long Live KASLR (PDF). Engineering Secure Software and Systems 2017. 24 June 2017 [2018-01-03]. (原始内容存档 (PDF)于2018-06-28). 
  3. ^ Dang, Alan. The NX Bit And ASLR - Behind Pwn2Own: Exclusive Interview With Charlie Miller. Tom's Hardware. 25 March 2009 [2017-12-29]. (原始内容存档于2023-08-11) (英语). 
  4. ^ Bhattacharjee, Abhishek; Lustig, Daniel. Architectural and Operating System Support for Virtual Memory. Morgan & Claypool Publishers. 29 September 2017: 56. ISBN 9781627059336 (英语). 
  5. ^ 腾讯科技. 英特尔CPU爆惊天漏洞:全球PC面临最高30%“降速”. 财经网. 2018-01-03 [2018-01-03]. (原始内容存档于2018-01-04) (中文(中国大陆)). 
  6. ^ Jang, Yeongjin; Lee, Sangho; Kim, Taesoo. Breaking Kernel Address Space Layout Randomization with Intel TSX (PDF). 2016 ACM SIGSAC Conference on Computer and Communications Security. CCS '16 (New York, NY, USA: ACM). 2016: 380–392 [2018-01-03]. ISBN 9781450341394. doi:10.1145/2976749.2978321. (原始内容存档 (PDF)于2020-09-21). 
  7. ^ Gruss, Daniel; Maurice, Clémentine; Fogh, Anders; Lipp, Moritz; Mangard, Stefan. Prefetch Side-Channel Attacks: Bypassing SMAP and Kernel ASLR (PDF). 2016 ACM SIGSAC Conference on Computer and Communications Security. CCS '16 (New York, NY, USA: ACM). 2016: 368–379 [2018-01-03]. ISBN 9781450341394. doi:10.1145/2976749.2978356. (原始内容存档 (PDF)于2020-08-17). 
  8. ^ Hund, R.; Willems, C.; Holz, T. Practical Timing Side Channel Attacks against Kernel Space ASLR (PDF). 2013 IEEE Symposium on Security and Privacy. May 2013: 191–205 [2018-01-03]. doi:10.1109/sp.2013.23. (原始内容存档 (PDF)于2020-11-09). 
  9. ^ 9.0 9.1 Lendacky, Tom. Do not enable PTI on AMD processors. 26 December 2017 [2018-01-03]. (原始内容存档于2020-11-09). 
  10. ^ 10.0 10.1 Gleixner, Thomas. x86/cpu, x86/pti: Do not enable PTI on AMD processors. 3 January 2018 [2018-01-04]. (原始内容存档于2020-06-28). 
  11. ^ 11.0 11.1 An Update on AMD Processor Security. 4 January 2018 [2018-01-04]. (原始内容存档于2018-03-17). 
  12. ^ IT之家. AMD谈Intel芯片漏洞:我们没受影响. 凤凰资讯. 2018-01-04 [2018-01-04]. (原始内容存档于2018-01-05). 
  13. ^ 13.0 13.1 Corbet, Jonathan. Kernel page-table isolation merged. LWN.net. 20 December 2017 [2018-01-03]. (原始内容存档于2020-10-31). 
  14. ^ Larabel, Michael. KAISER Getting Ready To Better Protect The Linux Kernel. Phoronix. 27 November 2017 [2018-01-03]. (原始内容存档于2020-10-19). 
  15. ^ Alex Ionescu [@aionescu]. Windows 17035 Kernel ASLR/VA Isolation In Practice (推文). 14 November 2017 –通过Twitter. 
  16. ^ Apple has already partially implemented fix in macOS for 'KPTI' Intel CPU security flaw. AppleInsider. [2018-01-03]. (原始内容存档于2018-01-11) (美国英语). 

外部链接[编辑]