Kernel Debugging and Virtualization John Baldwin January 15, 2015 - - PowerPoint PPT Presentation

kernel debugging and virtualization
SMART_READER_LITE
LIVE PREVIEW

Kernel Debugging and Virtualization John Baldwin January 15, 2015 - - PowerPoint PPT Presentation

Kernel Debugging and Virtualization John Baldwin January 15, 2015 What is Kernel Debugging Step in Kernel Development Post-Mortem Crash Analysis Live Inspection Performance Analysis Userland Debugging Wait, Userland


slide-1
SLIDE 1

Kernel Debugging and Virtualization

John Baldwin January 15, 2015

slide-2
SLIDE 2

What is Kernel Debugging

  • Step in Kernel Development
  • Post-Mortem Crash Analysis
  • Live Inspection
  • Performance Analysis
  • Userland Debugging
slide-3
SLIDE 3

Wait, Userland Debugging?

  • Userland Debugging == User Process

Debugging

  • Processes Have In-Kernel State
  • Not Exposed via gdb/lldb
  • Other Tools like lsof/fstat/procstat
  • Not All State Exposed via Tools

– “Which FDs is a thread waiting on in select() / poll() /

kqueue()?”

– “Which directory is a thread waiting on a lock for?”

slide-4
SLIDE 4

Similarities to User Process Debugging

  • Kernel is Like a Multithreaded Process
  • Shared Address Space
  • Threads With Stacks
  • Memory Dumps
slide-5
SLIDE 5

Differences from User Process Debugging

  • Longer Turnaround (Rebooting is Slow)
  • More Setup Required for Full Debug
  • Can Debug Itself (but Limited)
slide-6
SLIDE 6

Kernel Debugging Tools on FreeBSD

  • printf()
  • Often tool of “first resort”
  • Recompile / reboot to log “new” data
  • Run Time Checks
  • Assertions
  • WITNESS
  • DEADLKRES
  • malloc() Debugging
slide-7
SLIDE 7

Kernel Debugging Tools on FreeBSD

  • Crash Dumps
  • Memory Dumps

– ps(1), netstat(1), etc.

  • Text Dumps
  • In-kernel Debugger (DDB)
  • Console Access Required
  • Extendable
  • Variable Examination is Primitive
  • Stops System
slide-8
SLIDE 8

Kernel Debugging Tools on FreeBSD

  • kgdb
  • Different Targets

– Crash Dump – Live (Does Not Stop System) – Remote (OOB Connection)

  • Mature Variable Expansion
  • Extendable via Scripts
  • dtrace
slide-9
SLIDE 9

Virtualization Makes It Better

  • Isolation on a Single Machine
  • Quicker Turn Around (Reboot)
  • Console Access and OOB are Simple
  • /dev/nmdm<foo> vs Physical Cables
  • Device Pass Through
slide-10
SLIDE 10

Demo