[Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable (original) (raw)
Scott Dial scott+python-dev at scottdial.com
Sun Dec 19 23:08:51 CET 2010
- Previous message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Next message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/18/2010 8:50 AM, James Y Knight wrote:
I think instead of calling abort() to kill the process, you should: - install the signal handler with SANODEFER|SARESETHAND (or if sigaction is not present, explicitly reset the action to SIGDFL and unblock first thing upon entering the handler), and then, - at the end of the handler, kill(getpid(), origsignal) in order to abort the process.
I concur with this being the correct way to right such a handler.
This has two advantages: 1) the process's exit code will actually show the correct signal,
It's more than an advantage: it's the only correct way to handle a termination signal.
2) it might let the OS fault handlers work properly as well -- I'm not sure. If it does, you may want to experiment with whether having or omitting SANODEFER gives a better backtrace (from the OS mechanism) in that case.
Even if that doesn't work, things like the grsecurity patches to linux use these signals to detect exploits and log them and do throttling. Calling abort() effectively converts all of these faults into SIGABRT terminations that are considered (more?) innocent terminations.
-- Scott Dial scott at scottdial.com scodial at cs.indiana.edu
-- Scott Dial scott at scottdial.com scodial at cs.indiana.edu
- Previous message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Next message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]