-
-
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
gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h #125605
gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h #125605
Conversation
This reverts commit 5fc5b7d.
I am fine with moving the definition to a separate header, this is also more convenient for tools to copy-paste. :)
I was planning to do this independently if #124640 (I did that change in the PR 😉 ) takes time to land so I will build on top of this. |
I had a gut feeling something like that was the case. :) |
Provided the audit machinery doesn't gain accessible entry points (which basically means they all exist in the one source unit, via headers is okay), I don't mind where it lives. If the functions or structure layouts are discoverable at runtime, it makes it much easier to create a bypass. We call an internal-only version of the function so that it's harder to shim it. Just don't make that any more accessible. |
I'll merge this tomorrow, unless there are any objections. If this is blocking anyone, feel free to merge it before I get to it. |
@@ -0,0 +1,269 @@ | |||
#ifndef Py_INTERNAL_DEBUGGER_UTILS_H |
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 suggest to rename the file pycore_debug_offsets.h
instead. "debug utils" is vague.
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 was going to point out that there are other debugger-related things that would go there, but your suggestion looks very correct to me. 😄 Thanks! I'll change it.
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.
done
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.
LGTM
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
pythongh-125605) This is essentially a cleanup, moving a handful of API declarations to the header files where they fit best, creating new ones when needed. We do the following: * add pycore_debug_offsets.h and move _Py_DebugOffsets, etc. there * inline struct _getargs_runtime_state and struct _gilstate_runtime_state in _PyRuntimeState * move struct _reftracer_runtime_state to the existing pycore_object_state.h * add pycore_audit.h and move to it _Py_AuditHookEntry , _PySys_Audit(), and _PySys_ClearAuditHooks * add audit.h and cpython/audit.h and move the existing audit-related API there *move the perfmap/trampoline API from cpython/sysmodule.h to cpython/ceval.h, and remove the now-empty cpython/sysmodule.h
This is essentially a cleanup, moving a handful of API declarations to the header files where they fit best, creating new ones when needed.
We do the following:
_Py_DebugOffsets
, etc. therestruct _getargs_runtime_state
andstruct _gilstate_runtime_state
in_PyRuntimeState
struct _reftracer_runtime_state
to the existing pycore_object_state.h_Py_AuditHookEntry
,_PySys_Audit()
, and_PySys_ClearAuditHooks
@pablogsal, I'd love to know if you're okay with us moving
_Py_DebugOffsets
like I have. Would it break anything? Would the separate header be inconvenient for external tools or will it make no difference? Also, do you think the name of the new header is okay?@zooba, are you okay with us moving all the audit API into the new *audit.h header files like I have?