Giter Club home page Giter Club logo

syz-rrr's Introduction

syz-rrr

Screenshot

syz-rrr is a full-system deterministic record and replay tool based on PANDA.

It specializes in tracing syzkaller bug reproducers but can actually record and replay any sort of user space stimulus against a Linux kernel.

Capabilities

syz-rrr is capable of:

  • Grabbing a kernel tree and syzkaller bug reproducer from a syzbot bug URL
  • Building a kernel tree and extracting its debugging info for PANDA's OSI
  • Compiling out the sanitizers not necessary for the bug (to keep things fast)
  • Building a userspace stimulus and extracting its symbol information
  • Generating a minimal rootfs qcow2 disk image that chains into the stimulus
  • Taking a snapshot at the end of the boot scrippt (just before the stimulus)
  • Grabbing a deterministic PANDA record of the stimulus execution
  • Replaying the PANDA record at will (gdb's rr can be attached)
  • Recording a full-system function call graph (with args) across all threads
  • Writing that trace in the Perfetto protobuf format
  • Serving that trace as a RPC server so it can be visualized in Perfetto
  • Caching every step of the way to keep things fast and interactive

Usage

syz-rrr is primarily meant to be used interactively from a Jupyter notebook.

To ease the setup, a docker container is provided which can be started with:

docker compose up

This exposes a Jupyter runtime on port 8888 protected by the password "rrr". Remember you can open terminals or files in the container from the Jupyter UI.

A demo notebook is available at: http://127.0.0.1:8888/notebooks/rrr.ipynb You can use the "Run All Cells" menu to have it trace an example syzbot bug. This can take up to one hour to run so give it some time. At the end of the execution you can access the function call graph at https://ui.perfetto.dev/

API

The API can be as simple to use as this:

import rrr

# Build a kernel and rootfs from a syzbot bug
kernel, rootfs = rrr.from_syzbot("c6d438f2d77f96cae7c2")

# Record the execution of that bug
record = rrr.record(kernel, rootfs)

# Trace a function call graph of that record
trace = rrr.trace(kernel, rootfs, record)

# Expose it to Perfetto
rrr.serve_trace(trace)

But rootfs and kernel objects can also be constructed in other ways, e.g:

# Create a rootfs that will run a custom provided stimulus
rootfs = rrr.Rootfs(rrr.Stimulus("/path/to/stimulus.c"))

# Use an already-checked out kernel tree
kernel = rrr.Kernel("/path/to/linux/tree")

Remember that when using the the Docker container, these paths must be expressed within the container. Therefore, you may want to map a host directory when starting the container, e.g:

docker run --network host -v $HOME/linux/:/linux/ -it florentrevest/syz-rrr:latest

syz-rrr's People

Contributors

jakob-koschel avatar florentrevest avatar

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.