This is an archive of the discontinued LLVM Phabricator instance.

Add CFI integer types normalization
ClosedPublic

Authored by rcvalle on Dec 5 2022, 11:51 PM.

Details

Summary

This commit adds a new option (i.e.,
-fsanitize-cfi-icall-normalize-integers) for normalizing integer types
as vendor extended types for cross-language LLVM CFI/KCFI support with
other languages that can't represent and encode C/C++ integer types.

Specifically, integer types are encoded as their defined representations
(e.g., 8-bit signed integer, 16-bit signed integer, 32-bit signed
integer, ...) for compatibility with languages that define
explicitly-sized integer types (e.g., i8, i16, i32, ..., in Rust).

`-fsanitize-cfi-icall-normalize-integers` is compatible with
`-fsanitize-cfi-icall-generalize-pointers`.

This helps with providing cross-language CFI support with the Rust
compiler and is an alternative solution for the issue described and
alternatives proposed in the RFC
https://github.com/rust-lang/rfcs/pull/3296.

For more information about LLVM CFI/KCFI and cross-language LLVM
CFI/KCFI support for the Rust compiler, see the design document in the
tracking issue https://github.com/rust-lang/rust/issues/89653.

Diff Detail

Event Timeline

rcvalle created this revision.Dec 5 2022, 11:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 11:51 PM
rcvalle requested review of this revision.Dec 5 2022, 11:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 11:51 PM
rcvalle updated this revision to Diff 480349.Dec 5 2022, 11:57 PM
rcvalle retitled this revision from Add support for integer types notmalization to Add support for integer types normalization.

Fixed typo in commit message

ojeda added a subscriber: ojeda.Dec 6 2022, 4:19 AM

FYI, I'll still add (hopefully today) documentation for the new -fsanitize-cfi-icall-normalize-integers option and compression for these types.

rcvalle updated this revision to Diff 480700.Dec 6 2022, 4:58 PM
rcvalle retitled this revision from Add support for integer types normalization to Add CFI integer types normalization.
rcvalle edited the summary of this revision. (Show Details)

Added documentation

rcvalle updated this revision to Diff 480773.Dec 6 2022, 10:21 PM

Added compression

rcvalle updated this revision to Diff 480775.Dec 6 2022, 10:39 PM

Fixed comments

comex added a subscriber: comex.Dec 7 2022, 12:22 AM
rcvalle updated this revision to Diff 481016.Dec 7 2022, 12:38 PM

Updated tests

rcvalle updated this revision to Diff 482327.Dec 12 2022, 5:56 PM

Added ".normalized" suffix

Thanks for the patch and the work on cross language CFI support!

I wonder if we have precedent for other non-standard extensions to ItaniumMangleContextImpl? I wonder if we should perhaps have a distinct subclass to denote that this is not the standard mangling scheme. It would be nice perhaps to get this standardized in https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling.
https://github.com/itanium-cxx-abi/cxx-abi

cc @rjmccall @hjl.tools

pcc added a reviewer: pcc.Dec 12 2022, 6:56 PM

A high level question is whether we want to base the cross-language encoding on Itanium at all. Itanium has concepts such as substitutions that will complicate the implementation in other languages. Encoding pointee types can also lead to complications in cross-language encodings.

It may be better to consider developing a custom encoding. For the encoding being prototyped for the pointer authentication ABI on Android, the Rust side of the implementation is very simple:

https://github.com/pcc/rust/blob/d37ad119171635219ff21e054780d31024d24200/compiler/rustc_ty_utils/src/abi.rs#L396

clang/lib/AST/ItaniumMangle.cpp
2952

isInteger() will return true for enums, but only if they are complete. This would mean that code such as

void (*f)(enum E *e);

void g() {
  f(0);
}

would use a different encoding to call f depending on whether the TU completes the enum E, if pointee types are considered part of the encoding.

I elaborated on the reasons why not use a generalized encoding in the design document in the tracking issue https://github.com/rust-lang/rust/issues/89653. The tl;dr; is that it will result in less comprehensive protection by either using a generalized encoding for all C and C++ -compiled code or across the FFI boundary, and will degrade the security of the program when linking foreign Rust-compiled code into a program written in C or C++ because the program previously used a more comprehensive encoding for all its compiled code, not fixing the issue described in the design document and the RFC https://github.com/rcvalle/rfcs/blob/improve-c-types-for-cross-language-cfi/text/0000-improve-c-types-for-cross-language-cfi.md#appendix.

rcvalle added inline comments.Dec 12 2022, 7:26 PM
clang/lib/AST/ItaniumMangle.cpp
2952

Isn't isIntegerType() that does that? isInteger() definition is:

bool isInteger() const {
  return getKind() >= Bool && getKind() <= Int128;
}
pcc added a comment.Dec 12 2022, 7:52 PM

I elaborated on the reasons why not use a generalized encoding in the design document in the tracking issue https://github.com/rust-lang/rust/issues/89653. The tl;dr; is that it will result in less comprehensive protection by either using a generalized encoding for all C and C++ -compiled code or across the FFI boundary, and will degrade the security of the program when linking foreign Rust-compiled code into a program written in C or C++ because the program previously used a more comprehensive encoding for all its compiled code, not fixing the issue described in the design document and the RFC https://github.com/rcvalle/rfcs/blob/improve-c-types-for-cross-language-cfi/text/0000-improve-c-types-for-cross-language-cfi.md#appendix.

Ack.

clang/lib/AST/ItaniumMangle.cpp
2952

Ah yes, sorry, somehow I read this as a call to isIntegerType().

rcvalle updated this revision to Diff 482699.Dec 13 2022, 8:41 PM

Updated tests

rcvalle updated this revision to Diff 482708.Dec 13 2022, 9:13 PM

Added KCFI support

Thanks for the patch, Ramon. This looks like a reasonable approach to me, and just for reference, here appears to be the corresponding rustc change:

https://github.com/rust-lang/rust/pull/105452/commits/9087c336103d0fa0b465acf8dbc1e4651250fb05

@pcc did you have any other concerns about adding this option?

pcc added a comment.Jan 19 2023, 5:00 PM

Thanks for the patch, Ramon. This looks like a reasonable approach to me, and just for reference, here appears to be the corresponding rustc change:

https://github.com/rust-lang/rust/pull/105452/commits/9087c336103d0fa0b465acf8dbc1e4651250fb05

@pcc did you have any other concerns about adding this option?

I discussed this out of band with Ramon and we agreed that the new option should be marked as experimental because the rustc implementation is not yet finalized. I think that the criteria for removing the experimental marking should be that there is a full implementation of integer normalization for Rust (or some other language) that has been tested against a large codebase that uses FFI. Aside from that I have no further concerns.

rcvalle updated this revision to Diff 490976.Jan 20 2023, 2:28 PM

Mark as experimental

I discussed this out of band with Ramon and we agreed that the new option should be marked as experimental because the rustc implementation is not yet finalized. I think that the criteria for removing the experimental marking should be that there is a full implementation of integer normalization for Rust (or some other language) that has been tested against a large codebase that uses FFI.

Sure, that makes sense.

clang/docs/ControlFlowIntegrity.rst
241 ↗(On Diff #490976)

An extra dash in the title.

rcvalle updated this revision to Diff 491013.Jan 20 2023, 6:10 PM

Fixed typo

rcvalle marked an inline comment as done.Jan 20 2023, 6:11 PM
rcvalle added inline comments.
clang/docs/ControlFlowIntegrity.rst
241 ↗(On Diff #490976)

Fixed. Thank you!

samitolvanen accepted this revision.Jan 25 2023, 1:29 PM
samitolvanen added a reviewer: samitolvanen.

Thanks, LGTM. @pcc, does this version look fine to you?

This revision is now accepted and ready to land.Jan 25 2023, 1:29 PM
pcc accepted this revision.Jan 31 2023, 10:22 AM

LGTM with nits

clang/lib/CodeGen/CodeGenModule.cpp
1694

Is the !! necessary here?

6877

Likewise

clang/test/CodeGen/cfi-icall-normalize.c
56–76

Shouldn't these all be checking for specific types? Since you're specifying a triple, the width and signedness of the integer types are fixed.

clang/test/CodeGen/cfi-icall-normalize2.c
9 ↗(On Diff #491013)

Likewise; also below

rcvalle updated this revision to Diff 493732.Jan 31 2023, 2:21 PM
rcvalle marked an inline comment as done.

Changed as per review

rcvalle marked 4 inline comments as done.Jan 31 2023, 2:23 PM
rcvalle added inline comments.
clang/lib/CodeGen/CodeGenModule.cpp
1694

Fixed. Thank you!

6877

Fixed. Thank you!

clang/test/CodeGen/cfi-icall-normalize.c
56–76

Fixed. Thank you!

clang/test/CodeGen/cfi-icall-normalize2.c
9 ↗(On Diff #491013)

Fixed. Thank you!

pcc accepted this revision.Jan 31 2023, 2:30 PM

LGTM

This revision was automatically updated to reflect the committed changes.
hctim added a subscriber: hctim.Feb 2 2023, 3:46 PM

Hey folks, looks like this caused a failure on the msan buildbot: https://lab.llvm.org/buildbot/#/builders/237/builds/785

It's been had a long-running bug that I'm still tracking down but seems like this is a new failure caused by this patch. The track-origins log is copied below for your convenience.

The bot can be reproduced by following the instructions at https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild, you'd want to substitute buildbot_fast.sh for buildbot_bootstrap_msan.sh though. Given the bot is already red when this was committed, please ignore any failures other than this one.

==3442210==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xaaaaf388495c in (anonymous namespace)::CXXNameMangler::mangleUnqualifiedName(clang::GlobalDecl, clang::DeclarationName, clang::DeclContext const*, unsigned int, llvm::SmallVector<llvm::StringRef, 4u> const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:1631:9
    #1 0xaaaaf389ab8c in mangleUnqualifiedName /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:501:5
    #2 0xaaaaf389ab8c in (anonymous namespace)::CXXNameMangler::mangleNestedName(clang::GlobalDecl, clang::DeclContext const*, llvm::SmallVector<llvm::StringRef, 4u> const*, bool) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:1735:5
    #3 0xaaaaf3847b20 in (anonymous namespace)::CXXNameMangler::mangleFunctionEncoding(clang::GlobalDecl) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:811:5
    #4 0xaaaaf38985fc in (anonymous namespace)::CXXNameMangler::mangleLocalName(clang::GlobalDecl, llvm::SmallVector<llvm::StringRef, 4u> const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:1806:7
    #5 0xaaaaf3897d00 in (anonymous namespace)::CXXNameMangler::mangleType(clang::TagType const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:3468:3
    #6 0xaaaaf384e184 in (anonymous namespace)::CXXNameMangler::mangleType(clang::QualType) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp
    #7 0xaaaaf384106c in (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXRTTIName(clang::QualType, llvm::raw_ostream&, bool) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:6626:11
    #8 0xaaaaeb77c768 in clang::CodeGen::CodeGenTBAA::getBaseTypeInfoHelper(clang::Type const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenTBAA.cpp:394:16
    #9 0xaaaaeb777978 in getBaseTypeInfo /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenTBAA.cpp:427:28
    #10 0xaaaaeb777978 in clang::CodeGen::CodeGenTBAA::getTypeInfo(clang::QualType) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenTBAA.cpp:242:12
    #11 0xaaaaeb779184 in clang::CodeGen::CodeGenTBAA::getAccessInfo(clang::QualType) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenTBAA.cpp:265:25
    #12 0xaaaaeb0c2cfc in MakeAddrLValue /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:2494:33
    #13 0xaaaaeb0c2cfc in (anonymous namespace)::AggExprEmitter::VisitLambdaExpr(clang::LambdaExpr*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:1350:23
    #14 0xaaaaeb0ab220 in Visit /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:108:34
    #15 0xaaaaeb0ab220 in clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:2038:49
    #16 0xaaaaea90e15c in clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExpr.cpp:224:5
    #17 0xaaaaea910c80 in clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExpr.cpp:237:10
    #18 0xaaaaeac28f4c in clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&, clang::Expr const*, clang::QualType) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGCall.cpp:4461:12
    #19 0xaaaaeac25c34 in clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&, clang::CodeGen::CodeGenFunction::PrototypeWrapper, llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const* const, clang::Stmt const* const>>, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGCall.cpp:4308:5
    #20 0xaaaaea9733d0 in clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExpr.cpp:5435:3
    #21 0xaaaaea970394 in clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExpr.cpp:4999:10
    #22 0xaaaaeacbeb28 in (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:580:20
    #23 0xaaaaeac88628 in Visit /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:407:52
    #24 0xaaaaeac88628 in clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:5044:8
    #25 0xaaaaea90d7ac in clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGExpr.cpp:183:33
    #26 0xaaaaea9a2dc0 in clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*, llvm::BasicBlock*, llvm::BasicBlock*, unsigned long, clang::Stmt::Likelihood) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1883:13
    #27 0xaaaaea9d3f04 in clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGStmt.cpp:833:3
    #28 0xaaaaea9d2888 in EmitCompoundStmtWithoutScope /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGStmt.cpp:535:7
    #29 0xaaaaea9d2888 in EmitCompoundStmt /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGStmt.cpp:486:10
    #30 0xaaaaea9d2888 in clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGStmt.cpp:442:5
    #31 0xaaaaea9d0c74 in clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGStmt.cpp:59:7
    #32 0xaaaaeac5614c in clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGClass.cpp
    #33 0xaaaaea99f2c8 in clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1439:5
    #34 0xaaaaeb174904 in clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CGCXX.cpp:215:26
    #35 0xaaaaea8a2024 in (anonymous namespace)::ItaniumCXXABI::emitCXXStructor(clang::GlobalDecl) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/ItaniumCXXABI.cpp:4375:28
    #36 0xaaaaea7893f8 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3638:14
    #37 0xaaaaea759064 in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2808:5
    #38 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #39 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #40 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #41 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #42 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #43 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #44 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #45 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #46 0xaaaaea7590dc in clang::CodeGen::CodeGenModule::EmitDeferred() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2814:7
    #47 0xaaaaea751844 in clang::CodeGen::CodeGenModule::Release() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:515:3
    #48 0xaaaaec54f928 in (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:287:18
    #49 0xaaaaec545b40 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:308:14
    #50 0xaaaaf0528bb4 in clang::ParseAST(clang::Sema&, bool, bool) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Parse/ParseAST.cpp:196:13
    #51 0xaaaaec265424 in clang::FrontendAction::Execute() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:8
    #52 0xaaaaec0b940c in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1046:33
    #53 0xaaaaec52f63c in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:264:25
    #54 0xaaaae2356ecc in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/tools/driver/cc1_main.cpp:251:15
    #55 0xaaaae23486dc in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/tools/driver/driver.cpp:360:12
    #56 0xaaaaebcb7740 in operator() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Driver/Job.cpp:428:34
    #57 0xaaaaebcb7740 in void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_0>(long) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
    #58 0xaaaae9ad4730 in operator() /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
    #59 0xaaaae9ad4730 in llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:426:3
    #60 0xaaaaebcb51ac in clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Driver/Job.cpp:428:12
    #61 0xaaaaebbf7d68 in clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Driver/Compilation.cpp:199:15
    #62 0xaaaaebbf8a60 in clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Driver/Compilation.cpp:253:19
    #63 0xaaaaebc4edcc in clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/Driver/Driver.cpp:1853:5
    #64 0xaaaae234449c in clang_main(int, char**) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/tools/driver/driver.cpp:562:21
    #65 0xffff861a73f8  (/lib/aarch64-linux-gnu/libc.so.6+0x273f8) (BuildId: f37f3aa07c797e333fd106472898d361f71798f5)
    #66 0xffff861a74c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8) (BuildId: f37f3aa07c797e333fd106472898d361f71798f5)
    #67 0xaaaae22b4a2c in _start (/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/clang-17+0x5934a2c)
  Uninitialized value was created by an allocation of 'Mangler' in the stack frame
    #0 0xaaaaf3840e88 in (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXRTTIName(clang::QualType, llvm::raw_ostream&, bool) /b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:6624:3
rcvalle reopened this revision.Feb 7 2023, 9:11 PM
rcvalle marked 4 inline comments as done.
This revision is now accepted and ready to land.Feb 7 2023, 9:11 PM
rcvalle updated this revision to Diff 495718.Feb 7 2023, 9:12 PM

Fixed use of uninitialized value

rcvalle updated this revision to Diff 495860.Feb 8 2023, 8:23 AM

Fixed initialization order warning

samitolvanen accepted this revision.Feb 8 2023, 2:23 PM

Thanks for fixing the MSan issue, Ramon. There's still a clang-format error that trips the Debian build above, but it's trivial so I can fix it when relanding the patch.

This revision was landed with ongoing or failed builds.Feb 8 2023, 2:25 PM
This revision was automatically updated to reflect the committed changes.