[llvm] f511dc7 - [asan] Add an offset for the kernel address sanitizer on FreeBSD
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 15 09:49:15 PDT 2021
Author: Mark Johnston
Date: 2021-04-15T17:49:00+01:00
New Revision: f511dc75e4c130abda77a30299402abaf04d8238
URL: https://github.com/llvm/llvm-project/commit/f511dc75e4c130abda77a30299402abaf04d8238
DIFF: https://github.com/llvm/llvm-project/commit/f511dc75e4c130abda77a30299402abaf04d8238.diff
LOG: [asan] Add an offset for the kernel address sanitizer on FreeBSD
This is based on a port of the sanitizer runtime to the FreeBSD kernel
that has been commited as https://cgit.freebsd.org/src/commit/?id=38da497a4dfcf1979c8c2b0e9f3fa0564035c147
and the following commits.
Reviewed By: emaste, dim
Differential Revision: https://reviews.llvm.org/D98285
Added:
Modified:
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index c0ac9a999b9ea..94e43c57b5da6 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -108,6 +108,7 @@ static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36;
static const uint64_t kRISCV64_ShadowOffset64 = 0xd55550000;
static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30;
static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46;
+static const uint64_t kFreeBSDKasan_ShadowOffset64 = 0xdffff7c000000000;
static const uint64_t kNetBSD_ShadowOffset32 = 1ULL << 30;
static const uint64_t kNetBSD_ShadowOffset64 = 1ULL << 46;
static const uint64_t kNetBSDKasan_ShadowOffset64 = 0xdfff900000000000;
@@ -493,9 +494,12 @@ static ShadowMapping getShadowMapping(Triple &TargetTriple, int LongSize,
Mapping.Offset = kPPC64_ShadowOffset64;
else if (IsSystemZ)
Mapping.Offset = kSystemZ_ShadowOffset64;
- else if (IsFreeBSD && !IsMIPS64)
- Mapping.Offset = kFreeBSD_ShadowOffset64;
- else if (IsNetBSD) {
+ else if (IsFreeBSD && !IsMIPS64) {
+ if (IsKasan)
+ Mapping.Offset = kFreeBSDKasan_ShadowOffset64;
+ else
+ Mapping.Offset = kFreeBSD_ShadowOffset64;
+ } else if (IsNetBSD) {
if (IsKasan)
Mapping.Offset = kNetBSDKasan_ShadowOffset64;
else
More information about the llvm-commits
mailing list