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

gumjs: Add NativePointer#readVolatile() #738

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

hsorbo
Copy link
Member

@hsorbo hsorbo commented May 11, 2023

Adds Memory.readVolatileByteArray to quickjs/v8.

This uses gum_memory_read instead of memcpy used by Memory.readByteArray to prevent os-exceptions on invalid memory addresses

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! 💥

bindings/gumjs/gumquickmemory.c Outdated Show resolved Hide resolved
@@ -192,6 +194,7 @@ static const JSCFunctionListEntry gumjs_memory_entries[] =
GUMJS_EXPORT_MEMORY_READ_WRITE ("Utf8String", UTF8_STRING),
GUMJS_EXPORT_MEMORY_READ_WRITE ("Utf16String", UTF16_STRING),
GUMJS_EXPORT_MEMORY_READ_WRITE ("AnsiString", ANSI_STRING),
JS_CFUNC_DEF ("readVolatileByteArray", 0, gum_quick_memory_read_volatile_array),
Copy link
Member

Choose a reason for hiding this comment

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

Line exceeds 80 cols.

bindings/gumjs/gumquickmemory.c Outdated Show resolved Hide resolved
bindings/gumjs/gumquickmemory.c Outdated Show resolved Hide resolved
bindings/gumjs/gumquickmemory.c Outdated Show resolved Hide resolved
bindings/gumjs/gumv8memory.cpp Outdated Show resolved Hide resolved
bindings/gumjs/gumv8memory.cpp Outdated Show resolved Hide resolved
bindings/gumjs/gumquickmemory.c Outdated Show resolved Hide resolved
bindings/gumjs/gumv8memory.cpp Outdated Show resolved Hide resolved
bindings/gumjs/gumv8memory.cpp Outdated Show resolved Hide resolved
For when memory is being read in a moment where another thread may
potentially unmap it or change its protection.

Since we're using gum_memory_read(), which results in a system call, we
don't have to worry about OS-exceptions on invalid memory addresses.

This makes this API particularly useful on newer versions of iOS, where
Exceptor may not be functional.
@oleavr oleavr changed the title Memory.readVolatileByteArray gumjs: Add NativePointer#readVolatile() Jun 20, 2023
@oleavr oleavr merged commit 63e8325 into frida:main Jun 20, 2023
2 of 18 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