New submission from Xavier de Gaye:

Nosying reviewers of PR 1981 of issue 22898.

The memerr.py script segfaults with the following gdb backtrace:

#0  0x0000000000550268 in PyErr_NormalizeException 
(exc=exc@entry=0x7fffffffdee8, 
    val=val@entry=0x7fffffffdef0, tb=tb@entry=0x7fffffffdef8) at 
Python/errors.c:315
#1  0x000000000055045f in PyErr_NormalizeException 
(exc=exc@entry=0x7fffffffdee8, 
    val=val@entry=0x7fffffffdef0, tb=tb@entry=0x7fffffffdef8) at 
Python/errors.c:319
#2  0x000000000055045f in PyErr_NormalizeException 
(exc=exc@entry=0x7fffffffdee8, 
    val=val@entry=0x7fffffffdef0, tb=tb@entry=0x7fffffffdef8) at 
Python/errors.c:319
#3  0x000000000055045f in PyErr_NormalizeException 
(exc=exc@entry=0x7fffffffdee8, 
    val=val@entry=0x7fffffffdef0, tb=tb@entry=0x7fffffffdef8) at 
Python/errors.c:319
...

To be able to run this patch, one needs to apply the nomemory_allocator.patch 
from issue 30695 and the infinite_loop.patch from issue 30696.

This raises two different problems:

a) The segfault itself that occurs upon setting the PyExc_RecursionErrorInst 
singleton. Oh! That had already been pointed out in msg231933 in issue 22898 at 
case 4).

b) When the size of the Python frames stack is greater than the size of the 
list of preallocated MemoryError instances, this list becomes exhausted and 
PyErr_NormalizeException() enters an infinite recursion which is stopped:
    * by the PyExc_RecursionErrorInst singleton when a) is fixed
    * by a Fatal Error (abort) when applying PR 1981 in its current state 
(there is no stack overflow as expected even in the absence of any guard before 
the recursive call to PyErr_NormalizeException())
The user is presented in both cases with an error hinting at a recursion 
problem instead of a problem with memory exhaustion. This is bug b).

----------
components: Interpreter Core
files: memerr.py
messages: 296272
nosy: brett.cannon, haypo, pitrou, serhiy.storchaka, xdegaye
priority: normal
severity: normal
status: open
title: segfault in PyErr_NormalizeException() after memory exhaustion
type: crash
versions: Python 3.7
Added file: http://bugs.python.org/file46960/memerr.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to