ClangBuiltLinux / boot-utils

Collection of files for booting Linux kernels
26 stars 7 forks source link

disable KASLR when using GDB #15

Closed nickdesaulniers closed 4 years ago

nickdesaulniers commented 4 years ago

I was pulling my hair out trying to debug https://github.com/ClangBuiltLinux/linux/issues/852 since breakpoints I set were never hit.

Sami Tolvanen (@samitolvanen) reminded me I need to disable KASLR via nokaslr kernel command line parameter.

Separate out the -append string from QEMU_ARCH_ARGS, since we need to change it both for interactive and debug mode.

ojeda commented 4 years ago

Perhaps a comment somewhere could be nice as a remainder.

nickdesaulniers commented 4 years ago

I wonder if I can extend vmlinux-gdb.py to warn if the kernel was booted with KASLR that it's basically not going to work for any debugging.

ojeda commented 4 years ago

@nickdesaulniers That would be way better, yeah!

kees commented 4 years ago

There's only so many places the kernel can be in memory. It shouldn't be too hard to search quickly for the correct KASLR base. What is the right way to update gdb's sense of the base address, though, once its has been located?