Open zuypt opened 4 years ago
Oh, nice find! I suppose we can query it first, and restore it afterwards?
Oh, nice find! I suppose we can query it first, and restore it afterwards?
I don't really know how frida is structured .Do I need to fork pkg-config or glib repo to fix this issue ?
We could definitely improve g_private_get()
so it doesn't clobber LastError, but I think this is a deeper issue with transformers. The Stalker
integration should probably save and restore it before/after returning, just like Interceptor
does for onEnter
/ onLeave
.
Look at this call stack
g_private_get
callsTlsAlloc
which callsTlsGetValue
which ends up modifiesLastErrorValue
. Many API functions (in this casegumjs_instruction_get_address
) end up ing_private_get
. This easily messes up code that usesGetLastError
for error handling.POC
expected ouput
GetLastError: 1337
result output
GetLastError: 0
I don't see any straight forward way to fix this issue. Give me some hints then i maybe I can fix it and make a pull request.