際際滷

際際滷Share a Scribd company logo
* Based on kernel 6.2 (x86_64)  QEMU
* 2-socket CPUs (4 cores/socket)
* 16GB memory
* Kernel parameter: nokaslr norandmaps
* KASAN: disabled
* Userspace: ASLR is disabled
* Host OS: Ubuntu 20.04.1
qemu + gdb + sample_code: Run sample code in
QEMU OS and observe Linux Kernel behavior
Adrian Huang | Apr, 2023
qemu + gdb: The efficient way to
understand/debug Linux kernel code/data
structure
Refer this slide first:
Console #2: gdb console
Console #1: QEMU: Guest OS
Observe page fault behavior about mmap address:
Conditional breakpoint
gdb-files/gdb-linux-kernel-real-mode.txt
 0x7ffff7ff9000 is the mmap address provide by Linux Kernel
 Reference: Memory Mapping Implementation (mmap) in Linux Kernel
 Sample code to trigger the conditional breakpoint: t_mmap.c
Note

More Related Content

qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel behavior

  • 1. * Based on kernel 6.2 (x86_64) QEMU * 2-socket CPUs (4 cores/socket) * 16GB memory * Kernel parameter: nokaslr norandmaps * KASAN: disabled * Userspace: ASLR is disabled * Host OS: Ubuntu 20.04.1 qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel behavior Adrian Huang | Apr, 2023
  • 2. qemu + gdb: The efficient way to understand/debug Linux kernel code/data structure Refer this slide first:
  • 3. Console #2: gdb console Console #1: QEMU: Guest OS Observe page fault behavior about mmap address: Conditional breakpoint gdb-files/gdb-linux-kernel-real-mode.txt 0x7ffff7ff9000 is the mmap address provide by Linux Kernel Reference: Memory Mapping Implementation (mmap) in Linux Kernel Sample code to trigger the conditional breakpoint: t_mmap.c Note