核心頁表隔離

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書

核心頁表隔離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) (美國英語). 

外部連結[編輯]