Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
[3.14] GH-139653: Only raise an exception (or fatal error) when the stack pointer is about to overflow the stack. (GH-141711)#141892
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
… limit on macOS (pythonGH-139232)Use `pthread_get_stackaddr_np()` and `pthread_get_stacksize_np()` to determine the stack address and size.(cherry picked from commit7016044)
… stack limits (pythonGH-139294)(cherry picked from commit7094f09)
…hon#139668)Add PyUnstable_ThreadState_SetStackProtection() andPyUnstable_ThreadState_ResetStackProtection() functionsto set the stack base address and stack size of a Pythonthread state.Co-authored-by: Petr Viktorin <encukou@gmail.com>(cherry picked from commitb99db92)
…ack pointer is about to overflow the stack. (pythonGH-141711)Only raises if the stack pointer is both below the limit *and* above the stack base.This prevents false positives for user-space threads, as the stack pointer will be outside those boundsif the stack has been swapped.(cherry picked from commitc25a070)
vstinner commentedNov 24, 2025
hroncok commentedNov 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I am not sure it includes theOnly raise an exception (or fatal error) when the stack pointer is about to overflow the stack commit, but I am happy to close this and finish the work there. |
vstinner commentedNov 24, 2025
Sure, "Only raise an exception (or fatal error) when the stack pointer is about to overflow the stack" should still be backported. But#141661 is a complex backport for the first part: backport PyUnstable_ThreadState_SetStackProtection() functions and commits preparing this backport. |
Uh oh!
There was an error while loading.Please reload this page.
This is my naïve attempt to backport#141711 into the 3.14 branch. I needed to backport several other changes, and at this point am frankly not sure if I know what I am doing :)
Opening as a draft, nevertheless, in case someone wants to take a look.
📚 Documentation preview 📚:https://cpython-previews--141892.org.readthedocs.build/