-
Notifications
You must be signed in to change notification settings - Fork 666
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
Add PTRACE_INTERRUPT call as ptrace::interrupt(pid)
#1422
Conversation
Parent { child } => { | ||
ptrace::seize(child, ptrace::Options::PTRACE_O_TRACESYSGOOD).unwrap(); | ||
ptrace::interrupt(child).unwrap(); | ||
assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceEvent(child, Signal::SIGTRAP, 128))); |
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.
This I verified, interrupt will fire the PtraceEvent. Not sure about the third parameter 128, is it same over all systems?
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.
Good question. Where did you copy the 128 parameter from?
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.
I took it from the waitpid(...)
return state. Seems that internally it converts status
through
#[cfg(any(target_os = "android", target_os = "linux"))]
fn stop_additional(status: i32) -> c_int {
(status >> 16) as c_int
}
@blaind could you please fix the compile failures? |
I had a look, the builds are failing now because of missing variables on various platforms. On android, I guess one way to fix is to go back with feature gate ( |
It's failing on non-Linux platforms because stuff like PTRACE_SEIZE is Linux-specific. That's why they were feature gated to begin with. I only asked about removing the mips restriction, not the OS restriction. |
I mistakenly took architecture to mean OS as well. Anyway, just pushed a new commit that might fix it. Testing is semiwhat slow, as I can not test locally. |
Note, this is a duplicate of #1279 (which omits tests). Whichever PR gets merged, the other should be closed. |
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.
Could you please rebase onto master to fix the conflicts?
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.
Ok, everything looks good now. Would you mind squashing your commits?
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+
@@ -90,6 +90,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). | |||
- Added `sendfile64` (#[1439](https://github.com/nix-rust/nix/pull/1439)) | |||
- Added `MS_LAZYTIME` to `MsFlags` | |||
(#[1437](https://github.com/nix-rust/nix/pull/1437)) | |||
- Added `ptrace::interrupt` method for platforms that support `PTRACE_INTERRUPT` |
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.
Shoot. I just noticed that your CHANGELOG entry got moved into the wrong part of the file when you rebased. You'll have to move it up to the top.
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.
Whoops, I forgot to stop bors when I found the CHANGELOG. problem. Don't worry; I'll take care of 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.
Oops, sorry about that. Did not notice when rebasing with master. Thanks for fixing!
I've based the test on
fn test_ptrace_cont
. Removed some parts, but not 100% sure what's the proper way of testing in nix context.From ptrace-man page: