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

provide mechanism for injector to use allocated stack #544

Open
ajwerner opened this issue Sep 10, 2024 · 0 comments · May be fixed by #545
Open

provide mechanism for injector to use allocated stack #544

ajwerner opened this issue Sep 10, 2024 · 0 comments · May be fixed by #545

Comments

@ajwerner
Copy link
Contributor

In some programming languages (Go, Java when using fibers) stacks are heap allocated and small. In this case, the way the injector hijacks a thread and assumes it has enough stack space is not valid. There should be some mode to have the injection logic allocate a stack to use for its remote calls.

ajwerner added a commit to ajwerner/frida-core that referenced this issue Sep 10, 2024
For some target programs it's not reasonable to assume that any hijacked
thread has a large stack. For example, in Go, stacks are often small and
are allocated on the heap. The injector bootstrap program uses kilobytes
of stack. In order to side-step this problem, this patch enables an
option to allocate an auxiliary stack for the remote call to use and,
for the bootstrapper and loader, uses it.

The calls to mmap and munmap don't use much stack, so they are fine.

Fixes frida#544
ajwerner added a commit to ajwerner/frida-core that referenced this issue Sep 10, 2024
For some target programs it's not reasonable to assume that any hijacked
thread has a large stack. For example, in Go, stacks are often small and
are allocated on the heap. The injector bootstrap program uses kilobytes
of stack. In order to side-step this problem, this patch enables an
option to allocate an auxiliary stack for the remote call to use and,
for the bootstrapper and loader, uses it.

The calls to mmap and munmap don't use much stack, so they are fine.

Fixes frida#544
@ajwerner ajwerner linked a pull request Sep 10, 2024 that will close this issue
@ajwerner ajwerner changed the title provide mechanism for injector to use allocated state provide mechanism for injector to use allocated stack Sep 26, 2024
ajwerner added a commit to ajwerner/frida-core that referenced this issue Sep 26, 2024
For some target programs it's not reasonable to assume that any hijacked
thread has a large stack. For example, in Go, stacks are often small and
are allocated on the heap. The injector bootstrap program uses kilobytes
of stack. In order to side-step this problem, this patch changes the
boostrapper to allocate an auxiliary stack for remote calls to use and,
for the bootstrapper and loader, uses it.

The calls to mmap and munmap don't use much stack, so they are fine.

Fixes frida#544.
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 a pull request may close this issue.

1 participant