-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-111758: Run UBSan in GitHub Actions #135578
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
Merged
+82
−0
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
27d31f3
Add UBSan to GHA build
encukou b38afc9
Don't recover
encukou 5bc492b
UBSan, not TSan
encukou 53d49aa
Use UBSAN_OPTIONS
encukou 34b644c
Activate UBSan log after configuration
encukou 5767846
Update .github/workflows/reusable-ubsan.yml
encukou f086fcb
Merge branch 'main' into gha-ubsan
encukou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Reusable Undefined Behavior Sanitizer | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
config_hash: | ||
required: true | ||
type: string | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build-ubsan-reusable: | ||
name: 'Undefined behavior sanitizer' | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Runner image version | ||
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV" | ||
- name: Restore config.cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: config.cache | ||
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }} | ||
- name: Install dependencies | ||
run: | | ||
sudo ./.github/workflows/posix-deps-apt.sh | ||
# Install clang-20 | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh 20 | ||
- name: UBSAN option setup | ||
run: | | ||
echo "UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1" >> "$GITHUB_ENV" | ||
echo "CC=clang" >> "$GITHUB_ENV" | ||
echo "CXX=clang++" >> "$GITHUB_ENV" | ||
- name: Add ccache to PATH | ||
run: | | ||
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV" | ||
- name: Configure ccache action | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
save: ${{ github.event_name == 'push' }} | ||
max-size: "200M" | ||
- name: Configure CPython | ||
run: >- | ||
./configure | ||
--config-cache | ||
--with-undefined-behavior-sanitizer | ||
--with-pydebug | ||
- name: Set up UBSAN log after configuration | ||
run: | | ||
echo "UBSAN_OPTIONS=${UBSAN_OPTIONS}:log_path=${GITHUB_WORKSPACE}/ubsan_log" >> "$GITHUB_ENV" | ||
- name: Build CPython | ||
run: make -j4 | ||
- name: Display build info | ||
run: make pythoninfo | ||
- name: Tests | ||
run: ./python -m test -j4 | ||
- name: Display UBSAN logs | ||
if: always() | ||
run: find "${GITHUB_WORKSPACE}" -name 'ubsan_log.*' | xargs head -n 1000 | ||
- name: Archive UBSAN logs | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: >- | ||
ubsan-logs | ||
path: ubsan_log.* | ||
if-no-files-found: ignore |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the configure failure:
https://github.com/python/cpython/actions/runs/15706865183/job/44254688889?pr=135578
is because this key is identical to the one in
reusable-tsan.yml
, so let's addubsan
or something in here:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ubsan
is part ofgithub.job
. It's using a cache from before I added the latest commits.I removed that cache and will restart the job. (GitHub will allow that after all the other ones finish).