This is an archive of the discontinued LLVM Phabricator instance.

[asan] Block signals when starting threads
ClosedPublic

Authored by vitalybuka on Jul 26 2023, 1:02 AM.

Details

Summary

Async signals may crash the process if AsanThread is not fully
initialized. We do the same for other sanitizers already.

Can't have good reproducer for test. We see this in internal test with prob 1e-6.

Diff Detail

Event Timeline

vitalybuka created this revision.Jul 26 2023, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2023, 1:02 AM
Herald added a subscriber: Enna1. · View Herald Transcript
vitalybuka requested review of this revision.Jul 26 2023, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2023, 1:02 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
kstoimenov accepted this revision.Jul 26 2023, 9:50 AM
This revision is now accepted and ready to land.Jul 26 2023, 9:50 AM
vitalybuka edited the summary of this revision. (Show Details)Jul 26 2023, 1:03 PM
This revision was landed with ongoing or failed builds.Jul 26 2023, 1:03 PM
This revision was automatically updated to reflect the committed changes.
phosek added a subscriber: phosek.Jul 26 2023, 3:56 PM

This broke our macOS builders, would it be possible to fix forward or revert?

/opt/s/w/ir/x/w/llvm_build/./bin/clang++ --target=x86_64-apple-darwin20.6.0 --sysroot=/opt/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -DASAN_DYNAMIC=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/opt/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/asan/.. -fPIC -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 -fdiagnostics-color -ffile-prefix-map=/opt/s/w/ir/x/w/llvm_build/runtimes/runtimes-bins=../llvm_build/runtimes/runtimes-bins -ffile-prefix-map=/opt/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -Wall -Wno-unused-parameter -O3 -DNDEBUG -std=c++17 -arch arm64 -arch x86_64 -isysroot /opt/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -stdlib=libc++ -mmacosx-version-min=10.10 -isysroot /opt/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -g -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -nostdinc++ -fno-rtti -Wno-format -ftls-model=initial-exec -MD -MT compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_interceptors.cpp.o -MF compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_interceptors.cpp.o.d -o compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_interceptors.cpp.o -c /opt/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp
/opt/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:229:3: error: use of undeclared identifier 'SetSigProcMask'
  229 |   SetSigProcMask(&sigset, nullptr);
      |   ^
/opt/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:252:3: error: unknown type name 'ScopedBlockSignals'
  252 |   ScopedBlockSignals block(&sigset);
      |   ^
2 errors generated.