[PATCH] D56373: Support X86 CET (Control-flow Enforcement Technology) in LLD

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 6 17:53:38 PST 2019


xiangzhangllvm created this revision.
xiangzhangllvm added reviewers: hjl.tools, LuoYuanke, craig.topper, vzakhari, annita.zhang, smaslov.
xiangzhangllvm added a project: lld.
Herald added subscribers: llvm-commits, MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.

Control-flow Enforcement Technology (CET)
provides the following capabilities to defend against ROP/JOP style control-flow subversion attacks:  
Shadow Stack (SHSTK) – return address protection to defend against Return Oriented Programming, 
Indirect branch tracking (IBT) – free branch protection to defend against Jump/Call Oriented Programming.

The key implement of the feature in LLD:
The flags of SHSTK and IBT will be set at the GNU_PROPERTY_X86_FEATURE_1_AND related structure in .note.gnu.property section if the CET is enabled.
The LLD will first check if all the relocatable object files contain the GNU_PROPERTY_X86_FEATURE_1_AND related structure.
Then to create the GNU_PROPERTY_X86_FEATURE_1_AND related section in output file or not.
It is the OS and hardware to check these flags in the related segment, and run the features or not.
Because of the IBT feature need to insert a endbr* instruction at the end of indirect jump. So we also deal with the Lazy binding in the LLD by adding a second PLT.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D56373

Files:
  ELF/Arch/X86.cpp
  ELF/Arch/X86_64.cpp
  ELF/Config.h
  ELF/Driver.cpp
  ELF/Driver.h
  ELF/InputSection.cpp
  ELF/InputSection.h
  ELF/Relocations.cpp
  ELF/Symbols.cpp
  ELF/Symbols.h
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h
  ELF/Target.h
  ELF/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56373.180423.patch
Type: text/x-patch
Size: 37857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190107/b94c6ab3/attachment.bin>


More information about the llvm-commits mailing list