[compiler-rt] d693957 - [scudo] Handle predefined M_MEMTAG_TUNING_* constants (NFC).
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 22 17:40:22 PDT 2021
Author: Evgenii Stepanov
Date: 2021-06-22T17:39:55-07:00
New Revision: d693957e58ff498dba7ef1d05c08849693abff35
URL: https://github.com/llvm/llvm-project/commit/d693957e58ff498dba7ef1d05c08849693abff35
DIFF: https://github.com/llvm/llvm-project/commit/d693957e58ff498dba7ef1d05c08849693abff35.diff
LOG: [scudo] Handle predefined M_MEMTAG_TUNING_* constants (NFC).
Bionic <malloc.h> may provide the definitions of M_MEMTAG_TUNING_* constants.
Do not redefine them in that case.
Differential Revision: https://reviews.llvm.org/D104758
Added:
Modified:
compiler-rt/lib/scudo/standalone/include/scudo/interface.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/include/scudo/interface.h b/compiler-rt/lib/scudo/standalone/include/scudo/interface.h
index 0e6cf3d4e254e..9b9a84623c516 100644
--- a/compiler-rt/lib/scudo/standalone/include/scudo/interface.h
+++ b/compiler-rt/lib/scudo/standalone/include/scudo/interface.h
@@ -120,7 +120,7 @@ size_t __scudo_get_ring_buffer_size();
// Tune the allocator's choice of memory tags to make it more likely that
// a certain class of memory errors will be detected. The value argument should
-// be one of the enumerators of the scudo_memtag_tuning enum below.
+// be one of the M_MEMTAG_TUNING_* constants below.
#ifndef M_MEMTAG_TUNING
#define M_MEMTAG_TUNING -102
#endif
@@ -145,13 +145,15 @@ size_t __scudo_get_ring_buffer_size();
#define M_TSDS_COUNT_MAX -202
#endif
-enum scudo_memtag_tuning {
- // Tune for buffer overflows.
- M_MEMTAG_TUNING_BUFFER_OVERFLOW,
+// Tune for buffer overflows.
+#ifndef M_MEMTAG_TUNING_BUFFER_OVERFLOW
+#define M_MEMTAG_TUNING_BUFFER_OVERFLOW 0
+#endif
- // Tune for use-after-free.
- M_MEMTAG_TUNING_UAF,
-};
+// Tune for use-after-free.
+#ifndef M_MEMTAG_TUNING_UAF
+#define M_MEMTAG_TUNING_UAF 1
+#endif
} // extern "C"
More information about the llvm-commits
mailing list