OSDN Git Service

[X86] Added support for nocf_check attribute for indirect Branch Tracking
authorOren Ben Simhon <oren.ben.simhon@intel.com>
Sat, 17 Mar 2018 13:29:46 +0000 (13:29 +0000)
committerOren Ben Simhon <oren.ben.simhon@intel.com>
Sat, 17 Mar 2018 13:29:46 +0000 (13:29 +0000)
commit10c992c085d6e52c843bdc51c56cfcddcdb5611f
treeff7ccad02f5730484d3ed5ecdcd07eca754a3095
parent0c44305d76dfe1fac9cf1b1c9a08ce23a22cfe87
[X86] Added support for nocf_check attribute for indirect Branch Tracking

X86 Supports Indirect Branch Tracking (IBT) as part of Control-Flow Enforcement Technology (CET).
IBT instruments ENDBR instructions used to specify valid targets of indirect call / jmp.
TheĀ `nocf_check` attribute has two roles in the context of X86 IBT technology:
1. Appertains to a function - do not add ENDBR instruction at the beginning of the function.
2. Appertains to a function pointer - do not track the target function of this pointer by adding nocf_check prefix to the indirect-call instruction.

This patch implementsĀ `nocf_check` context for Indirect Branch Tracking.
It also auto generatesĀ `nocf_check` prefixes before indirect branchs to jump tables that are guarded by range checks.

Differential Revision: https://reviews.llvm.org/D41879

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327767 91177308-0d34-0410-b5e6-96231b3b80d8
34 files changed:
bindings/go/llvm/ir_test.go
docs/BitCodeFormat.rst
docs/LangRef.rst
include/llvm/Bitcode/LLVMBitCodes.h
include/llvm/CodeGen/TargetLowering.h
include/llvm/IR/Attributes.td
include/llvm/IR/Function.h
include/llvm/IR/Instructions.h
lib/AsmParser/LLLexer.cpp
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLToken.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/IR/Attributes.cpp
lib/IR/Verifier.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp
lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
lib/Target/X86/MCTargetDesc/X86BaseInfo.h
lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
lib/Target/X86/X86FastISel.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86IndirectBranchTracking.cpp
lib/Target/X86/X86InstrControl.td
lib/Target/X86/X86InstrFormats.td
lib/Target/X86/X86InstrInfo.td
lib/Transforms/IPO/ForceFunctionAttrs.cpp
lib/Transforms/Utils/CodeExtractor.cpp
test/CodeGen/X86/indirect-branch-tracking.ll
test/CodeGen/X86/nocf_check.ll [new file with mode: 0644]
test/MC/X86/x86-32-coverage.s
utils/TableGen/X86FoldTablesEmitter.cpp