Repository navigation
darwin: give the agent a file per session - #1306
Conversation
|
One update on the
The fix is frida/idun#14 — clear the backends once the stops have completed, since a stopped monitor cannot be restarted. With it in: So the two are independent, and neither needs the other's code: this PR fixes the crash, idun#14 fixes the shutdown wait. Nothing here depends on it. (For the record, since both are visible from this thread: the earlier bounded-shutdown PR #1307 and the frida-core wrap patch #1308 are withdrawn and closed — carrying a workaround for this turned out to be unnecessary once the connection's owner was identified.) |
|
I'm about to cut a new release, so taking a stab at this now. |
81eecc5 to
7bac33e
Compare
Loading the agent into this process a second time, after an earlier container already shut down its GLib, crashed in g_type_from_name() during environment init. This happened whenever a DeviceManager was created after another one had attached to the system session and been closed. Keep one container per process instead, created on first use and torn down by frida_shutdown() or frida_deinit(), on the main context it was created on. Host sessions now close only their own sessions in it, rather than the connection.
7bac33e to
160be38
Compare
17.28.0 faulted in the agent container the first time a second device manager's session machinery ran, and this loop was ignored so CI stayed green while the fix was in frida-core. The fix is frida/frida-core#1306 (the agent container is shared across host sessions), which 17.28.1 carries: the loop passes on its devkit, so the test runs with the rest again.
A second
DeviceManager, after a script has been loaded into this process through the first one, faults in the agent container thread:The second session's environment init runs
gio_initand the OpenSSL GIO module registration into a GLib whose type system the previous session already shut down.Why 17.28.0
2dd9ebd2moved the agent into the shared resource directory, so the image outlived the session that shut its GLib down; 17.27.5 had one image per session for free, because each manager had its own temporary directory. Bisected on macOS arm64:4a421169(before the resource-directory work)c90e78ac2dd9ebd2a0b9b89arevertedThe change
AgentResourcetakes the session's temporary directory again, so each session writes its own agent file and maps its own image. The helper stays in the resource directory — it is stateless and safe to share, so the release's intent is kept where it is safe.(
~TemporaryFiledeletes the file when it is dropped, soAgentResourcekeeps the reference.)Checked
Three rounds of
new DeviceManager → get_local_device → attach(0) → create_script("1;") → load → detach → close:The same loop through frida-python 17.28.0 faults identically, so it is not specific to any binding.
Note:
frida_deinit()hanging after a local attach is a separate, older issue (it hangs at 17.27.5 too) and is not touched here.