This allows to avoid memset in workaround
of QEMU-user implementation of MADV_DONTNEED.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/scudo/standalone/linux.cpp | ||
---|---|---|
171 | Looks like Data is still UNUSED | |
compiler-rt/lib/scudo/standalone/secondary.h | ||
156 ↗ | (On Diff #347236) | Maybe move that up a block since it's common to the if & else |
compiler-rt/lib/scudo/standalone/tests/common_test.cpp | ||
1 | There is a misalignment of - compared to the bottom one. Not sure which one has the right count. | |
18–20 | Can this be put in SCUDO_LINUX block and a UNREACHABLE or equivalent for other systems? | |
37 | = {}; |
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
270 ↗ | (On Diff #347276) | More descriptive defaults: MAP_ALLOWNOMEM | MAP_RESIZABLE? |
357 ↗ | (On Diff #347276) | MTE mode can change at runtime after initLinkerInitialized is called, so we do need to re-check useMemoryTagging<>() every time we allocate. Maybe call the member PersistentMapFlags (i.e. it persists across the allocator and is once-init), and add a member getMapFlags() that returns PersistentMapFlags | (useMemoryTagging<>() ? MAP_MEMTAG : 0). |
TBH, I'm not sure it's worth going to this much effort to work around this QEMU bug. It seems better to figure out a way to use QEMU in system mode instead.
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
358 ↗ | (On Diff #347276) | This will continue to create mappings with PROT_MTE after MTE is disabled. |
compiler-rt/lib/scudo/standalone/secondary.h | ||
385 ↗ | (On Diff #347276) | This will break the split mapping of MTE enabled secondary allocations. The first few pages need to have MTE enabled and the rest have MTE disabled. |
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
270 ↗ | (On Diff #347276) | Initialize to 0 so that the combined allocator remains in bss. |
This does not looks like a lot of work to maintain this, but I propose to threat this as default behavior D102980.
Let's chat about if we need QEMU-user later today.
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
270 ↗ | (On Diff #347276) | I replaced with function which will return flags. |
357 ↗ | (On Diff #347276) | Actually missed this point, and tried to keep same protection. |
compiler-rt/lib/scudo/standalone/secondary.h | ||
385 ↗ | (On Diff #347276) | Thanks, I missed this one. Seems easy to fix. |
clang-tidy: error: use of undeclared identifier 'PROT_MTE' [clang-diagnostic-error]
not useful