Skip to content
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

Change raised signal from SIGPROT to SIGSEGV when indexing outside the ddc bound on a hybrid binary #2143

Open
gcjenkinson opened this issue Jul 8, 2024 · 0 comments · May be fixed by #2145

Comments

@gcjenkinson
Copy link

On compiling Chromium's blink renderer the following signal is thrown as a result of an underlying bug in llvm. Analysing the core file shows that the protection fault is a result of indexing outside of the bounds of the ddc:

Core was generated by `/usr/local64/llvm-morello/bin/clang++ -march=morello -mabi=purecap -Xclang -more'.
Program terminated with signal SIGPROT, CHERI protection violation.
Capability bounds fault.
#0  0x000000008a475030 in llvm::APInt::andAssignSlowCase(llvm::APInt const&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
(gdb) bt
#0  0x000000008a475030 in llvm::APInt::andAssignSlowCase(llvm::APInt const&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#1  0x000000008a4e3208 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#2  0x000000008ac36b90 in llvm::SelectionDAG::computeKnownBits(llvm::SDValue, llvm::APInt const&, unsigned int) const () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#3  0x000000008ac82720 in llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&, llvm::APInt const&, llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&, unsigned int, bool) const ()
   from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#4  0x000000008ac7ff80 in llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&, llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&, unsigned int, bool) const ()
   from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#5  0x000000008ab249d8 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#6  0x000000008ab23908 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#7  0x000000008ab21790 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#8  0x000000008aaef384 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#9  0x000000008aaed8d8 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#10 0x000000008aaec7d8 in ?? () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#11 0x000000008aaeb118 in llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOpt::Level) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#12 0x000000008ac6ac38 in llvm::SelectionDAGISel::CodeGenAndEmitDAG() () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#13 0x000000008ac6a66c in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#14 0x000000008ac68bac in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#15 0x000000008a8b2930 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#16 0x000000008a6a8f7c in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#17 0x000000008a6ae710 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#18 0x000000008a6a9520 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#19 0x00000000879ebc24 in clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream> >) () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#20 0x0000000087c85d34 in ?? () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#21 0x0000000086c93c24 in clang::ParseAST(clang::Sema&, bool, bool) () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#22 0x00000000884c0db0 in clang::FrontendAction::Execute() () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#23 0x0000000088445228 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#24 0x000000008852cad4 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#25 0x0000000000220df8 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ()
#26 0x000000000021f2d0 in ?? ()
#27 0x000000008818b224 in ?? () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#28 0x000000008a4a67bc in llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) () from /usr/local64/llvm-morello/bin/../lib/libLLVM-14git.so
#29 0x000000008818acbc in clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const ()
   from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#30 0x0000000088162434 in clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#31 0x00000000881627b0 in clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#32 0x0000000088175030 in clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) () from /usr/local64/llvm-morello/bin/../lib/libclang-cpp.so.14git
#33 0x000000000021ec44 in main ()
(gdb) x/i $pc
=> 0x8a475030 <_ZN4llvm5APInt17andAssignSlowCaseERKS0_+140>:	ldr	x11, [x9], #8
(gdb) p $x9
$1 = -1
(gdb) p $ddc
$2 = (__capability ) 0x0 [rwRW,0x0-0x1000000000000]

In these circumstances raising a bounds fault is confusing and inconsistent with other conditions. Changing the raised signal to SIGSEGV would be more consistent and be less likely to cause confusion for consumers of the signal.

@bsdjhb bsdjhb linked a pull request Jul 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant