Details
- Reviewers
pcc - Commits
- rG533abb7ecf1c: [scudo] Enabled MTE before the first allocator
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/scudo/standalone/allocator_config.h | ||
---|---|---|
85 | So the only difference with DefaultConfig is that this is true? Maybe we should just turn it on in DefaultConfig. | |
compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp | ||
37 | This is presumably because some ctor linked to ScudoCUnitTest or ScudoCxxUnitTest is calling the allocator, correct? This needs a comment. |
LGTM
compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp | ||
---|---|---|
37 | "The wrapper tests initialize the global allocator early, before main(). We need to have Memory Tagging enabled before that happens or the allocator will disable the feature entirely." |
Hi, when i using cross-build in x86 machine, i found an build error:
/usr/bin/aarch64-linux-gnu-g++ -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/scudo/standalone -I/llvm-project/compiler-rt/lib/scudo/standalone -Iinclude -I/llvm-project/llvm/include -I/llvm-project/compiler-rt/lib/scudo/standalone/../.. -I/llvm-project/compiler-rt/lib/scudo/standalone/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG -march=armv8-a -fno-lto -Werror=conversion -Wall -g -nostdinc++ -fvisibility=hidden -fno-exceptions -Wno-pedantic -fno-lto -O3 -DGWP_ASAN_HOOKS -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -std=c++14 -MD -MT projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone_cxx-aarch64.dir/wrappers_cpp.cpp.o -MF projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone_cxx-aarch64.dir/wrappers_cpp.cpp.o.d -o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone_cxx-aarch64.dir/wrappers_cpp.cpp.o -c /llvm-project/compiler-rt/lib/scudo/standalone/wrappers_cpp.cp
01:20:30 /tmp/cc8oDmob.s: Assembler messages:
01:20:30 /tmp/cc8oDmob.s:582: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:610: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:618: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:628: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:925: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:953: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:961: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:971: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:1829: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:1857: Error: unknown mnemonic stzg' -- stzg x1,[x1],#16'
01:20:30 /tmp/cc8oDmob.s:1865: Error: unknown or missing operation name at operand 1 -- `dc gzva,x1'
01:20:30 /tmp/cc8oDmob.s:1875: Error: unknown mnemonic stzg' -- stzg x1,[x1],#16'
01:20:30 /tmp/cc8oDmob.s:1950: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:1978: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:1986: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:1996: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:2026: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:2054: Error: unknown mnemonic stzg' -- stzg x1,[x1],#16'
01:20:30 /tmp/cc8oDmob.s:2062: Error: unknown or missing operation name at operand 1 -- `dc gzva,x1'
01:20:30 /tmp/cc8oDmob.s:2072: Error: unknown mnemonic stzg' -- stzg x1,[x1],#16'
01:20:30 /tmp/cc8oDmob.s:14161: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14161: Error: unknown mnemonic stg' -- stg x0,[x0]'
01:20:30 /tmp/cc8oDmob.s:14176: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14176: Error: unknown mnemonic irg' -- irg x22,x25,x22'
01:20:30 /tmp/cc8oDmob.s:14193: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14221: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:14229: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:14239: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:14271: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14271: Error: unknown mnemonic stg' -- stg x1,[x1]'
01:20:30 /tmp/cc8oDmob.s:14375: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14375: Error: unknown mnemonic ldg' -- ldg x8,[x8]'
01:20:30 /tmp/cc8oDmob.s:14429: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14429: Error: unknown mnemonic ldg' -- ldg x1,[x1]'
01:20:30 /tmp/cc8oDmob.s:14502: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14502: Error: unknown mnemonic stg' -- stg x1,[x1]'
01:20:30 /tmp/cc8oDmob.s:14631: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:14659: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:14667: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:14677: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:17421: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:17421: Error: unknown mnemonic irg' -- irg x0,x20,x0'
01:20:30 /tmp/cc8oDmob.s:17437: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:17465: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:17473: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:17483: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:17799: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:17827: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:17835: Error: unknown or missing operation name at operand 1 -- `dc gzva,x0'
01:20:30 /tmp/cc8oDmob.s:17845: Error: unknown mnemonic stzg' -- stzg x0,[x0],#16'
01:20:30 /tmp/cc8oDmob.s:18248: Error: unknown architectural extension `memtag'
01:20:30 /tmp/cc8oDmob.s:18276: Error: unknown mnemonic stzg' -- stzg x1,[x1],#16'
01:20:30 /tmp/cc8oDmob.s:18284: Error: unknown or missing operation name at operand 1 -- `dc gzva,x1'
01:20:30 /tmp/cc8oDmob.s:18294: Error: unknown mnemonic stzg' -- stzg x1,[x1],#16'
This is a known issue with the use of MTE instructions in memtag.h -- they should really be conditional on whether the assembler supports them. For now, please upgrade your assembler.
How to update assembly, I build it on a x86 machine.
And, should it be better to be conditional in Makefiles to chose which instructions it produce?
Maybe memtag..h till someone volunteer to fix MTE for GCC?
#if clang_major >= 12 && (defined(aarch64) || defined(SCUDO_FUZZ))
Yeah, that should be good enough for now. It won't cover users who have the integrated assembler disabled, but it's better than nothing.
So the only difference with DefaultConfig is that this is true? Maybe we should just turn it on in DefaultConfig.