[PATCH] D105971: [hwasan] Split argument logic into functions.
Florian Mayer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 14 04:55:17 PDT 2021
fmayer created this revision.
Herald added a subscriber: hiraditya.
fmayer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105971
Files:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -192,6 +192,24 @@
namespace {
+bool shouldUsePageAliases(const Triple &TargetTriple) {
+ return ClUsePageAliases && TargetTriple.getArch() == Triple::x86_64;
+// No one should use the option directly.
+#pragma GCC poison ClUsePageAliases
+}
+
+bool shouldInstrumentStack(const Triple &TargetTriple) {
+ return shouldUsePageAliases(TargetTriple) ? false : ClInstrumentStack;
+// No one should use the option directly.
+#pragma GCC poison ClInstrumentStack
+}
+
+bool shouldInstrumentWithCalls(const Triple& TargetTriple) {
+ return ClInstrumentWithCalls && TargetTriple.getArch() == Triple::x86_64;
+// No one should use the option directly.
+#pragma GCC poison ClInstrumetnWithCalls
+}
+
/// An instrumentation pass implementing detection of addressability bugs
/// using tagged pointers.
class HWAddressSanitizer {
@@ -503,9 +521,9 @@
// - Intel LAM (default)
// - pointer aliasing (heap only)
bool IsX86_64 = TargetTriple.getArch() == Triple::x86_64;
- UsePageAliases = ClUsePageAliases && IsX86_64;
- InstrumentWithCalls = IsX86_64 ? true : ClInstrumentWithCalls;
- InstrumentStack = UsePageAliases ? false : ClInstrumentStack;
+ UsePageAliases = shouldUsePageAliases(TargetTriple);
+ InstrumentWithCalls = shouldInstrumentWithCalls(TargetTriple);
+ InstrumentStack = shouldInstrumentStack(TargetTriple);
PointerTagShift = IsX86_64 ? 57 : 56;
TagMaskByte = IsX86_64 ? 0x3F : 0xFF;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105971.358562.patch
Type: text/x-patch
Size: 1681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210714/a30a3dc4/attachment.bin>
More information about the llvm-commits
mailing list