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

frida-gum: force frida-gum init to use Module (#98) #172

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

elazarl
Copy link
Contributor

@elazarl elazarl commented Oct 28, 2024

In order to use the underlying C API global init should be called.

We hence force the creation of Gum to use Module::* functions.

We also use OnceLock instead of lazy_static! as discussed in the issue.

In order to use the underlying C API global init should be called.

We hence force the creation of Gum to use Module::* functions.

We also use OnceLock instead of lazy_static! as discussed in the issue.
@elazarl
Copy link
Contributor Author

elazarl commented Oct 28, 2024

see #98, cc @s1341

Not all suggestion implemented, so not closing yet.

Note that OnceCell is not suitable for lazy initialisation of a static that requires thread safety to prevent initialization race, I hence used OnceLock + static instead, and required 'static lifetime for Gum.

To support single threaded cases without requiring a lock, one can consider to accept parametrized lifetime in Module but IMHO, as Gum is essentially global state, there's no significant gain.

@s1341
Copy link
Contributor

s1341 commented Oct 29, 2024

Module::from_gum should be renamed to Module::obtain for consistency.

@s1341
Copy link
Contributor

s1341 commented Oct 29, 2024

can you take a look at CI?

@elazarl
Copy link
Contributor Author

elazarl commented Oct 29, 2024

can you take a look at CI?

Done, forgot to run clippy.

@s1341 s1341 merged commit 56c4f4d into frida:main Oct 29, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants