summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/ubsan/ubsan_handlers.h
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-01-15 09:44:27 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-01-15 09:44:27 +0000
commita06ad18669f85b21df9ce9e4847c4b899692fb9b (patch)
treed2127fee7afa9d728cac2b5a8373b7ccb00200c0 /compiler-rt/lib/ubsan/ubsan_handlers.h
parentbd1c0870198e025f92d31eead0fb2019c4057a4a (diff)
downloadbcm5719-llvm-a06ad18669f85b21df9ce9e4847c4b899692fb9b.tar.gz
bcm5719-llvm-a06ad18669f85b21df9ce9e4847c4b899692fb9b.zip
[compiler-rt][UBSan] Sanitization for alignment assumptions.
Summary: This is the compiler-rt part. The clang part is D54589. This is a second commit, the original one was r351106, which was mass-reverted in r351159 because 2 compiler-rt tests were failing. Now, i have fundamentally changed the testing approach: i malloc a few bytes, intentionally mis-align the pointer (increment it by one), and check that. Also, i have decreased the expected alignment. This hopefully should be enough to pacify all the bots. If not, i guess i might just drop the two 'bad' tests. Reviewers: filcab, vsk, #sanitizers, vitalybuka, rsmith, morehouse Reviewed By: morehouse Subscribers: rjmccall, krytarowski, rsmith, kcc, srhines, kubamracek, dberris, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54590 llvm-svn: 351178
Diffstat (limited to 'compiler-rt/lib/ubsan/ubsan_handlers.h')
-rw-r--r--compiler-rt/lib/ubsan/ubsan_handlers.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_handlers.h b/compiler-rt/lib/ubsan/ubsan_handlers.h
index 04405770e58..2bf9ff4320e 100644
--- a/compiler-rt/lib/ubsan/ubsan_handlers.h
+++ b/compiler-rt/lib/ubsan/ubsan_handlers.h
@@ -39,6 +39,17 @@ struct TypeMismatchData {
/// type.
RECOVERABLE(type_mismatch_v1, TypeMismatchData *Data, ValueHandle Pointer)
+struct AlignmentAssumptionData {
+ SourceLocation Loc;
+ SourceLocation AssumptionLoc;
+ const TypeDescriptor &Type;
+};
+
+/// \brief Handle a runtime alignment assumption check failure,
+/// caused by a misaligned pointer.
+RECOVERABLE(alignment_assumption, AlignmentAssumptionData *Data,
+ ValueHandle Pointer, ValueHandle Alignment, ValueHandle Offset)
+
struct OverflowData {
SourceLocation Loc;
const TypeDescriptor &Type;
OpenPOWER on IntegriCloud