[PATCH] D108478: [llvm][IR] Add no_cfi constant

Sami Tolvanen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 11:58:24 PDT 2021


samitolvanen created this revision.
Herald added subscribers: ormris, dexonsmith, jdoerfert, pengfei, steven_wu, hiraditya.
samitolvanen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

With Control-Flow Integrity (CFI), the LowerTypeTests pass replaces
function references with CFI jump table references, which is a problem
for low-level code that needs the address of the actual function body.

For example, in the Linux kernel, the code that sets up interrupt
handlers needs to take the address of the interrupt handler function
instead of the CFI jump table, as the jump table may not even be mapped
into memory when an interrupt is triggered.

This change adds the no_cfi constant type, which wraps function
references in a value that LowerTypeTestsModule::replaceCfiUses does not
replace.

Link: https://github.com/ClangBuiltLinux/linux/issues/1353


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108478

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/AsmParser/LLParser.h
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/IR/Constants.h
  llvm/include/llvm/IR/Value.def
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/Utils/ValueMapper.cpp
  llvm/test/Bitcode/nocfivalue.ll
  llvm/test/CodeGen/X86/nocfivalue.ll
  llvm/test/Transforms/LowerTypeTests/nocfivalue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108478.367849.patch
Type: text/x-patch
Size: 17282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210820/7b4b7a48/attachment.bin>


More information about the llvm-commits mailing list