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

Exposed memory_read , memory_write and memory_scan gum functions #795

Merged
merged 1 commit into from
May 31, 2024

Conversation

hillelpinto
Copy link
Contributor

I've referenced some memory functions (read, write & scan) to the cmodule runtime so that it can be invoked through cmodule scripting

@jevinskie
Copy link

jevinskie commented May 2, 2024

These need to go inside the #endif. Can you also please add tests? Something simple like reading from a stack allocated local variable for the simple case an more complicated case where it tries to read memory that memcpy would SEGFAULT on while gum_memory_* would handle gracefully with either no read bytes or partial read bytes?

@oleavr anything else you’d like to see added from gummemory.h while we’re at it? Perhaps some of the fancier scan functionalities (masked, etc) would be useful?

@hillelpinto
Copy link
Contributor Author

Hey, i updated the code and for the tests yeah of course, where to add them ?

Copy link
Member

@oleavr oleavr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you rebase this on latest main? Just from a quick look it seems the added code references types that aren't present, so I suspect this will break the CModule runtime.

@oleavr
Copy link
Member

oleavr commented May 13, 2024

@oleavr anything else you’d like to see added from gummemory.h while we’re at it? Perhaps some of the fancier scan functionalities (masked, etc) would be useful?

I tend to add things as I find myself needing them, but yeah those sound good to me.

@oleavr
Copy link
Member

oleavr commented May 13, 2024

Hey, i updated the code and for the tests yeah of course, where to add them ?

You can find them in tests/gumjs/script.c, look for CModule there.

@oleavr
Copy link
Member

oleavr commented May 13, 2024

(Sorry it took me so long to review -- I was stuck in a rabbit-hole, and have now finally made it out.)

@oleavr
Copy link
Member

oleavr commented May 13, 2024

Note that tests should be super-basic -- we already have test coverage for these primitives in tests/core/, so the tests only need to ensure that the symbols exist and one simple use-case works. (So we know that the types match the full headers in gum/.)

@hillelpinto
Copy link
Contributor Author

@oleavr Code is rebased and test added

@oleavr oleavr merged commit f60b9d4 into frida:main May 31, 2024
20 of 21 checks passed
@oleavr
Copy link
Member

oleavr commented May 31, 2024

Thanks! 🙌 Since it took me some time to get to this, I've improved the test to test things inside CModule, and exposed some more APIs while at it. Cheers!

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.

3 participants