-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143123: Protect against recursive tracer calls/finalization #143126
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
base: main
Are you sure you want to change the base?
Changes from all commits
1303cf0
9f5f8b5
cdb5d46
4e216fe
ba708ca
0db663d
9cf2ede
a977df1
89b084b
0c1f2e6
bc86f70
1a390e1
7d2f597
03e5dab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Protect the JIT against recursive tracing. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5607,6 +5607,16 @@ dummy_func( | |
| #else | ||
| assert(_PyErr_Occurred(tstate)); | ||
| #endif | ||
| #if _Py_TIER2 | ||
| if (IS_JIT_TRACING()) { | ||
| LEAVE_TRACING(); | ||
| int res = stop_tracing_and_jit(tstate, frame); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We just want to stop tracing, but not jit here. Can we just call
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because we need that function to reset the counters as well
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which counters need resetting, and shouldn't |
||
| (void)res; | ||
| // We shouldn't ven have compiled in the first place. | ||
| assert(res == 0); | ||
| } | ||
| #endif | ||
|
|
||
|
|
||
| /* Log traceback info. */ | ||
| assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct place for this, or should it be in
label(exception_unwind)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to stop tracing whenever an error happens anyways, because we currently dont deal with errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label(error)always goes tolabel(execption_unwind)so it will get handled then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot about the call to
_PyEval_MonitorRaiseso we do this here.I think we also need this check before any calls to monitoring before
JUMP_TO_LABEL(exception_unwind);Maybe make a
STOP_TRACING()macro to keep the code duplication down?