summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-23 18:07:56 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-23 18:07:56 +0000
commita2002b08f7bd0e165a14a91322acf917bb6c52ea (patch)
tree4c769bbd2e49b5618af12131e59539102908680a /llvm/include
parentb14ecd34f73d8d5414dd6705d0d365eb873889ab (diff)
downloadbcm5719-llvm-a2002b08f7bd0e165a14a91322acf917bb6c52ea.tar.gz
bcm5719-llvm-a2002b08f7bd0e165a14a91322acf917bb6c52ea.zip
Android support for SafeStack.
Add two new ways of accessing the unsafe stack pointer: * At a fixed offset from the thread TLS base. This is very similar to StackProtector cookies, but we plan to extend it to other backends (ARM in particular) soon. Bionic-side implementation here: https://android-review.googlesource.com/170988. * Via a function call, as a fallback for platforms that provide neither a fixed TLS slot, nor a reasonable TLS implementation (i.e. not emutls). This is a re-commit of a change in r248357 that was reverted in r248358. llvm-svn: 248405
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Target/TargetLowering.h8
-rw-r--r--llvm/include/llvm/Transforms/Instrumentation.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h
index caf28d2b118..64e0ee55030 100644
--- a/llvm/include/llvm/Target/TargetLowering.h
+++ b/llvm/include/llvm/Target/TargetLowering.h
@@ -995,6 +995,14 @@ public:
return false;
}
+ /// Return true if the target stores SafeStack pointer at a fixed offset in
+ /// some non-standard address space, and populates the address space and
+ /// offset as appropriate.
+ virtual bool getSafeStackPointerLocation(unsigned & /*AddressSpace*/,
+ unsigned & /*Offset*/) const {
+ return false;
+ }
+
/// Returns true if a cast between SrcAS and DestAS is a noop.
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const {
return false;
diff --git a/llvm/include/llvm/Transforms/Instrumentation.h b/llvm/include/llvm/Transforms/Instrumentation.h
index da4c0782cb9..cfe6b432895 100644
--- a/llvm/include/llvm/Transforms/Instrumentation.h
+++ b/llvm/include/llvm/Transforms/Instrumentation.h
@@ -34,6 +34,8 @@ inline void *getDFSanRetValTLSPtrForJIT() {
namespace llvm {
+class TargetMachine;
+
/// Instrumentation passes often insert conditional checks into entry blocks.
/// Call this function before splitting the entry block to move instructions
/// that must remain in the entry block up before the split point. Static
@@ -143,7 +145,7 @@ FunctionPass *createBoundsCheckingPass();
/// \brief This pass splits the stack into a safe stack and an unsafe stack to
/// protect against stack-based overflow vulnerabilities.
-FunctionPass *createSafeStackPass();
+FunctionPass *createSafeStackPass(const TargetMachine *TM = nullptr);
} // End llvm namespace
OpenPOWER on IntegriCloud