mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
nokaslr, thanks to @dakami at close #12
This commit is contained in:
@@ -34,7 +34,10 @@ which counts to infinity to stdout, and then in GDB:
|
||||
|
||||
And you now control the counting from GDB.
|
||||
|
||||
See also: <http://stackoverflow.com/questions/11408041/how-to-debug-the-linux-kernel-with-gdb-and-qemu>
|
||||
See also:
|
||||
|
||||
- <http://stackoverflow.com/questions/11408041/how-to-debug-the-linux-kernel-with-gdb-and-qemu/33203642#33203642>
|
||||
- <http://stackoverflow.com/questions/4943857/linux-kernel-live-debugging-how-its-done-and-what-tools-are-used/42316607#42316607>
|
||||
|
||||
`O=0` is an impossible dream, `O=2` being the default: <https://stackoverflow.com/questions/29151235/how-to-de-optimize-the-linux-kernel-to-and-compile-it-with-o0> So get ready for some weird jumps, and `<value optimized out>` fun. Why, Linux, why.
|
||||
|
||||
@@ -73,6 +76,8 @@ Just don't forget to remove your breakpoints after `rmmod`, or they will point t
|
||||
|
||||
TODO: why does `break work_func` for `insmod kthread.ko` not break the first time I `insmod`, but breaks the second time?
|
||||
|
||||
See also: <http://stackoverflow.com/questions/28607538/how-to-debug-linux-kernel-modules-with-qemu/44095831#44095831>
|
||||
|
||||
### Bypassing lx-symbols
|
||||
|
||||
Useless, but a good way to show how hardcore you are. From inside QEMU:
|
||||
|
||||
4
run
4
run
@@ -10,7 +10,9 @@ kgdb=false
|
||||
nographic=false
|
||||
# norandmaps: Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space.
|
||||
# printk.time=y: log in format: "[time ] msg" for all printk messages.
|
||||
extra_append='norandmaps printk.devkmsg=on printk.time=y'
|
||||
# nokaslr: https://unix.stackexchange.com/questions/397939/turning-off-kaslr-to-debug-linux-kernel-using-qemu-and-gdb
|
||||
# Turned on by default since v4.12
|
||||
extra_append='nokaslr norandmaps printk.devkmsg=on printk.time=y'
|
||||
extra_flags=''
|
||||
while getopts a:de:knqt:x OPT; do
|
||||
case "$OPT" in
|
||||
|
||||
3
rungdb
3
rungdb
@@ -42,9 +42,6 @@ if "$kgdb"; then
|
||||
else
|
||||
case "$arch" in
|
||||
'x86_64')
|
||||
# http://stackoverflow.com/questions/11408041/how-to-debug-the-linux-kernel-with-gdb-and-qemu/33203642#33203642
|
||||
# http://stackoverflow.com/questions/4943857/linux-kernel-live-debugging-how-its-done-and-what-tools-are-used/42316607#42316607
|
||||
# http://stackoverflow.com/questions/28607538/how-to-debug-linux-kernel-modules-with-qemu/44095831#44095831
|
||||
cmd="$gdb \
|
||||
-q \
|
||||
-ex 'add-auto-load-safe-path $(pwd)' \
|
||||
|
||||
Reference in New Issue
Block a user