[PATCH] D51962: Initial Syringe Prototype

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 17:14:29 PDT 2018


paulkirth created this revision.
paulkirth added reviewers: phosek, aarongreen, mcgrathr.
Herald added subscribers: llvm-commits, jfb, dexonsmith, steven_wu, hiraditya, eraman, mgorny, mehdi_amini, srhines, emaste.
Herald added a reviewer: deadalnix.

This patch contains a simple prototype for Syringe, an LLVM based framework for behavior injection. The goal of this work is to allow developers to change how a program can behave at runtime by allowing them to dynamically change how targeted functions behave. We accomplish this by modifying a targeted function's body to make an indirect call through a runtime controlled implementation pointer, which can point to either the original function body or to an alternate function determined at compile time. This allows us to dynamically enable and disable different functionality as the program runs, without limiting the variety of new behaviors supported by our tool. We add new annotations to mark the targets for injection, and their alternate behaviors. Additionally, we support configuration through YAML files, to avoid changing existing source code. One nice aspect of our approach is that injection sites(targets for new behaviors), and injection payloads(the new behaviors) can exist in separate translation units, and have their interactions codified at link time. While Syringe is designed to be somewhat general, its main use case is for supporting out of production use for activities like dynamic fault injection.

See the RFC on CFE-dev for more information: http://lists.llvm.org/pipermail/cfe-dev/2018-September/059260.html


Repository:
  rL LLVM

https://reviews.llvm.org/D51962

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/Features.def
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/SyringeArgs.h
  clang/include/clang/Driver/ToolChain.h
  clang/include/clang/Frontend/CodeGenOptions.def
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CMakeLists.txt
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/SyringeArgs.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/ToolChains/Darwin.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/lib/Driver/ToolChains/OpenBSD.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/syringe-imbue.cpp
  clang/test/CodeGen/syringe-injection-site.cpp
  clang/test/CodeGen/syringe-inline-function.cpp
  clang/test/Sema/syringe-injection-site-attr.c
  clang/test/Sema/syringe-injection-site-attr.cpp
  clang/test/Sema/syringe-payload-attr.c
  clang/test/Sema/syringe-payload-attr.cpp
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/include/CMakeLists.txt
  compiler-rt/include/syringe/injection_data.h
  compiler-rt/include/syringe/syringe_rt.h
  compiler-rt/include/syringe/syringe_rt_cxx.h
  compiler-rt/lib/CMakeLists.txt
  compiler-rt/lib/syringe/CMakeLists.txt
  compiler-rt/lib/syringe/syringe_rt.cpp
  compiler-rt/lib/syringe/tests/CMakeLists.txt
  compiler-rt/lib/syringe/tests/unit/CMakeLists.txt
  compiler-rt/lib/syringe/tests/unit/syringe_registration_test.cc
  compiler-rt/lib/syringe/tests/unit/syringe_unit_test_main.cc
  llvm/include/llvm-c/Initialization.h
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/SyringeRecord.h
  llvm/include/llvm/Transforms/Syringe.h
  llvm/include/llvm/YAMLSyringeRecord.h
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLToken.h
  llvm/lib/Passes/LLVMBuild.txt
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/CMakeLists.txt
  llvm/lib/Transforms/LLVMBuild.txt
  llvm/lib/Transforms/Syringe/CMakeLists.txt
  llvm/lib/Transforms/Syringe/LLVMBuild.txt
  llvm/lib/Transforms/Syringe/Syringe.cpp
  llvm/tools/opt/CMakeLists.txt
  llvm/tools/opt/LLVMBuild.txt
  llvm/tools/opt/opt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51962.164966.patch
Type: text/x-patch
Size: 85671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180912/81fd4eb1/attachment.bin>


More information about the llvm-commits mailing list