Skip to content
Open
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Checkpointing
## Requirements
This system was tested on linux with kernel version >= 6.11.5.

## Setup

in `/get-tasks`:

```
make
make install
make install
```
(use `make reinstall` to reinstall the kernel extension)

in `/app`:

Expand All @@ -21,8 +24,13 @@ in `/`:
gcc hello-world.c -O3 -no-pie -fno-pic -static
```

## Run
Anywhere:
```
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space # disables ASLR
```

## Run
### GDP & kernel extension
in `/`:

```
Expand All @@ -40,3 +48,9 @@ sudo ./target/debug/app read <PID>
sudo ./target/debug/app dump <PID> hello.proc
sudo ./target/debug/app restore hello.proc
```

### ptrace only
in `/app`
```
sudo ./run.sh
```
27 changes: 27 additions & 0 deletions app/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

SESSION_NAME="runner"

# Setup tmux session
tmux new-session -d -s $SESSION_NAME
tmux split-window -h -t $SESSION_NAME

# Starts a.out in the second pane and retrieves the pid of the process
tmux send-keys -t $SESSION_NAME:0.1 "cd .." C-m
tmux send-keys -t $SESSION_NAME:0.1 "./a.out & echo \$! > /tmp/a_out_pid" C-m
sleep 2

A_OUT_PID=$(cat /tmp/a_out_pid)
rm -f /tmp/a_out_pid

echo "PID of a.out: $A_OUT_PID"

# starts the restore process using the pid found
tmux send-keys -t $SESSION_NAME:0.0 "./target/debug/app ptrace-restore $A_OUT_PID hello.proc" C-m

# Attach to tmux and setup kill-session on exit
tmux set-option -t $SESSION_NAME destroy-unattached off
tmux set-option -t $SESSION_NAME remain-on-exit off
tmux set-hook -t $SESSION_NAME pane-exited "kill-session"

tmux attach-session -t $SESSION_NAME
Loading