[compiler-rt] ed552f2 - [scudo] Disable OddEvenTags by default.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 16:37:14 PDT 2023


Author: Evgenii Stepanov
Date: 2023-06-15T16:36:27-07:00
New Revision: ed552f2151ac33b8ad6eedd6fda3545ce2220e8d

URL: https://github.com/llvm/llvm-project/commit/ed552f2151ac33b8ad6eedd6fda3545ce2220e8d
DIFF: https://github.com/llvm/llvm-project/commit/ed552f2151ac33b8ad6eedd6fda3545ce2220e8d.diff

LOG: [scudo] Disable OddEvenTags by default.

Scudo has zero-tagged headers between any two allocation that will catch
a linear buffer overflow of up to 16 bytes. OddEvenTags extends this
guarantee to one chunk of the given SizeClass at the cost of the reduced
entropy for all heap tags (i.e. lower chance to catch use-after-free and
large overflows).

Given that the first 16 bytes are already deterministic, I feel this is
a bad tradeoff.

Differential Revision: https://reviews.llvm.org/D152984

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/combined.h
    compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index e3ec72d4ea1e1..06ed28221eb19 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -166,7 +166,6 @@ class Allocator {
     if (allocatorSupportsMemoryTagging<Config>() &&
         systemSupportsMemoryTagging())
       Primary.Options.set(OptionBit::UseMemoryTagging);
-    Primary.Options.set(OptionBit::UseOddEvenTags);
 
     QuarantineMaxChunkSize =
         static_cast<u32>(getFlags()->quarantine_max_chunk_size);

diff  --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index a4916d0ba027e..c129198918b09 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -641,6 +641,7 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, ReleaseToOS) {
 
 SCUDO_TYPED_TEST(ScudoCombinedTest, OddEven) {
   auto *Allocator = this->Allocator.get();
+  Allocator->setOption(scudo::Option::MemtagTuning, M_MEMTAG_TUNING_BUFFER_OVERFLOW);
 
   if (!Allocator->useMemoryTaggingTestOnly())
     return;


        


More information about the llvm-commits mailing list