此條目需要
精通或熟悉相关主题的编者 参与及协助编辑。
請邀請 適合的人士改善本条目 。更多的細節與詳情請參见討論頁 。
内核页表隔离 (Kernel page-table isolation ,缩写KPTI,也简称PTI,旧称KAISER)是Linux内核 中的一种强化 技术,旨在更好地隔离用户空间 与内核空间的内存 来提高安全性,缓解现代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]
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.0 1.1 Corbet, Jonathan. KAISER: hiding the kernel from user space . LWN.net. 15 November 2017 [2018-01-03 ] . (原始内容存档 于2020-12-08).
^ 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).
^ 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) (英语) .
^ Bhattacharjee, Abhishek; Lustig, Daniel. Architectural and Operating System Support for Virtual Memory . Morgan & Claypool Publishers. 29 September 2017: 56. ISBN 9781627059336 (英语) .
^ 腾讯科技. 英特尔CPU爆惊天漏洞:全球PC面临最高30%“降速” . 财经网. 2018-01-03 [2018-01-03 ] . (原始内容 存档于2018-01-04) (中文(中国大陆)) .
^ 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).
^ 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).
^ 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.0 9.1 Lendacky, Tom. Do not enable PTI on AMD processors . 26 December 2017 [2018-01-03 ] . (原始内容存档 于2020-11-09).
^ 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.0 11.1 An Update on AMD Processor Security . 4 January 2018 [2018-01-04 ] . (原始内容存档 于2018-03-17).
^ IT之家. AMD谈Intel芯片漏洞:我们没受影响 . 凤凰资讯. 2018-01-04 [2018-01-04 ] . (原始内容存档 于2018-01-05).
^ 13.0 13.1 Corbet, Jonathan. Kernel page-table isolation merged . LWN.net. 20 December 2017 [2018-01-03 ] . (原始内容存档 于2020-10-31).
^ Larabel, Michael. KAISER Getting Ready To Better Protect The Linux Kernel . Phoronix. 27 November 2017 [2018-01-03 ] . (原始内容存档 于2020-10-19).
^ Alex Ionescu [@aionescu]. Windows 17035 Kernel ASLR/VA Isolation In Practice (推文). 14 November 2017 –通过Twitter .
^ Apple has already partially implemented fix in macOS for 'KPTI' Intel CPU security flaw . AppleInsider. [2018-01-03 ] . (原始内容存档 于2018-01-11) (美国英语) .