Skip to content

gh-133157: remove usage of _Py_NO_SANITIZE_UNDEFINED in Parser/pegen.c #134048

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 3 commits into from
Jun 10, 2025

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented May 15, 2025

We remove undefined behaviors by adding more "overloads" functions. I've added some small checks to detect possible future undefined behaviors.

@picnixz
Copy link
Member Author

picnixz commented Jun 9, 2025

@pablogsal friendly ping

@pablogsal pablogsal added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jun 10, 2025
@pablogsal
Copy link
Member

LGTM. Great work on factoring this into a macro and the check in the generator 👌

@pablogsal pablogsal merged commit 754e7c9 into python:main Jun 10, 2025
54 checks passed
@miss-islington-app
Copy link

Thanks @picnixz for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 10, 2025
…er/pegen.c` (pythonGH-134048)

(cherry picked from commit 754e7c9)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@miss-islington-app
Copy link

Sorry, @picnixz and @pablogsal, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 754e7c9b5187fcad22acf7555479603f173a4a09 3.13

@bedevere-app
Copy link

bedevere-app bot commented Jun 10, 2025

GH-135320 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 10, 2025
@pablogsal
Copy link
Member

Can you do the backport to 3.13?

@picnixz
Copy link
Member Author

picnixz commented Jun 10, 2025

I'll do the backport tomorrow! (I'm going to sleep in a few minutes :'))

@picnixz picnixz self-assigned this Jun 10, 2025
pablogsal pushed a commit that referenced this pull request Jun 10, 2025
…ser/pegen.c` (GH-134048) (#135320)

gh-133157: remove usage of `_Py_NO_SANITIZE_UNDEFINED` in `Parser/pegen.c` (GH-134048)
(cherry picked from commit 754e7c9)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz picnixz deleted the fix/ubsan/pegen-133157 branch June 10, 2025 08:45
picnixz added a commit to picnixz/cpython that referenced this pull request Jun 10, 2025
…n `Parser/pegen.c` (pythonGH-134048)

(cherry picked from commit 754e7c9)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Jun 10, 2025

GH-135334 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 10, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jun 10, 2025

GH-135334 is a backport of this pull request to the 3.13 branch.

picnixz added a commit that referenced this pull request Jun 10, 2025
…135334)

[3.13] gh-133157: fix UBSan failures in `Parser/pegen.c` (GH-134048)
(cherry picked from commit 754e7c9)
@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 Debian root 3.13 (tier-1) has failed when building commit dd7ffdb.

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/1441/builds/1259) and take a look at the build logs.
  4. Check if the failure is related to this commit (dd7ffdb) 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/1441/builds/1259

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

Click to see traceback logs
remote: Enumerating objects: 10, done.        
remote: Counting objects:  10% (1/10)        
remote: Counting objects:  20% (2/10)        
remote: Counting objects:  30% (3/10)        
remote: Counting objects:  40% (4/10)        
remote: Counting objects:  50% (5/10)        
remote: Counting objects:  60% (6/10)        
remote: Counting objects:  70% (7/10)        
remote: Counting objects:  80% (8/10)        
remote: Counting objects:  90% (9/10)        
remote: Counting objects: 100% (10/10)        
remote: Counting objects: 100% (10/10), done.        
remote: Total 10 (delta 9), reused 9 (delta 9), pack-reused 0 (from 0)        
From https://github.com/python/cpython
 * branch                    3.13       -> FETCH_HEAD
Note: switching to 'dd7ffdbbff35d9a86906c71ee2c15a1cee02701d'.

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 dd7ffdbbff3 [3.13] gh-133157: fix UBSan failures in `Parser/pegen.c` (GH-134048) (#135334)
Switched to and reset branch '3.13'

configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)
configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.

make: *** wait: No child processes.  Stop.
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes.  Stop.

Cannot open file '/root/buildarea/3.13.angelico-debian-amd64/build/test-results.xml' for upload

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