-
Notifications
You must be signed in to change notification settings - Fork 677
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
Allow signal injection in ptrace::syscall and ptrace::detach #1083
Conversation
Tests: yes please. Especially for ptrace, which is very difficult to use correctly. I can't figure out a good reason why BSD lacks |
Yes, |
I've added tests now, but restricted them to Linux only, because the functions needed to test it are only available there... |
c1a07b9
to
f4dfc96
Compare
I removed my implementation of |
f4dfc96
to
bc3b85c
Compare
|
||
// inject signal | ||
ptrace::syscall(child, Signal::SIGTERM).unwrap(); | ||
assert_eq!(waitpid(child, None), Ok(WaitStatus::Signaled(child, Signal::SIGTERM, false))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the child sends SIGTERM
to itself, and you inject it here? Why two places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just how ptrace
works. It intercepts signal delivery and allows the tracer to decide whether the child will actually receive the signal or not. The mechanism to do that is signal injection. (It's a bad name, and a bad mechanism tbh.) If you don't inject the signal that was intercepted, it won't be delivered at all.
This is very weird, the tests are failing in the CI but not in my machine. I'll keep looking into it. |
c730a54
to
729ba41
Compare
CI is green now! |
Due to an upstream problem with the tempfile crate, you'll have to rebase. |
729ba41
to
4c990a4
Compare
@asomers Done! |
I would like to use signal injection with PTRACE_SYSCALL. |
Is there anything pending on my end? |
Sorry that this dropped off of my radar. I should have some time this week to look at it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add a CHANGELOG entry, too.
Done! Please let me know if the changelog entry looks ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Looks good! Now it just needs a squash.
1707b60
to
88c41d1
Compare
88c41d1
to
f5d0fe3
Compare
Should be done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Merge conflict |
I'm sorry, but you'll have to rebase again. And be sure to rebase; don't merge master into your branch. |
e906c82
to
7f3ee09
Compare
@asomers Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
1083: Allow signal injection in ptrace::syscall and ptrace::detach r=asomers a=frangio Fixes #1049 Should I add tests for this functionality? By the way, I noticed that the BSD module doesn't have `ptrace::syscall`. I couldn't find a reason behind this in #949. Should we add it? Co-authored-by: Francisco Giordano <[email protected]>
Build succeeded
|
Fixes #1049
Should I add tests for this functionality?
By the way, I noticed that the BSD module doesn't have
ptrace::syscall
. I couldn't find a reason behind this in #949. Should we add it?