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

Using strace with linux-inject #5

Open
Aakash16 opened this issue Jan 15, 2016 · 2 comments
Open

Using strace with linux-inject #5

Aakash16 opened this issue Jan 15, 2016 · 2 comments

Comments

@Aakash16
Copy link

Thanks for creating awesome injection library. I am able to successfully inject with help of your technique. But when I run sample-target with strace the injection fails with message: ptrace(PTRACE_ATTACH) failed
please help.

@gaffe23
Copy link
Owner

gaffe23 commented Feb 16, 2016

Unfortunately, trying to run sample-target under strace presents a bit of a chicken-and-egg problem.

strace works by attaching to the target application using ptrace. However, linux-inject itself also needs to be able to attach to the target application using ptrace. Two processes cannot ptrace the same application at the same time, so linux-inject can't attach when strace is already attached.

As a result, you can't use linux-inject on an application that is running under strace.

@Aakash16
Copy link
Author

Thank you for your reply. Now I understand the problem.

On 2/17/16, gaffe23 [email protected] wrote:

Unfortunately, trying to run sample-target under strace presents a bit
of a chicken-and-egg problem.

strace works by attaching to the target application using ptrace.
However, linux-inject itself also needs to be able to attach to the target
application using ptrace. Two processes cannot ptrace the same
application at the same time, so linux-inject can't attach when strace
is already attached.

As a result, you can't use linux-inject on an application that is running
under strace.


Reply to this email directly or view it on GitHub:
#5 (comment)

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

No branches or pull requests

2 participants