Giter Club home page Giter Club logo

rust-ptrace-example's Introduction

Rust ptrace example

This repo contains an example of using the ptrace system call from Rust to start and control the execution of a child process.

Profiling flow

The example was initially intended to become a statistic profiler. The current steps are:

  • The profiler main process starts.
  • The profiler forks itself.
    • The child immediately raises a SIGSTOP.
    • The parent waits for its child to stop using waitpid(UNTRACED).
  • At this point, the profiler attaches itself to the child using ptrace.
  • Also using ptrace, the child process is allowed to continue execution.
  • The child performs an exec call to start the python3 interpreter (at this point, the child stops and the profiler is notified of this).
  • Python then executes another exec call (again the profiler is notified).
  • The profiler allows the child to execute and waits for a given interval.
  • After a given interval, it stops the child using ptrace.

rust-ptrace-example's People

Contributors

gabrielmajeri avatar

Watchers

James Cloos avatar  avatar

rust-ptrace-example's Issues

Refactor process tracing code

The current code directly uses system calls and the child's PID to control the profilee. This should be abstracted away in composable functions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.