[compiler-rt] [scudo] Update secondary cache time-based release logic (PR #107507)

Joshua Baehring via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 22:01:08 PDT 2024


================
@@ -334,9 +336,6 @@ class MapAllocatorCache {
       }
 
       insert(Entry);
----------------
JoshuaMBa wrote:

I had a look at the unit test failure and it looks like the DCHECK in `release()` fails. Looking at the code, it seems we may actually insert entries with time values of `0` at the from of the LRU list because of this code:
```
if (useMemoryTagging<Config>(Options)) {
      if (Interval == 0 && !SCUDO_FUCHSIA) {
        // Release the memory and make it inaccessible at the same time by
        // creating a new MAP_NOACCESS mapping on top of the existing mapping.
        // Fuchsia does not support replacing mappings by creating a new mapping
        // on top so we just do the two syscalls there.
        Entry.Time = 0;
        mapSecondary<Config>(Options, Entry.CommitBase, Entry.CommitSize,
                             Entry.CommitBase, MAP_NOACCESS, Entry.MemMap);
      } else {
        Entry.MemMap.setMemoryPermission(Entry.CommitBase, Entry.CommitSize,
                                         MAP_NOACCESS);
      }
    }
```
at the start of the `store()` function. Need to figure out if test failure occurs in an environment where MTE is enabled.

https://github.com/llvm/llvm-project/pull/107507


More information about the llvm-commits mailing list