Skip to content

A Rust crate for spawning a Linux process with ptrace enabled

License

Notifications You must be signed in to change notification settings

luser/spawn-ptrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status crates.io

This crate allows you to spawn a child process with ptrace enabled. It provides a single trait—CommandPtraceSpawn—that is implemented for std::process::Command, giving you access to a spawn_ptrace method.

Processes spawned this way will be stopped with SIGTRAP from their exec, so you can perform any early intervention you require prior to the process running any code and then use PTRACE_CONT to resume its execution.

Example

use std::io;
use spawn_ptrace::CommandPtraceSpawn;
use std::process::Command;

fn main() -> io::Result<()> {
   let child = Command::new("/bin/ls").spawn_ptrace()?;
   // call `ptrace(PTRACE_CONT, child.id(), ...)` to continue execution
   // do other ptrace things here...
   Ok(())
}

For a practical example of this crate's usage, see my tracetree tool.

License

This software is provided under the MIT license. See LICENSE.

About

A Rust crate for spawning a Linux process with ptrace enabled

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages