Skip to main content

ProcessProtection

Trait ProcessProtection 

Source
pub trait ProcessProtection {
    // Required methods
    fn lock_memory(&self) -> Result<(), ProtectionError>;
    fn disable_core_dump(&self) -> Result<(), ProtectionError>;
    fn disable_ptrace(&self) -> Result<(), ProtectionError>;

    // Provided method
    fn apply_all(&self) -> Result<(), ProtectionError> { ... }
}
Expand description

Platform-agnostic process protection interface.

Required Methods§

Source

fn lock_memory(&self) -> Result<(), ProtectionError>

Lock all current + future process memory — block swap / paging.

Source

fn disable_core_dump(&self) -> Result<(), ProtectionError>

Disable core dump generation.

Source

fn disable_ptrace(&self) -> Result<(), ProtectionError>

Block ptrace / debugger attach.

Contract: an Ok(()) return guarantees that, at the moment of the call, no debugger is currently attached and the platform-specific deny / detect primitive succeeded. Existing attach is reported as ProtectionError::DebuggerAttached so callers cannot read .is_ok() as “no debugger” — the m6 silent- success regression is closed.

Platform behaviour:

  • Linuxprctl(PR_SET_PTRACER, 0) proactively denies future attaches; /proc/self/status TracerPid != 0 returns DebuggerAttached. The system-wide yama.ptrace_scope advisory remains a stderr warning (per-process API cannot override system policy).
  • macOSptrace(PT_DENY_ATTACH) actively denies, so a successful call implies no attach.
  • WindowsIsDebuggerPresent / CheckRemoteDebuggerPresent detection only; attach surfaces DebuggerAttached. Windows has no portable self-deny primitive.

Provided Methods§

Source

fn apply_all(&self) -> Result<(), ProtectionError>

Apply all three — Runtime startup capability check.

Implementors§