Skip to content
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

Fix python3.12 on ubuntu x86-64 #284

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions interpreter/python/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,17 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr

// Calls first: PyThread_tss_get(autoTSSKey)
autoTLSKey = decodeStub(ef, pyruntimeAddr, "PyGILState_GetThisThreadState", 0)
if autoTLSKey == libpf.SymbolValueInvalid {
// Starting with Python 3.12, PyGILState_GetThisThreadState calls PyThread_tss_is_created
// first before calling PyThread_tss_get.
// On default builds of python (without `--enable-optimizations`, `--with-lto`), the calls
// to PyThread_tss_is_created and PyThread_tss_get are not inlined, so the value of
// autoTLSKey is stored in a register before being passed to both function calls. This
// causes the decode disassembler to not find the value in the call instruction.
// To work around this, we look into PyGILState_Release which as of Python 3.13,
// calls PyThread_tss_get directly.
autoTLSKey = decodeStub(ef, pyruntimeAddr, "PyGILState_Release", 0)
}
if autoTLSKey == libpf.SymbolValueInvalid {
return nil, errors.New("unable to resolve autoTLSKey")
}
Expand Down
Loading