Info | ||
---|---|---|
| ||
Copyright 2015 by Assured Information Security, Inc. Created by Ross Philipson <philipsonr@ainfosec.com>. This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. |
Table of Contents |
---|
Introduction
...
Everything is in place to do some actual debugging. To ready the target, the kernel execution must be halted and ready to receive a connection from the debugger this is done two ways. One is to add the kgdbwait
parameter to the kernel command line in addition to the parameter that were added earlier. More on that parameter can be found in the KGDB documentation. The second which will be used here is to use the magix magic of sysrq. In the target VM, open a terminal as root and:
...
Modifications can be made to the kernel image on the target, the changes can be rsync'ed d to the host. Then the target can be rebooted and kernel debugging can be resumed.
...
Note that "kgdb" in the path is simply the example local version from above. Now the new driver is in place, the code for the drivers including the local changes on the target need to be sync'ed d with the host VM so it has access to the binaries, symbols and source. Do this with rsync again:
...
First the kernel will need a command line parameter to configure the serial port. Edit /etc/default/grub
and set GRUB_CMDLINE_LINUX="console=ttyS0,115200n8"
. Note if there were already values set, the serial one can be appended. Then update grub and reboot:
$ sudo update-grub; rebootpoweroff
Next the emulated QEMU serial port is setup to redirect the kernel trace to another host:
...