Skip to content

Commit d40416f

Browse files
committed
freebsd: attempt to guess physical location of kernel searching for kernload
1 parent f5c4302 commit d40416f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

volatility3/framework/automagic/freebsd.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,17 @@ def stack(
7373
# Freebsd amd64
7474
if "KPML4phys" in table.symbols:
7575
layer_class = intel.Intel32e
76+
kernload_offset = 0
77+
kernload = table.get_symbol("kernload").address
78+
for interp in layer.scan(context = context, scanner = scanners.BytesScanner(b"/red/herring\x00\x00\x00\x00"), progress_callback = progress_callback):
79+
kernload_from_interp = interp & 0xfffffffffffff800
80+
# Verify 2MB alignment
81+
if kernload_from_interp & 0x1fffff == 0:
82+
kernload_offset = kernload_from_interp - kernload
83+
break
7684
kernbase = table.get_symbol("kernbase").address
7785
kpml4phys_ptr = table.get_symbol("KPML4phys").address
78-
kpml4phys_str = layer.read(kpml4phys_ptr - kernbase, 8)
86+
kpml4phys_str = layer.read(kpml4phys_ptr - kernbase + kernload_offset, 8)
7987
dtb = struct.unpack("<Q", kpml4phys_str)[0]
8088
# Freebsd i386
8189
elif "IdlePTD" in table.symbols:

0 commit comments

Comments
 (0)