-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvm/clang crash in cspgo build #97962
Comments
gdb backtrace:
|
The crash is at the end of the function during stack check, so presumably the bug happened earlier. Maybe asan can help. |
Does not reproduce with llvmorg-18.1.8 (3b5b5c1) build from source |
Although, maybe clang itself wasn't build with stack smashing protection. |
Did not reproduce with llvmorg-18.1.6, so likely need extra fortification. |
Plain llvmorg-18.1.6 with -fstack-protector-all did not reproduce. |
llvmorg-18.1.6 with -fstack-protector-all and built with clang reproduces |
llvmorg-18.1.8 with -fstack-protector-all and built with clang reproduces |
main (7f3c40a) works |
# fixed: [7f3c40a] [libc] implement pathconf/fpathconf (#87165) |
@fpasserby looks like your commit f786881 fixed cs-pgo; can it be backported to 18.1? |
Looks like it's not intended as a fix but rather feature; so it fixed cs-pgo incidentally. |
Error: Command failed due to missing milestone. |
Error: Command failed due to missing milestone. |
Error: Command failed due to missing milestone. |
Cannot reproduce with 17.0.6: error: Error in reading profile /home/avi/scylla-maint/build/release-pgo/profiles/merged.profdata: unsupported instrumentation profile format version |
Without loading merged.profdata, clang 18.1.6 doesn't crash, so it may not be possible to bisect to find the patch that introduced the bug. |
Bisected to ffd337b is the first bad commit
@mtrofin any ideas how to fix this for 18.1.6? |
@mtrofin can you help here? clang 18.1 is broken with coroutines + pgo. |
@llvm/issue-subscribers-coroutines Author: Avi Kivity (avikivity)
```
FAILED: CMakeFiles/seastar.dir/src/rpc/rpc.cc.o
/usr/lib64/ccache/clang++ -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_DEFERRED_ACTION_REQUIRE_NOEXCEPT -DSEASTAR_HAS_MEMBARRIER -DSEASTAR_HAVE_ASAN_FIBER_SUPPORT -DSEASTAR_HAVE_HWLOC -DSEASTAR_HAVE_NUMA -DSEASTAR_HAVE_SYSTEMTAP_SDT -DSEASTAR_LOGGER_COMPILE_TIME_FMT -DSEASTAR_LOGGER_TYPE_STDOUT -DSEASTAR_PTHREAD_ATTR_SETAFFINITY_NP -DSEASTAR_SCHEDULING_GROUPS_COUNT=18 -DSEASTAR_SSTRING -DSEASTAR_STRERROR_R_CHAR_P -I/home/avi/scylla-maint/seastar/include -I/home/avi/scylla-maint/build/release-cs-pgo/seastar.lto/gen/include -I/home/avi/scylla-maint/build/release-cs-pgo/seastar.lto/gen/src -I/home/avi/scylla-maint/seastar/src -O2 -g -DNDEBUG -std=gnu++23 -U_FORTIFY_SOURCE -Werror=unused-result "-Wno-error=#warnings" -UNDEBUG -Wall -Werror -Wimplicit-fallthrough -Wdeprecated -Wno-error=deprecated -fvisibility=hidden -gz -flto=thin -ffile-prefix-map=/home/avi/scylla-maint=. -march=westmere -Wno-backend-plugin -fprofile-use=/home/avi/scylla-maint/build/release-pgo/profiles/merged.profdata -fcs-profile-generate=/home/avi/scylla-maint/build/release-cs-pgo -mllvm -pgso=false -mllvm -enable-value-profiling=false -MD -MT CMakeFiles/seastar.dir/src/rpc/rpc.cc.o -MF CMakeFiles/seastar.dir/src/rpc/rpc.cc.o.d -o CMakeFiles/seastar.dir/src/rpc/rpc.cc.o -c /home/avi/scylla-maint/seastar/src/rpc/rpc.cc
*** stack smashing detected ***: terminated
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: /usr/bin/clang++ -O2 -g -std=gnu++23 -Werror=unused-result -Wno-error=#warnings -Wall -Wimplicit-fallthrough -Wdeprecated -Wno-error=deprecated -fvisibility=hidden -gz -flto=thin -ffile-prefix-map=/home/avi/scylla-maint=. -march=westmere -Wno-backend-plugin -fprofile-use=/home/avi/scylla-maint/build/release-pgo/profiles/merged.profdata -fcs-profile-generate=/home/avi/scylla-maint/build/release-cs-pgo -mllvm -pgso=false -mllvm -enable-value-profiling=false -Werror -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_DEFERRED_ACTION_REQUIRE_NOEXCEPT -DSEASTAR_HAS_MEMBARRIER -DSEASTAR_HAVE_ASAN_FIBER_SUPPORT -DSEASTAR_HAVE_HWLOC -DSEASTAR_HAVE_NUMA -DSEASTAR_HAVE_SYSTEMTAP_SDT -DSEASTAR_LOGGER_COMPILE_TIME_FMT -DSEASTAR_LOGGER_TYPE_STDOUT -DSEASTAR_PTHREAD_ATTR_SETAFFINITY_NP -DSEASTAR_SCHEDULING_GROUPS_COUNT=18 -DSEASTAR_SSTRING -DSEASTAR_STRERROR_R_CHAR_P -I/home/avi/scylla-maint/seastar/include -I/home/avi/scylla-maint/build/release-cs-pgo/seastar.lto/gen/include -I/home/avi/scylla-maint/build/release-cs-pgo/seastar.lto/gen/src -I/home/avi/scylla-maint/seastar/src -DNDEBUG -U_FORTIFY_SOURCE -UNDEBUG -c -MD -MT CMakeFiles/seastar.dir/src/rpc/rpc.cc.o -MF CMakeFiles/seastar.dir/src/rpc/rpc.cc.o.d -fcolor-diagnostics -o CMakeFiles/seastar.dir/src/rpc/rpc.cc.o /home/avi/scylla-maint/seastar/src/rpc/rpc.cc
1. <eof> parser at end of file
2. Optimizer
#0 0x00007f9d0d8044fa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.18.1+0x6044fa)
#1 0x00007f9d0d801ce4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x601ce4)
#2 0x00007f9d0d736004 (/lib64/libLLVM.so.18.1+0x536004)
#3 0x00007f9d0cc4fd00 __restore_rt (/lib64/libc.so.6+0x40d00)
#4 0x00007f9d0cca84a4 __pthread_kill_implementation (/lib64/libc.so.6+0x994a4)
#5 0x00007f9d0cc4fc4e gsignal (/lib64/libc.so.6+0x40c4e)
#6 0x00007f9d0cc37902 abort (/lib64/libc.so.6+0x28902)
#7 0x00007f9d0cc38767 _IO_peekc_locked.cold (/lib64/libc.so.6+0x29767)
#8 0x00007f9d0cd36769 (/lib64/libc.so.6+0x127769)
#9 0x00007f9d0cd379e4 (/lib64/libc.so.6+0x1289e4)
#10 0x00007f9d0e7746a1 (/lib64/libLLVM.so.18.1+0x15746a1)
#11 0x00007f9d0e766f53 (/lib64/libLLVM.so.18.1+0x1566f53)
#12 0x00007f9d0e76545b llvm::PGOInstrumentationUse::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM.so.18.1+0x156545b)
#13 0x00007f9d10ff4bf1 (/lib64/libLLVM.so.18.1+0x3df4bf1)
#14 0x00007f9d0d9c8e5d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM.so.18.1+0x7c8e5d)
#15 0x00007f9d15c65092 (/lib64/libclang-cpp.so.18.1+0x1865092)
#16 0x00007f9d15c5c17e clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/lib64/libclang-cpp.so.18.1+0x185c17e)
#17 0x00007f9d1605a2a0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.18.1+0x1c5a2a0)
#18 0x00007f9d14974436 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18.1+0x574436)
#19 0x00007f9d16c1c9f6 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x281c9f6)
#20 0x00007f9d16b94700 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18.1+0x2794700)
#21 0x00007f9d16c99f65 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2899f65)
#22 0x00000000004144c6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /usr/src/debug/clang-18.1.6-3.fc40.x86_64/tools/driver/cc1_main.cpp:294:15
#23 0x0000000000411164 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /usr/src/debug/clang-18.1.6-3.fc40.x86_64/tools/driver/driver.cpp:365:12
#24 0x00007f9d167c5acd (/lib64/libclang-cpp.so.18.1+0x23c5acd)
#25 0x00007f9d0d735d44 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM.so.18.1+0x535d44)
#26 0x00007f9d167c5537 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.18.1+0x23c5537)
#27 0x00007f9d1678b297 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.18.1+0x238b297)
#28 0x00007f9d1678b4f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.18.1+0x238b4f7)
#29 0x00007f9d167a995e clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.18.1+0x23a995e)
#30 0x00000000004109bf clang_main(int, char**, llvm::ToolContext const&) /usr/src/debug/clang-18.1.6-3.fc40.x86_64/tools/driver/driver.cpp:540:21
#31 0x000000000041dcca main tools/driver/clang-driver.cpp:17:10
#32 0x00007f9d0cc39088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#33 0x00007f9d0cc3914b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#34 0x000000000040d8a5 _start (/usr/bin/clang+++0x40d8a5)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 18.1.6 (Fedora 18.1.6-3.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang++.cfg
clang++: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: [89/90] Building CXX object CMakeFiles/seastar.dir/src/core/reactor.cc.o
|
SetBranchWeights() calculates the size of the EdgeCounts vector using OutEdges.Size(), but this is an under-estimate with coroutines. Use the number of successors, as the vector will be indexed by the result of the GetSuccessorNumber() function. This crashes in 18.1, but somehow doesn't in main. Still, it looks like the fix is applicable to both. Fixes llvm#97962
SetBranchWeights() calculates the size of the EdgeCounts vector using OutEdges.Size(), but this is an under-estimate with coroutines. Use the number of successors, as the vector will be indexed by the result of the GetSuccessorNumber() function. Rename the Size local, to make it clear what it refers to. This crashes in 18.1, but somehow doesn't in main. Still, it looks like the fix is applicable to both. Fixes llvm#97962
SetBranchWeights() calculates the size of the EdgeCounts vector using OutEdges.Size(), but this is an under-estimate with coroutines. Use the number of successors, as the vector will be indexed by the result of the GetSuccessorNumber() function. Rename the Size local, to make it clear what it refers to. This crashes in 18.1, but somehow doesn't in main. Still, it looks like the fix is applicable to both. Fixes llvm#97962
SetBranchWeights() calculates the size of the EdgeCounts vector using OutEdges.Size(), but this is an under-estimate with coroutines. Use the number of successors, as the vector will be indexed by the result of the GetSuccessorNumber() function. Rename the Size local, to make it clear what it refers to. A unit test, provided by @ellishg, is included. Fixes llvm#97962 (regression from ffd337b)
SetBranchWeights() calculates the size of the EdgeCounts vector using OutEdges.Size(), but this is an under-estimate with coroutines. Use the number of successors, as the vector will be indexed by the result of the GetSuccessorNumber() function. Rename the Size local, to make it clear what it refers to. A unit test, provided by @ellishg, is included. Fixes llvm#97962 (regression from ffd337b)
The text was updated successfully, but these errors were encountered: