-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Possible NULL-pointer dereference in faulthandler_user
#96652
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
Comments
For systems without `sigaction` (i.e. HAVE_SIGACTION is undefined) `faulthandler_user` has to check previous signal handler to be defined (non-NULL) before calling it. Otherwise the code is subject to segmentation faults.
The bug can be reproduced simply with: import faulthandler
import signal
import time
faulthandler.register(signal.SIGALRM, chain=True)
signal.alarm(1)
time.sleep(2)
print("exit") The question is more what is your platform. It doesn't support sigaction()? |
PR #96666 should fix the issue. |
It's our customer's OS we're porting CPython to. |
Can you share the OS name? Or is it private? If yes, please mention the OS version. |
…ythonGH-96666) Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL. (cherry picked from commit c580a81) Co-authored-by: Victor Stinner <vstinner@python.org>
…ythonGH-96666) Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL. (cherry picked from commit c580a81) Co-authored-by: Victor Stinner <vstinner@python.org>
Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL.
It's covered by NDA so far, sorry. Might be disclosed later provided they decide to publicly share OS and this port in particular. |
Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL. (cherry picked from commit c580a81) Co-authored-by: Victor Stinner <vstinner@python.org>
Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL. (cherry picked from commit c580a81) Co-authored-by: Victor Stinner <vstinner@python.org>
Uh oh!
There was an error while loading. Please reload this page.
Crash report
Segmentation fault occurs whenever
test_socketserver
suite takes more than 60 seconds on a system withHAVE_SIGACTION
undefined.To reproduce the issue:
#define HAVE_SIGACTION 1
with#undef HAVE_SIGACTION
inpyconfig.h
.for
loop intest_tcpserver_bind_leak
(Lib/test/test_socketserver.py
):CPython
withmake
.test_socketserver
test suite withmake test TESTOPTS="-j1 -v test_socketserver"
.Once 60-seconds alarm set in
SocketServerTest::setUp
goes off,SIGALRM
handler (i.e.faulthandler_user
) gets called, prints Python's traceback (viafaulthandler_dump_traceback
) and crashes while callinguser->previous
that isNULL
.Error messages
Your environment
CPython built from sources:
main dde15f5879 [origin/main] gh-94808: Improve coverage of _PyBytes_FormatEx (GH-95895)
Operating system and architecture:
Linux 5.15.0-46-generic #49-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: