Age | Commit message (Collapse) | Author |
|
|
|
700: Get rid of a lot of transmutes r=asomers
Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).
cc #373
|
|
701: Calculate `nfds` parameter for `select` r=asomers
Doing this behind the scenes makes the API less error-prone and easier
to use. It should also fix my issue in https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
|
|
Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).
cc #373
|
|
Doing this behind the scenes makes the API less error-prone and easier
to use. It should also fix https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
These include:
* PTRACE_TRACEME
* PTRACE_CONT
* PTRACE_ATTACH
* PTRACE_SYSCALL
|
|
|
|
|
|
These are assumed to be QEMU issues, as they also fail on mips.
|
|
Note that ptrace isn't documented as signal-safe, but it's supposed to
just be a light syscall wrapper, so it should be fine.
|
|
Some tests were invoking non-async-signal-safe functions from the child
process after a `fork`. Since they might be invoked in parallel, this
could lead to problems.
|
|
|
|
The recommended way to trace syscalls with ptrace is to set the
PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from
receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return
SIGTRAP | 0x80, but nix wants to parse that as an actual signal.
Add another wait status type for syscall stops (in the language of the
ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are
different things), and mask out bit 0x80 from signals before trying to
parse it.
Closes #550
|
|
|
|
|
|
ptsname(3) returns a pointer to a global variable, so it isn't
thread-safe. Protect it with a mutex.
|
|
Instead of relying on the macro user to calculate the length in bytes
do that within the macro itself
|
|
|
|
There two different write semantics used with ioctls: one involves
passing a pointer the other involves passing an int. Previously the
ioctl! macro did not distinguish between these cases and left it up
to the user to set the proper datatype. This previous version was
not type safe and prone to errors. The solution here is to split the
"write" variant into a "write_ptr" and "write_int" variant that makes
the semantics more explicit and improves type safety by specifying
arguments better.
|
|
|
|
|
|
|
|
|
|
|
|
681: Remove feature flags r=Susurrus
These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the `execvpe` has been broken for forever.
The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The `execvpe` function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670).
Closes #98.
Closes #206.
Closes #306.
Closes #308.
|
|
686: Fix special ptraces r=Susurrus
In #614 we added specializations of `ptrace()` that added more type safety. As part of this, the `UnsupportedOperation` error was introduced for the requests that are covered by specialized versions so they couldn't be used with the general `ptrace()`. Unfortunately, no tests were added with this PR and so it slipped through that you could not do those operations at all anymore: `ptrace()` reported `UnsupportedOperation` for them and `ptrace_*` called `ptrace`, not `ffi::ptrace` and so also reported `UnsupportedOperation`! Whoops!
This minimally-invasive surgery corrects this by adding tests that call all the specialized `ptrace_*` ignoring the return value save checking for `UnsupportedOperation`. It also changes the functions calls to use `ffi::ptrace()` directly to fix the bug.
As this was never a bug in a released version of `nix`, there's no need for a changelog entry here.
|
|
Note that this is now only available for Linux as support is missing in libc
for Android (see rust-lang/libc#671).
As part of this work the SIGUSR2 signal mutex was altered to be a general
signal mutex. This is because all signal handling is shared across all threads
in the Rust test harness, so if you alter one signal, depending on whether it's
additive or may overwrite the mask for other signals, it could break the other
ones. Instead of putting this on the user, just broaden the scope of the mutex
so that any altering of signal handling needs to use it.
|
|
|
|
638: Make aio, chdir, and wait tests thread safe r=Susurrus
Fix thread safety issues in aio, chdir, and wait tests
They have four problems:
* The chdir tests change the process's cwd, which is global. Protect them all with a mutex.
* The wait tests will reap any subprocess, and several tests create subprocesses. Protect them all with a mutex so only one subprocess-creating test will run at a time.
* When a multithreaded test forks, the child process can sometimes block in the stack unwinding code. It blocks on a mutex that was held by a different thread in the parent, but that thread doesn't exist in the child, so a deadlock results. Fix this by immediately calling `std::process:;exit` in the child processes.
* My previous attempt at thread safety in the aio tests didn't work, because anonymous MutexGuards drop immediately. Fix this by naming the SIGUSR2_MTX MutexGuards.
Fixes #251
|
|
* Make test_tcgetattr deterministic. The old version behaved
differently depending on what file descriptors were opened by the
harness or by other tests, and could race against other tests.
* Close some file descriptor leaks
Fixes #154
|
|
|
|
They have four problems:
* The chdir tests change the process's cwd, which is global. Protect them
all with a mutex.
* The wait tests will reap any subprocess, and several tests create
subprocesses. Protect them all with a mutex so only one
subprocess-creating test will run at a time.
* When a multithreaded test forks, the child process can sometimes block in
the stack unwinding code. It blocks on a mutex that was held by a
different thread in the parent, but that thread doesn't exist in the
child, so a deadlock results. Fix this by immediately calling
std::process:exit in the child processes.
* My previous attempt at thread safety in the aio tests didn't work, because
anonymous MutexGuards drop immediately. Fix this by naming the
SIGUSR2_MTX MutexGuards.
Fixes #251
|
|
|
|
This also removes the incorrect TCSASOFT definition as an enum type because it's
actually a bitfield.
|
|
|
|
Nothing that nix currently binds is architecture-specific, and Android
supports ptrace just as much as non-Android Linux.
|
|
The test_ioctl values are computed using ioctl-test.c
|
|
Seems that pretty much all aio tests fail on x64 musl builds.
|
|
|
|
|