Bug 249369

Summary: device dtrace and device dtraceall are incompatible with options ZFS
Product: Base System Reporter: Trond.Endrestol
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Trond.Endrestol 2020-09-16 11:05:43 UTC
I have a custom kernel which specifies

device dtrace
device dtraceall

along with

options ZFS

While booting the custom kernel, amd64 r365792, I get this crash dump:

Fatal trap 12: page fault while in kernel mode
cpuid = 5; apic id = 0a
fault virtual address   = 0x7fffffff8
fault code              = supervisor write data, page not present
instruction pointer     = 0x20:0xffffffff8081c16b
stack pointer           = 0x28:0xfffffe000dffeb00
frame pointer           = 0x28:0xfffffe000dffeb80
code segment            = base rx0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 0 (dtrace_taskq)
trap number             = 12
panic: page fault
cpuid = 5
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at
vpanic() at
panic() at
trap_fatal() at
trap_pfault() at
trap() at
calltrap() at
--- trap 0xc, rip = 0xffffffff8081c16b, rsp = 0xfffffe000dffeb00, rbp= 0xfffffe000dffeb80 ---
osd_set_reserved() at
taskqueue_thread_loop() at
fork_exit() at
fork_trampoline() at
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---
KDB: enter: panic
[ thread pid 0 tid 100109 ]
Stopped at
db>

Note: The keyboard is unresponsive at this point.

Is there a way to specify a dump device from loader(8)?

Disabling DTrace in the kernel config, both device dtrace and device dtraceall, lets the kernel boot properly.
Specifying dtraceall_load="YES" in /boot/loader.conf compensates for the missing in-kernel DTrace support.
BTW, is there a way of compiling and linking the systrace_freebsd32 module as part of the monolithic kernel?