-
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::read_user and ptrace::write_user #1697
Conversation
5281b30
to
3fc915c
Compare
Hmm, the |
CHANGELOG.md
Outdated
@@ -64,6 +64,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). | |||
- Added `Ipv6DontFrag` for android, iOS, linux and macOS. | |||
- Added `IpDontFrag` for iOS, macOS. | |||
(#[1692](https://github.com/nix-rust/nix/pull/1692)) | |||
- Added `ptrace::read_user` and `ptrace::write_user` for Linux. |
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.
Can you rebase such that this is in the latest unreleased section (the current changes it's near are part of the 0.24.0
release) and also add a link back to this PR, like the other items in the CHANGELOG?
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.
Done. Thanks!
6620faa
to
4930d37
Compare
test/sys/test_ptrace.rs
Outdated
// Find the offset of `user.regs.rax` (or `eax` for x86) | ||
let user_struct = std::mem::MaybeUninit::<libc::user>::uninit(); | ||
let user_struct_ptr = user_struct.as_ptr(); | ||
let rax_offset = get_rax_offset(user_struct_ptr) as usize - user_struct_ptr as usize; |
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.
Nix already depends on the memoffset
crate conditionally, and we can use it in our tests (may need to update Cargo.toml to do so).
It should be possible to use memoffset::offset_of
to simplify this.
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.
Great suggestion, that 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+
No description provided.