Skip to content

mlafeldt/sysrq

Repository files navigation

sysrq

Go client to perform low-level commands via the Linux SysRq interface (accessible at /proc/sysrq-trigger).

Among other things, SysRq can crash the system by forcing a NULL pointer dereference, which makes it a good fit for Chaos Engineering experiments.

CLI

In addition to the Go library, there's a sysrq command-line tool you can install from source:

go get -u github.com/mlafeldt/sysrq/cmd/sysrq

Use the tool to trigger one or more commands:

sudo sysrq <cmd>...

This will print a list of all available commands:

sysrq -list

Vagrant playground

Here's how to run SysRq commands against a local Vagrant machine:

# Start Vagrant machine
vagrant up

# Trigger crash command
make trigger CMD=crash

# Show system logs
make log
...
ubuntu-xenial login: [   94.116848] sysrq: SysRq : Trigger a crash
[   94.152571] BUG: unable to handle kernel NULL pointer dereference at           (null)
[   94.263679] IP: [<ffffffff81504df6>] sysrq_handle_crash+0x16/0x20
...

# Fix Vagrant machine
vagrant reload

Docker

Since Docker mounts /proc/sysrq-trigger as read-only, you cannot run commands against other containers, but you can still affect the host system:

docker run --rm -v /proc/sysrq-trigger:/sysrq -e TRIGGER_FILE=/sysrq mlafeldt/sysrq <cmd>...

Author

This project is being developed by Mathias Lafeldt.

About

Go client to the Linux SysRq interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published