Skip to content

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

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
merged 6 commits into from
Apr 19, 2025

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Apr 12, 2025

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

@picnixz picnixz requested a review from colesbury April 18, 2025 09:26
@picnixz picnixz requested a review from colesbury April 18, 2025 14:58
Copy link
Contributor

@colesbury colesbury left a comment

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()

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

🤖 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-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 18, 2025
@picnixz
Copy link
Member Author

picnixz commented Apr 18, 2025

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)

@picnixz picnixz self-assigned this Apr 19, 2025
@picnixz
Copy link
Member Author

picnixz commented Apr 19, 2025

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

@picnixz picnixz merged commit 427e7fc into python:main Apr 19, 2025
126 of 128 checks passed
@picnixz picnixz deleted the fix/ubsan/interpreter-alloc-132399 branch April 19, 2025 09:03
@bedevere-bot
Copy link

⚠️⚠️⚠️ 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 device
make: *** [libpython3.14d.a] Error 1

@bedevere-bot
Copy link

⚠️⚠️⚠️ 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 failed
make: *** [libpython3.14d.a] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants