Skip to content

Instantly share code, notes, and snippets.

@moyix
Created February 16, 2019 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moyix/a0e327ed95ad4a2d567fdb57bb22887d to your computer and use it in GitHub Desktop.
Save moyix/a0e327ed95ad4a2d567fdb57bb22887d to your computer and use it in GitHub Desktop.
shell sleep 5
set logging file UUID.gdb.log
set logging on
target remote localhost:9999
file /nas/brendan/syzkaller_recordings/kernels/UUID/vmlinux
break panic
commands 1
break __delay
c
end
c
maint packet qPandaCmd:when
dump memory UUID.bin log_buf log_buf+log_buf_len
q
#!/bin/bash
UUID=${1}
# Unzip. Done in parallel because pigz can't decompress in parallel.
unpigz /nas/brendan/syzkaller_recordings/replays/${UUID}.exe/${UUID}.exe-rr-snp.gz &
lz4 /nas/brendan/syzkaller_recordings/replays/${UUID}.exe/${UUID}.exe-rr-nondet.log.lz4 &
unpigz /nas/brendan/syzkaller_recordings/kernels/${UUID}/vmlinux.gz &
wait
logf=$(mktemp $(pwd)/qemu_log_XXXXXXX)
~/git/panda/build/x86_64-softmmu/qemu-system-x86_64 -m 4G -replay /nas/brendan/syzkaller_recordings/replays/${UUID}.exe/${UUID}.exe -gdb tcp::9999 -S &> ${logf} &
qemu_pid=$!
# Wait for the replay to start before trying to connect via gdb
until cat ${logf} | grep -m1 "opening nondet log for read"; do sleep .1 ; done
sleep .5
sed "s/UUID/${UUID}/g" ~/gdbcmds.txt > ${UUID}.gdb
gdb -x ${UUID}.gdb < /dev/null
kill ${qemu_pid}
mv ${logf} ${UUID}.qemu.log
# Rezip
pigz /nas/brendan/syzkaller_recordings/replays/${UUID}.exe/${UUID}.exe-rr-snp \
/nas/brendan/syzkaller_recordings/kernels/${UUID}/vmlinux
rm /nas/brendan/syzkaller_recordings/replays/${UUID}.exe/${UUID}.exe-rr-nondet.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment