[issue10312] intcatcher() can deadlock

Hallvard B Furuseth report at bugs.python.org
Thu Nov 4 13:49:02 CET 2010


New submission from Hallvard B Furuseth <h.b.furuseth at usit.uio.no>:

Parser/intrcheck.c:intcatcher() can do FILE* operations, which can
deadlock if the interrupt happens while a FILE* operation on the same
FILE holds a mutex for the FILE.  I've seen this happen elsewhere.

It'd rather be a pity to remove Py_Exit(), so I suggest
switch(interrupted++) gets a case 3 or 4: which does _exit(1),
and 'interrupted = 0;' is moved there from case 2.

Also 'interrupted' should be volatile sig_atomic_t, and
the function should save/restore errno as in Issue 10311.

BTW, you could use strlen(message) instead of sizeof(message)-1.

----------
components: Interpreter Core
files: intrcheck.diff
keywords: patch
messages: 120399
nosy: hfuru
priority: normal
severity: normal
status: open
title: intcatcher() can deadlock
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19491/intrcheck.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10312>
_______________________________________


More information about the Python-bugs-list mailing list