DragonFlyBSD Kernel Audit
DF-0796 / panic.txt
← back to finding ↓ download raw
DF-0796 — NULL deref in hammer2_inode_chain_and_parent
Deterministic KLD harness on DragonFly 6.5-DEVELOPMENT #0 (unpatched baseline)

Harness stdout (from serial console):
  DF-0796: loading NULL-cluster-slot harness
  DF-0796: invoking hammer2_inode_chain_and_parent on inode with NULL chain slot (clindex=0, nchains=2)
  DF-0796: expect NULL-deref panic at hammer2_inode_chain_and_parent+0x.. (chain->parent)

Kernel panic:
  Fatal user address access from kernel mode from kldload at ffffffff802aad04

  Fatal trap 12: page fault while in kernel mode
  cpuid = 1; lapic id = 1
  fault virtual address   = 0x118
  fault code              = supervisor read data, page not present
  instruction pointer     = 0x8:0xffffffff802aad04
  stack pointer           = 0x10:0xfffff8011835f778
  frame pointer           = 0x10:0xfffff8011835f7b8
  processor eflags        = interrupt enabled, resume, IOPL = 0
  current process         = 1226
  kernel: type 12 trap, code=0

  CPU1 stopping CPUs: 0x0000003d
   stopped
  Stopped at      hammer2_inode_chain_and_parent.cold.9+0x15:  movq    0x118,%rax
  db>

Interpretation:
  fault VA 0x118 = offsetof(hammer2_chain, parent) added to a NULL base pointer
  (chain == NULL).  movq 0x118(%rax),%rax with %rax=0 is exactly the unchecked
  `parent = chain->parent;` dereference at sys/vfs/hammer2/hammer2_inode.c:453.