nix
                                
                                 nix copied to clipboard
                                
                                    nix copied to clipboard
                            
                            
                            
                        Add implementation of `PTRACE_{GET,SET}REGSET`
This is related to https://github.com/nix-rust/nix/pull/1695, but have many issues solved here:
- {get,set}regsetnow allows specifying which set of registers to read/write, as defined in- RegisterSet. This should be the expected behavior.
- Also added PTRACE_{GET,SET}REGSfor most platforms other than x86 using aforementioned implementation.
Changelog added.
test_ptrace on Linux aarch64 failed while previously passed. Debugging.
Edit: Can't reproduce on qemu-system-aarch64, with Debian sid arm64, Rust 1.71.0 and GCC 13.
I've rebased this patch to master. Any updates?
From my perspective, all the work is blocked by #2166
Any updates?
BTW, #1695 has a good test, can we port it to this PR?
BTW, #1695 has a good test, can we port it to this PR?
Ported.
Cannot reproduce aarch64 test errors on real hardware (Radxa Rock 5B, RK3588, rustc 1.70.0, Linux 5.10.110-20-rockchip)
Cannot reproduce aarch64 test errors on real hardware (Radxa Rock 5B, RK3588, rustc 1.70.0, Linux 5.10.110-20-rockchip)
I think I will set up a Linux VM on my m1 Mac to give it a test. BTW, we run Nix's tests with sudo, though I am not sure if it is related
I think I will set up a Linux VM on my m1 Mac to give it a test.
Sorry for the late reply, I tested it in a aarch64 Linux VM, and it also failed with EIO:
[steve@fedora steve]$ uname -a
Linux fedora 6.7.11-orbstack-00143-ge6b82e26cd22 #1 SMP Sat Mar 30 12:20:36 UTC 2024 aarch64 GNU/Linux
[steve@fedora test]$ sudo --preserve-env=HOME $(which cargo) test --all-features sys::test_ptrace::test_ptrace_syscall
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests src/lib.rs (/home/steve/Documents/workspace/nix/target/debug/deps/nix-4701d15085df23b3)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 19 filtered out; finished in 0.00s
     Running test/test.rs (/home/steve/Documents/workspace/nix/target/debug/deps/test-637c83b07deea78d)
running 1 test
test sys::test_ptrace::test_ptrace_syscall ... FAILED
failures:
---- sys::test_ptrace::test_ptrace_syscall stdout ----
thread 'sys::test_ptrace::test_ptrace_syscall' panicked at test/sys/test_ptrace.rs:262:59:
called `Result::unwrap()` on an `Err` value: EIO
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
    sys::test_ptrace::test_ptrace_syscall
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 347 filtered out; finished in 0.00s
error: test failed, to rerun pass `--test test`
Is there anything I can do to help debug the issue?
It turns out to be my bad. I ran tests on non-root and it just skipped it.
After some research it seems aarch64 and riscv64 does not support PTRACE_PEEKUSER at all and will just fail with EIO. I'll make that part of the test x86-only.
The CI is still failing due to an unused import, let me give it a fix:)