-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Segmentation fault in 3.11.4, 3.12.0b3; _PyInterpreterFrame ownership issue #106092
Comments
Having exactly 17 middlewares, on Python 3.11.0 and above, causes python to segfault when running tests with coverage; see python/cpython#106092 Work around this by adding a no-op middleware if we would hit that unlucky number. We only add it in testing, since coverage is a requirement to trigger it, and there is no reason to burden production with an additional wrapping.
Having exactly 17 or 18 middlewares, on Python 3.11.0 and above, causes python to segfault when running tests with coverage; see python/cpython#106092 Work around this by adding a no-op middleware if we would hit that unlucky number. We only add it in testing, since coverage is a requirement to trigger it, and there is no reason to burden production with an additional wrapping.
I think I understand the problem.
Lines 128 to 137 in f992a60
However, that is not the only reason the Cc @markshannon (GH-27077). |
Having exactly 17 or 18 middlewares, on Python 3.11.0 and above, causes python to segfault when running tests with coverage; see python/cpython#106092 Work around this by adding a no-op middleware if we would hit that unlucky number. We only add it in testing, since coverage is a requirement to trigger it, and there is no reason to burden production with an additional wrapping.
Having exactly 17 or 18 middlewares, on Python 3.11.0 and above, causes python to segfault when running tests with coverage; see python/cpython#106092 Work around this by adding one or two no-op middlewares if we would hit those unlucky numbers. We only add them in testing, since coverage is a requirement to trigger it, and there is no reason to burden production with additional wrapping.
Having exactly 17 or 18 middlewares, on Python 3.11.0 and above, causes python to segfault when running tests with coverage; see python/cpython#106092 Work around this by adding one or two no-op middlewares if we would hit those unlucky numbers. We only add them in testing, since coverage is a requirement to trigger it, and there is no reason to burden production with additional wrapping.
Having exactly 17 or 18 middlewares, on Python 3.11.0 and above, causes python to segfault when running tests with coverage; see python/cpython#106092 Work around this by adding one or two no-op middlewares if we would hit those unlucky numbers. We only add them in testing, since coverage is a requirement to trigger it, and there is no reason to burden production with additional wrapping. (cherry picked from commit cf0b803)
currently fails with a segmentation fault. Could be related to python/cpython#106092
It was possible for the trashcan to delay the deallocation of a PyFrameObject until after its corresponding _PyInterpreterFrame has already been freed. So frame_dealloc needs to avoid dereferencing the f_frame pointer unless it first checks that the pointer still points to valid memory. Signed-off-by: Anders Kaseorg <[email protected]>
It was possible for the trashcan to delay the deallocation of a PyFrameObject until after its corresponding _PyInterpreterFrame has already been freed. So frame_dealloc needs to avoid dereferencing the f_frame pointer unless it first checks that the pointer still points to valid memory. Signed-off-by: Anders Kaseorg <[email protected]>
It was possible for the trashcan to delay the deallocation of a PyFrameObject until after its corresponding _PyInterpreterFrame has already been freed. So frame_dealloc needs to avoid dereferencing the f_frame pointer unless it first checks that the pointer still points to the interpreter frame within the frame object. Signed-off-by: Anders Kaseorg <[email protected]>
…106875) It was possible for the trashcan to delay the deallocation of a PyFrameObject until after its corresponding _PyInterpreterFrame has already been freed. So frame_dealloc needs to avoid dereferencing the f_frame pointer unless it first checks that the pointer still points to the interpreter frame within the frame object. (cherry picked from commit 557b05c) Co-authored-by: Anders Kaseorg <[email protected]> Signed-off-by: Anders Kaseorg <[email protected]>
…106875) It was possible for the trashcan to delay the deallocation of a PyFrameObject until after its corresponding _PyInterpreterFrame has already been freed. So frame_dealloc needs to avoid dereferencing the f_frame pointer unless it first checks that the pointer still points to the interpreter frame within the frame object. (cherry picked from commit 557b05c) Co-authored-by: Anders Kaseorg <[email protected]> Signed-off-by: Anders Kaseorg <[email protected]>
… (#107532) gh-106092: Fix use-after-free crash in frame_dealloc (GH-106875) It was possible for the trashcan to delay the deallocation of a PyFrameObject until after its corresponding _PyInterpreterFrame has already been freed. So frame_dealloc needs to avoid dereferencing the f_frame pointer unless it first checks that the pointer still points to the interpreter frame within the frame object. (cherry picked from commit 557b05c) Signed-off-by: Anders Kaseorg <[email protected]> Co-authored-by: Anders Kaseorg <[email protected]>
currently fails with a segmentation fault. Could be related to python/cpython#106092 Co-authored-by: Colton Myers <[email protected]>
This is probably a more effective workaround for python/cpython#106092. Signed-off-by: Anders Kaseorg <[email protected]>
This is probably a more effective workaround for python/cpython#106092. Signed-off-by: Anders Kaseorg <[email protected]>
This is probably a more effective workaround for python/cpython#106092. Signed-off-by: Anders Kaseorg <[email protected]>
This is probably a more effective workaround for python/cpython#106092. Signed-off-by: Anders Kaseorg <[email protected]>
This is probably a more effective workaround for python/cpython#106092. Signed-off-by: Anders Kaseorg <[email protected]> (cherry picked from commit 4f27381)
This is probably a more effective workaround for python/cpython#106092. Signed-off-by: Anders Kaseorg <[email protected]> (cherry picked from commit 4f27381)
Crash report
This test case (minimized from a crash in the Zulip test suite) causes a segmentation fault in Python 3.11.4 and 3.12.0b3.
https://github.com/andersk/python-segfault
Based on the tracebacks below, this looks like a
_PyInterpreterFrame
ownership issue similar to #99729 and #100126. The crash is here:cpython/Objects/frameobject.c
Line 854 in 1bbf60d
where the
_PyInterpreterFrame
at*f->f_frame
has already been freed.Error messages
Full output with Python traceback
AddressSanitizer traceback
This is from the current
3.11
branch, commit 1bbf60d.Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: