KEMBAR78
gh-133157: remove use of `_Py_NO_SANITIZE_UNDEFINED` in faulthandler by picnixz · Pull Request #134047 · python/cpython · GitHub
Skip to content

Conversation

@picnixz
Copy link
Member

@picnixz picnixz commented May 15, 2025

  • remove _read_null() as it's a tricky one (and the compiler didn't seem to complain)
  • instead of using 1/0 arithmetic, we explicitly raise SIGFPE

- reading from NULL is no more an undefined behavior for C11
- instead of using 1/0 arithmetic, we explicitly raise SIGFPE
picnixz added 2 commits May 15, 2025 17:30
Reading from NULL is an undefined behavior and `faulthandler`
should not check for low-level C about undefined behaviors.
@picnixz picnixz requested a review from vstinner May 16, 2025 09:03
@picnixz
Copy link
Member Author

picnixz commented May 16, 2025

Should I actually add a NEWS entry? the function was not documented but it had a docstring.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner
Copy link
Member

Should I actually add a NEWS entry? the function was not documented but it had a docstring.

It doesn't need a NEWS entry since it's a private function written for test_faulthandler.

@picnixz picnixz merged commit 0a160bf into python:main May 18, 2025
42 checks passed
@picnixz picnixz deleted the fix/ubsan/faulthandler-133157 branch May 18, 2025 08:16
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…thandler` (python#134047)

In `faulthandler_sigfpe()`, instead of using 1/0 arithmetic, we explicitly raise SIGFPE.
We also remove `faulthandler._read_null()` since reading from NULL is an undefined
behavior and `faulthandler` should not check for low-level C undefined behaviors.
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…thandler` (python#134047)

In `faulthandler_sigfpe()`, instead of using 1/0 arithmetic, we explicitly raise SIGFPE.
We also remove `faulthandler._read_null()` since reading from NULL is an undefined
behavior and `faulthandler` should not check for low-level C undefined behaviors.
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.

2 participants