Skip to content

ci: add MSan Linux job - #950

Merged
alandefreitas merged 1 commit into
cppalliance:developfrom
mizvekov:ci-enable-msan
Sep 30, 2025
Merged

alandefreitas merged 1 commit into
cppalliance:developfrom
mizvekov:ci-enable-msan

Conversation

@mizvekov

@mizvekov mizvekov commented Jul 30, 2025 •

Copy link
Copy Markdown
Collaborator

Adds MSan sanitizer job.

This builds libc++, if the host is capable of it and for non-release jobs, and uses it instead of the system library.

This libc++ will be built with whatever sanitizer is selected, increasing the effectiveness of those tests.
This is also a requirement for MSan, which requires everything to be compiled with it.

Building the libc++ separately, with the host compiler, also decreases the maximum amount of disk space the CI jobs need.

In terms of host compiler, the libc++ being used requires [apple-]clang >= 19 or GCC 15. The other compilers are still built in the pre-existing manner, using the bootstrap build.

For now, GCC 15 doesn't use this yet, because there is some issue linking the library which needs to be investigated.

apple-clang, when built with sanitizers, also has a special requirement which is not being met, so is also not opting into the standalone libc++ build. This is left to improve later.

@mizvekov mizvekov self-assigned this Jul 30, 2025
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

1 similar comment
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@mizvekov mizvekov changed the title ci: add asan and msan Linux jobs ci: add msan Linux job Aug 15, 2025
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@mizvekov
mizvekov force-pushed the ci-enable-msan branch 5 times, most recently from 204baa9 to 7cd0ed0 Compare September 3, 2025 17:22
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

1 similar comment
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

4 similar comments
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

Comment thread .github/workflows/ci.yml Outdated
extra-values: |
llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
use-libcxx: {{#if (and (ieq compiler 'clang') (or (eq major 19) (eq major 20) (eq major 21))) }}true{{else}}false{{/if}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm adding this gt feature now. That logic is going to break soon. Especially because it says nothing about sanitizers. It's only relying on the version.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to also use the split libcxx for the clang non-sanitizer version, because that would be a different test checking we build correctly with libc++ instead of libstdc++, and if there is any problems there we will both get the answer faster, and the isolated error without any sanitizer involvement.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, then you don't even need to check major. You just have to check if it's clang.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that can't work with clang-18, as libc++ has already removed support for compiling with it.

Comment thread .github/workflows/ci.yml Outdated
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
apt-get update
apt-get install -y libclang-18-dev libclang-19-dev libclang-20-dev libclang-21-dev

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need all of these versions?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is a bug in how the llvm-dev package is split from the clang-dev only one, where some of the cmake module code errors out.

This happens when configuring the standalone libc++ build, where it tries to find the llvm cmake module, calls something into it, but that errors out because it can't find some cmake files which are only shipped in the clang-dev package.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's because I don't understand the implications of this bug. However, I have no idea what the connection is between this bug and the answer to the question I asked about why we needed all these versions. Is it a bug in the CMake module that randomly gets fixed when you install multiple equally buggy versions simultaneously?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's all the clang versions we compile libc++ with. Regarding versions, I'll remove clang-18 since it's unsupported anyway.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
apt-get update
apt-get install -y libclang-18-dev libclang-19-dev libclang-20-dev libclang-21-dev

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a step for installing packages and the matrix already sets the packages we need. Do we need to implement any feature in the actions to make this work there?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main problem is that we need to insert the llvm repo here.

If the action adds support for that, then we can eliminate this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you been able to check the documentation of the package-install action, or are you assuming it doesn't have this feature? IIRC, it does have this feature because we needed it before. We can also include it if necessary, as it would simply be a loop over some keys. But I believe the feature is already there.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml
contents: write

steps:
- name: Resolved Matrix

@alandefreitas alandefreitas Sep 25, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe we could have a step to resolve paths. I think this already exists for a single path at a time, though. Or it could be an action to take another dictionary and allow lots of operations on the values, like resolving paths, concatenating strings or whatever.

@alandefreitas alandefreitas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... bootstrap. :)

void
buildTerminal(
NestedNameSpecifier const*,
NestedNameSpecifier,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are fixes MSan trigger? The calling code just worked unchanged? I smell something.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed those changes from the LLVM version bump I did a while ago.

I don't understand how the code compiled without those changes, but with the new jobs we started seeing linker errors because of this.

So yes, I think there is some deeper issue here, I just didn't look into it yet.

@mizvekov

Copy link
Copy Markdown
Collaborator Author

Well... bootstrap. :)

Yeah, as we talked about this, I assume there will be no problem if I post this on a separate PR, as these are orthogonal things we don't need to mix up in one commit.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

4 similar comments
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@alandefreitas

alandefreitas commented Sep 25, 2025 •

Copy link
Copy Markdown
Collaborator

I assume there will be no problem

#950 (comment)

these are orthogonal

Only if bootstrap is not a source of truth, which it attempts to be

In fact, one future plan is to replace literally everything in CI with a single call to bootstrap.py

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@alandefreitas

Copy link
Copy Markdown
Collaborator

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@sdarwin, is it possible to tell the bot to only make this comment once per PR?

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://950.mrdocs.prtest2.cppalliance.org/index.html

@sdarwin

sdarwin commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

@alandefreitas reviewing the available settings in Jenkins, there is a possibility: "Ignore Pull Requests marked as Drafts". Coincidentally, a pull request that's in very active development, getting 100 updates, is probably a "draft", right? It's not ready to merge.
Set this PR 950 to be a "draft" and lets see if previews stop.

@mizvekov

Copy link
Copy Markdown
Collaborator Author

@alandefreitas reviewing the available settings in Jenkins, there is a possibility: "Ignore Pull Requests marked as Drafts". Coincidentally, a pull request that's in very active development, getting 100 updates, is probably a "draft", right? It's not ready to merge. Set this PR 950 to be a "draft" and lets see if previews stop.

It's not possible to turn PRs back into drafts on GitHub.

FWIW this shouldn't have to rely on that, specially in this case where the url doesn't even change.

I have seen similar bot actions, where even when there is an actual update, the bot just updates the existing comment in place, instead of adding a new comment.

@sdarwin

sdarwin commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

It's not possible to turn PRs back into drafts

It's now a draft.

@mizvekov

Copy link
Copy Markdown
Collaborator Author

TIL you can do that, where is the option?

@sdarwin

sdarwin commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

where is the option

Not sure what your current collaboration settings are, if "administrator" (as Alan) there's a "convert to draft" setting near "Reviews".

@alandefreitas

Copy link
Copy Markdown
Collaborator

It's now a draft.

Phew

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 this pull request may close these issues.

4 participants