summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/sys/memfd.rs6
-rw-r--r--src/sys/ptrace.rs4
3 files changed, 9 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 13a7104b..0f2d0754 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#768](https:://github.com/nix-rust/nix/pull/768))
- Added `nix::unistd::mkfifo`.
([#602](https://github.com/nix-rust/nix/pull/774))
+- Added `ptrace::Options::PTRACE_O_EXITKILL` on Linux and Android.
+ ([#771](https://github.com/nix-rust/nix/pull/771))
### Changed
- Renamed existing `ptrace` wrappers to encourage namespacing ([#692](https://github.com/nix-rust/nix/pull/692))
diff --git a/src/sys/memfd.rs b/src/sys/memfd.rs
index 056e9e43..88c1dac9 100644
--- a/src/sys/memfd.rs
+++ b/src/sys/memfd.rs
@@ -3,10 +3,10 @@ use std::os::unix::io::RawFd;
use {Errno, Result};
use std::ffi::CStr;
-bitflags!(
+libc_bitflags!(
pub struct MemFdCreateFlag: libc::c_uint {
- const MFD_CLOEXEC = 0x0001;
- const MFD_ALLOW_SEALING = 0x0002;
+ MFD_CLOEXEC;
+ MFD_ALLOW_SEALING;
}
);
diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs
index 64b523c3..43a78862 100644
--- a/src/sys/ptrace.rs
+++ b/src/sys/ptrace.rs
@@ -116,6 +116,10 @@ libc_bitflags! {
/// Stop tracee when a SECCOMP_RET_TRACE rule is triggered. See `man seccomp` for more
/// details.
PTRACE_O_TRACESECCOMP;
+ /// Send a SIGKILL to the tracee if the tracer exits. This is useful
+ /// for ptrace jailers to prevent tracees from escaping their control.
+ #[cfg(any(target_os = "android", target_os = "linux"))]
+ PTRACE_O_EXITKILL;
}
}