summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/gwp_asan/definitions.h
diff options
context:
space:
mode:
authorMitch Phillips <mitchphillips@outlook.com>2019-06-05 19:42:48 +0000
committerMitch Phillips <mitchphillips@outlook.com>2019-06-05 19:42:48 +0000
commita95edb9dc1ddaf70761e8c90be175f144a28f757 (patch)
tree761ec281cfe5593c2aebb5a9c0bb8bfca65ce115 /compiler-rt/lib/gwp_asan/definitions.h
parent036fa5346f2d2f2432e1c70242f17c270e040fc6 (diff)
downloadbcm5719-llvm-a95edb9dc1ddaf70761e8c90be175f144a28f757.tar.gz
bcm5719-llvm-a95edb9dc1ddaf70761e8c90be175f144a28f757.zip
[GWP-ASan] Core Guarded Pool Allocator [4].
Summary: See D60593 for further information. This patch introduces the core of GWP-ASan, being the guarded pool allocator. This class contains the logic for creating and maintaining allocations in the guarded pool. Its public interface is to be utilised by supporting allocators in order to provide sampled guarded allocation behaviour. This patch also contains basic functionality tests of the allocator as unittests. The error-catching behaviour will be tested in upcoming patches that use Scudo as an implementing allocator. Reviewers: vlad.tsyrklevich, eugenis, jfb Reviewed By: vlad.tsyrklevich Subscribers: dexonsmith, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits, morehouse Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D62872 llvm-svn: 362636
Diffstat (limited to 'compiler-rt/lib/gwp_asan/definitions.h')
-rw-r--r--compiler-rt/lib/gwp_asan/definitions.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/compiler-rt/lib/gwp_asan/definitions.h b/compiler-rt/lib/gwp_asan/definitions.h
new file mode 100644
index 00000000000..1190adbd4f4
--- /dev/null
+++ b/compiler-rt/lib/gwp_asan/definitions.h
@@ -0,0 +1,29 @@
+//===-- gwp_asan_definitions.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef GWP_ASAN_DEFINITIONS_H_
+#define GWP_ASAN_DEFINITIONS_H_
+
+#define TLS_INITIAL_EXEC __thread __attribute__((tls_model("initial-exec")))
+
+#ifdef LIKELY
+# undef LIKELY
+#endif // defined(LIKELY)
+#define LIKELY(X) __builtin_expect(!!(X), 1)
+
+#ifdef UNLIKELY
+# undef UNLIKELY
+#endif // defined(UNLIKELY)
+#define UNLIKELY(X) __builtin_expect(!!(X), 0)
+
+#ifdef ALWAYS_INLINE
+# undef ALWAYS_INLINE
+#endif // defined(ALWAYS_INLINE)
+#define ALWAYS_INLINE inline __attribute__((always_inline))
+
+#endif // GWP_ASAN_DEFINITIONS_H_
OpenPOWER on IntegriCloud