File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -734,6 +734,17 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
734734
735735 // Calls first: PyThread_tss_get(autoTSSKey)
736736 autoTLSKey = decodeStub (ef , pyruntimeAddr , "PyGILState_GetThisThreadState" , 0 )
737+ if autoTLSKey == libpf .SymbolValueInvalid {
738+ // Starting with Python 3.12, PyGILState_GetThisThreadState calls PyThread_tss_is_created
739+ // first before calling PyThread_tss_get.
740+ // On default builds of python (without `--enable-optimizations`, `--with-lto`), the calls
741+ // to PyThread_tss_is_created and PyThread_tss_get are not inlined, so the value of
742+ // autoTLSKey is stored in a register before being passed to both function calls. This
743+ // causes the decode disassembler to not find the value in the call instruction.
744+ // To work around this, we look into PyGILState_Release which as of Python 3.13,
745+ // calls PyThread_tss_get directly.
746+ autoTLSKey = decodeStub (ef , pyruntimeAddr , "PyGILState_Release" , 0 )
747+ }
737748 if autoTLSKey == libpf .SymbolValueInvalid {
738749 return nil , errors .New ("unable to resolve autoTLSKey" )
739750 }
You can’t perform that action at this time.
0 commit comments