Repository navigation
fix: Don't free tracer context in DllMain during process termination - #544
Conversation
57289ae to
5469123
Compare
|
At first glance this issue may also be a Linux issue, so we should explore this more and find a more robust solution... |
|
No problem. This is just a stability improvement. If users don't call L0 late in process exit, I think it should be fine. |
|
So I am ok with this as a Windows stability fix, the lpvReserved check matches the DllMain guidance. One ask, could you add a short comment at the early return explaining the skipped delete is intentional? Something like: Tools like the MSVC debug heap leak dump or Coverity may flag this at some point, so having the reason in the code will make triage much easier, i.e. we don't want someone "fixing" the leak later and bringing the UAF back :-) Side note, the FreeLibrary path and Linux side still have the same class of issue, I'll follow up on those in a separate PR so this one isn't blocked. |
29eae86 to
ad893a9
Compare
Matches what's being done here: https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain `lpvReserved` is "non-NULL" when process is terminating and its not safe to call the tracer context destructor there. Signed-off-by: Schilling, Matthew <matthew.schilling@intel.com> Co-authored-by: Russell McGuire <russell.w.mcguire@intel.com>
ad893a9 to
0a9d227
Compare
|
No problem. Done, thanks! That's a good point. Yeah I tried to stay targeted at the issue I was seeing rather than just use AI to do everything. Keeps me relative confident in my manual validation :) |
Update Copyright
Level Zero loader ABI checklast-release ( master ( If an ABI change is intended, a reviewer with write access can accept it: leave an approval review on the PR head commit with the keyword |
Matches what's being done here: https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain
lpvReservedis "non-NULL" when process is terminating and its not safe to call the tracer context destructor there.Guards against a use-after-free occasionally on PyTorch Profiler on Windows.