Skip to content

gh-132399: ensure correct alignment of PyInterpreterState when UBSan is on - #132428

Merged
picnixz merged 6 commits into
python:mainfrom
picnixz:fix/ubsan/interpreter-alloc-132399
Apr 19, 2025
Merged

gh-132399: ensure correct alignment of PyInterpreterState when UBSan is on#132428
picnixz merged 6 commits into
python:mainfrom
picnixz:fix/ubsan/interpreter-alloc-132399

Conversation

@picnixz

@picnixzpicnixz commented Apr 12, 2025

Copy link
Copy Markdown
Member

With that PR, the test suite passes for the free-threaded build with UBSan:

./configure --with-undefined-behavior-sanitizer --with-pydebug --prefix="$(pwd)/build" CC=clang LD=clang CFLAGS="-fsanitize=undefined -fno-sanitize-recover" LDFLAGS="-fsanitize=undefined -fno-sanitize-recover" -q --disable-gil
./python -m test -j0

There is still one UB failure (fixed by #131605) but this is not specific to free-threading.

cc @colesbury

Comment threadPython/pystate.c Outdated
Comment threadPython/pystate.c Outdated
Comment threadPython/pystate.c Outdated
Comment threadPython/pystate.c Outdated
Comment threadPython/pystate.c Outdated
@picnixz
picnixz requested a review from colesburyApril 18, 2025 09:26
Comment threadInclude/internal/pycore_interp_structs.h Outdated
Comment threadPython/pystate.c Outdated
Comment threadPython/pystate.c Outdated
@picnixz
picnixz requested a review from colesburyApril 18, 2025 14:58

@colesburycolesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Might be worth running the buildbots just to make sure there are no weird issues with _Alignof()

@picnixzpicnixz added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 18, 2025
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @picnixz for commit 12032df 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132428%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 18, 2025
@picnixz

Copy link
Copy Markdown
MemberAuthor

there are no weird issues with _Alignof()

Hopefully not because I don't know the alternative (it's also something that was only standardized in C11 IIRC but I hope that we won't have issues)

@picnixzpicnixz self-assigned this Apr 19, 2025
@picnixz

Copy link
Copy Markdown
MemberAuthor

The Fedora failures are unrelated I think as they already appeared previously.

@picnixz
picnixz merged commit 427e7fc into python:mainApr 19, 2025
@picnixz
picnixz deleted the fix/ubsan/interpreter-alloc-132399 branch April 19, 2025 09:03
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 macOS 3.x (tier-2) has failed when building commit 427e7fc.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/725/builds/10518) and take a look at the build logs.
  4. Check if the failure is related to this commit (427e7fc) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/725/builds/10518

Summary of the results of the build (if available):

Click to see traceback logs
remote: Enumerating objects: 13, done. remote: Counting objects: 7% (1/13) remote: Counting objects: 15% (2/13) remote: Counting objects: 23% (3/13) remote: Counting objects: 30% (4/13) remote: Counting objects: 38% (5/13) remote: Counting objects: 46% (6/13) remote: Counting objects: 53% (7/13) remote: Counting objects: 61% (8/13) remote: Counting objects: 69% (9/13) remote: Counting objects: 76% (10/13) remote: Counting objects: 84% (11/13) remote: Counting objects: 92% (12/13) remote: Counting objects: 100% (13/13) remote: Counting objects: 100% (13/13), done. remote: Compressing objects: 16% (1/6) remote: Compressing objects: 33% (2/6) remote: Compressing objects: 50% (3/6) remote: Compressing objects: 66% (4/6) remote: Compressing objects: 83% (5/6) remote: Compressing objects: 100% (6/6) remote: Compressing objects: 100% (6/6), done. remote: Total 7 (delta 6), reused 1 (delta 1), pack-reused 0 (from 0) 
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: switching to '427e7fc099e61d9a3d1f04e2fbde8b749e5fcf0a'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 427e7fc099e gh-132399: ensure correct alignment of `PyInterpreterState` (#132428)
Switched to and reset branch 'main'
ar: temporary file: No space left on devicemake: *** [libpython3.14d.a] Error 1

@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 macOS 3.x (tier-2) has failed when building commit 427e7fc.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/725/builds/10519) and take a look at the build logs.
  4. Check if the failure is related to this commit (427e7fc) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/725/builds/10519

Summary of the results of the build (if available):

Click to see traceback logs
Note: switching to '427e7fc099e61d9a3d1f04e2fbde8b749e5fcf0a'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 427e7fc099e gh-132399: ensure correct alignment of `PyInterpreterState` (#132428)
Switched to and reset branch 'main'
fatal error: /Library/Developer/CommandLineTools/usr/bin/ranlib: can't write to output file (No space left on device)
/Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failedmake: *** [libpython3.14d.a] Error 1

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@picnixz@bedevere-bot@colesbury