You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because ptracer uses a context manager, it's easy to use it in a multi-threaded context where the context can be entered and exited from multiple threads concurrently. However it seems to deal rather badly with doing that: because ptracer.context works with an unprotected global (_context), that object can be in a completely inconsistent state because there's a TOCTOU bug on self.enabled.
An easy fix would be to replace enabled with a regular lock (and acquire it in non-blocking, raising if it was not acquired).
It would be nice if ptracer could handle the situation better by having each context "subscribe" to the tracing process, but the asynchronous nature of the reporting likely makes that complicated.
The text was updated successfully, but these errors were encountered:
Because ptracer uses a context manager, it's easy to use it in a multi-threaded context where the context can be entered and exited from multiple threads concurrently. However it seems to deal rather badly with doing that: because
ptracer.context
works with an unprotected global (_context
), that object can be in a completely inconsistent state because there's a TOCTOU bug onself.enabled
.An easy fix would be to replace
enabled
with a regularlock
(and acquire it in non-blocking, raising if it was not acquired).It would be nice if ptracer could handle the situation better by having each context "subscribe" to the tracing process, but the asynchronous nature of the reporting likely makes that complicated.
The text was updated successfully, but these errors were encountered: