[llvm] [hwasan] Update dbg.assign intrinsics in HWAsan pass (PR #78606)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 09:48:21 PST 2024


gulfemsavrun wrote:

> I managed to reproduce it locally and have pushed a fixed patch [13c6f1e](https://github.com/llvm/llvm-project/commit/13c6f1ea2e7eb15fe492d8fca4fa1857c6f86370).
> 
> The issue was caused by using `getExpression()` rather than `getAddressExpression()` to get the expression to prepend (which is then used to set the address expression). I've updated the test `llvm/test/Instrumentation/HWAddressSanitizer/dbg-assign-tag-offset.ll` to check this doesn't happen.

Thanks for the fix, but it caused a new assertion error `((!Expr->isImplicit() || CanSplitValue) && "Expr can't be split"' failed.)`:
```
FAILED: libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj 
/b/s/w/ir/x/w/llvm_build/./bin/clang++ --target=aarch64-unknown-fuchsia --sysroot=/b/s/w/ir/x/w/sdk/arch/arm64/sysroot -DHAVE___CXA_THREAD_ATEXIT_IMPL -DLIBCXX_BUILDING_LIBCXXABI -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCXXABI_BUILDING_LIBRARY -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/s/w/ir/x/w/llvm-llvm-project/libunwind/include -I/b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/../libcxx/src -I/b/s/w/ir/x/w/llvm_build/include/aarch64-unknown-fuchsia/c++/v1 -I/b/s/w/ir/x/w/llvm_build/include/c++/v1 -I/b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/include --target=aarch64-unknown-fuchsia -I/b/s/w/ir/x/w/sdk/pkg/sync/include -I/b/s/w/ir/x/w/sdk/pkg/fdio/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -fsanitize=hwaddress -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-fuchsia+hwasan-bins=../../../llvm-llvm-project -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes  -O2 -g -DNDEBUG -std=c++2b -fPIC -nostdinc++ -fstrict-aliasing -funwind-tables -D_DEBUG -UNDEBUG -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -MD -MT libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj -MF libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj.d -o libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj -c /b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/src/private_typeinfo.cpp
clang++: llvm/lib/IR/DebugInfoMetadata.cpp:1968: static std::optional<DIExpression *> llvm::DIExpression::createFragmentExpression(const DIExpression *, unsigned int, unsigned int): Assertion `(!Expr->isImplicit() || CanSplitValue) && "Expr can't be split"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /b/s/w/ir/x/w/llvm_build/./bin/clang++ --target=aarch64-unknown-fuchsia --sysroot=/b/s/w/ir/x/w/sdk/arch/arm64/sysroot -DHAVE___CXA_THREAD_ATEXIT_IMPL -DLIBCXX_BUILDING_LIBCXXABI -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCXXABI_BUILDING_LIBRARY -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/s/w/ir/x/w/llvm-llvm-project/libunwind/include -I/b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/../libcxx/src -I/b/s/w/ir/x/w/llvm_build/include/aarch64-unknown-fuchsia/c++/v1 -I/b/s/w/ir/x/w/llvm_build/include/c++/v1 -I/b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/include --target=aarch64-unknown-fuchsia -I/b/s/w/ir/x/w/sdk/pkg/sync/include -I/b/s/w/ir/x/w/sdk/pkg/fdio/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -fsanitize=hwaddress -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-fuchsia+hwasan-bins=../../../llvm-llvm-project -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -O2 -g -DNDEBUG -std=c++2b -fPIC -nostdinc++ -fstrict-aliasing -funwind-tables -D_DEBUG -UNDEBUG -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -MD -MT libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj -MF libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj.d -o libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj -c /b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/src/private_typeinfo.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/src/private_typeinfo.cpp'.
4.	Running pass 'Assignment Tracking Analysis' on function '@_ZNK10__cxxabiv117__class_type_info9can_catchEPKNS_16__shim_type_infoERPv'
#0 0x0000561d3a3a0b78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/b/s/w/ir/x/w/llvm_build/./bin/clang+++0x8743b78)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Fuchsia clang version 18.0.0git (https://llvm.googlesource.com/llvm-project 5daf674feba0f57b083113ad7ed486cad433a916)
Target: aarch64-unknown-fuchsia
Thread model: posix
InstalledDir: /b/s/w/ir/x/w/llvm_build/./bin
clang++: note: diagnostic msg: 
********************
```

https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8758111613576762817/+/u/clang/build/stdout

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


More information about the llvm-commits mailing list