Bug 287482 - panic: VERIFY3(zfs_btree_find(tree, node, &where) == NULL) failed
Summary: panic: VERIFY3(zfs_btree_find(tree, node, &where) == NULL) failed
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.3-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Mark Johnston
URL:
Keywords: crash
Depends on:
Blocks:
 
Reported: 2025-06-12 15:46 UTC by mike
Modified: 2025-08-31 10:32 UTC (History)
7 users (show)

See Also:


Attachments
full boot log (14.62 KB, text/plain)
2025-06-12 15:46 UTC, mike
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description mike 2025-06-12 15:46:57 UTC
Created attachment 261203 [details]
full boot log

Using a 14.3 VM image seems to panic when periodic daily runs. This panic happens in the VM under beehyve as well when the underlying image is transferred to a disk and booted up on real hardware. 

vmrun.sh -t tap0 -d ./143.raw -E vm0

root@freebsd:~ # periodic daily
panic: VERIFY3(zfs_btree_find(tree, node, &where) == NULL) failed 
(0xfffff8001cc99ba0x == 0x)

cpuid = 1
time = 1749727473
KDB: stack backtrace:
#0 0xffffffff80ba8f1d at kdb_backtrace+0x5d
#1 0xffffffff80b5aa11 at vpanic+0x161
#2 0xffffffff82181c4a at spl_panic+0x3a
#3 0xffffffff821d4aae at zfs_btree_add+0x6e
#4 0xffffffff82315905 at zap_lockdir_impl+0x325
#5 0xffffffff823155a4 at zap_lockdir+0x84
#6 0xffffffff82318b15 at zap_cursor_retrieve+0x175
#7 0xffffffff821a01a3 at zfs_freebsd_readdir+0x383
#8 0xffffffff81112050 at VOP_READDIR_APV+0x20
#9 0xffffffff80c56a19 at kern_getdirentries+0x229
#10 0xffffffff80c56dc9 at sys_getdirentries+0x29
#11 0xffffffff8104e4c7 at amd64_syscall+0x117
#12 0xffffffff8102469b at fast_syscall_common+0xf8
Uptime: 24s
Automatic reboot in 15 seconds - press a key on the console to abort
--> Press a key on the console to reboot,
--> or switch off the system now.

full boot log attached.

discussed in 
https://lists.freebsd.org/archives/freebsd-stable/2025-June/002884.html
Comment 1 mike 2025-06-12 17:47:51 UTC
FYI, tested a fresh image running inside a KVM hypervisor and same issue


root@freebsd:~ # 
root@freebsd:~ # periodic daily
panic: VERIFY3(zfs_btree_find(tree, node, &where) == NULL) failed (0xfffff80189892fa0x == 0x)

cpuid = 2
time = 1749750457
KDB: stack backtrace:
#0 0xffffffff80ba8f1d at kdb_backtrace+0x5d
#1 0xffffffff80b5aa11 at vpanic+0x161
#2 0xffffffff82181c4a at spl_panic+0x3a
#3 0xffffffff821d4aae at zfs_btree_add+0x6e
#4 0xffffffff82315905 at zap_lockdir_impl+0x325
#5 0xffffffff823155a4 at zap_lockdir+0x84
#6 0xffffffff82318b15 at zap_cursor_retrieve+0x175
#7 0xffffffff821a01a3 at zfs_freebsd_readdir+0x383
#8 0xffffffff81112050 at VOP_READDIR_APV+0x20
#9 0xffffffff80c56a19 at kern_getdirentries+0x229
#10 0xffffffff80c56dc9 at sys_getdirentries+0x29
#11 0xffffffff8104e4c7 at amd64_syscall+0x117
#12 0xffffffff8102469b at fast_syscall_common+0xf8
Uptime: 32s
Automatic reboot in 15 seconds - press a key on the console to abort
Comment 2 karl 2025-06-12 17:50:47 UTC
Of note I am running a "slightly early" 14.3-STABLE here:

FreeBSD 14.3-STABLE #15 stable/14-n271618-0fe58344e829-dirty: Mon Jun  9 15:03:41 EDT 2025

have not had a panic and do have the usual periodic stuff running.

This might be useful for bisection.
Comment 3 mike 2025-06-12 18:01:57 UTC
(In reply to karl from comment #2)
If I had to guess, its probably something to do with the way the image file was created on which 14.3R was laid over.

If I start with a 14.2 VM image and then do freebsd-update upgrade -r 14.3, the result is as expected with everything working fine. 

If you want to reproduce it, try downloading a freebsd-14.3R VM image, and boot it up, login and just run 
periodic daily 
and see what happens.
Comment 4 mike 2025-06-12 18:40:28 UTC
I tried with a different image and it seems to be ok in that it at least passes the periodic daily test

vmrun.sh -t tap0 -d /baseimage/FreeBSD-14.3-RELEASE-amd64-BASIC-CLOUDINIT-zfs.raw -E -H vm0/host vm0
realpath: vm0/host: No such file or directory
Launching virtual machine "vm0" ...
fbuf frame buffer base: 0x3d59e5200000 [sz 16777216]
3h
3h
3h
BdsDxe: loading Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x3,0x0)
BdsDxe: starting Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x3,0x0)
Consoles: EFI console  
    Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p2:
FreeBSD/amd64 EFI loader, Revision 3.0

   Command line arguments: loader.efi
   Image base: 0x1e27a000
   EFI version: 2.70
   EFI Firmware: BHYVE (rev 1.00)
   Console: efi (0x20001000)
   Load Path: \EFI\BOOT\BOOTX64.EFI
   Load Device: PciRoot(0x0)/Pci(0x3,0x0)/HD(2,GPT,0CE8BF9D-42BC-11F0-9E0B-002590EC5BF2,0x17B,0x10418)
   BootCurrent: 0001
   BootOrder: 0000 0001[*] 0002 0003 0004
   BootInfo Path: PciRoot(0x0)/Pci(0x3,0x0)
Ignoring Boot0001: Only one DP found
Trying ESP: PciRoot(0x0)/Pci(0x3,0x0)/HD(2,GPT,0CE8BF9D-42BC-11F0-9E0B-002590EC5BF2,0x17B,0x10418)
Setting currdev to disk0p2:
Trying: PciRoot(0x0)/Pci(0x3,0x0)/HD(1,GPT,0CE8BF95-42BC-11F0-9E0B-002590EC5BF2,0x22,0x159)
Setting currdev to disk0p1:
Trying: PciRoot(0x0)/Pci(0x3,0x0)/HD(3,GPT,0CE8BFA1-42BC-11F0-9E0B-002590EC5BF2,0x10593,0x200000)
Setting currdev to disk0p3:
Trying: PciRoot(0x0)/Pci(0x3,0x0)/HD(4,GPT,0CE8BFA5-42BC-11F0-9E0B-002590EC5BF2,0x210593,0x800)
Setting currdev to disk0p4:
Trying: PciRoot(0x0)/Pci(0x3,0x0)/HD(5,GPT,0CE8BFAB-42BC-11F0-9E0B-002590EC5BF2,0x210D93,0xA00000)
Setting currdev to zfs:zroot/ROOT/default:
|
Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
console vidconsole is unavailable
Loading /boot/loader.conf.local
\
Loading kernel...
/boot/kernel/kernel text=0x180078 text=0xd97948 text=0x43a46b data=0x180+0xe80 data=0x187590+0x478a70 0x8+0x18e940+0x8+0x1b2b03\
Loading configured modules...
/boot/kernel/zfs.ko size 0x5e9340 at 0x2142000
can't find '/etc/hostid'
can't find '/boot/entropy'

Booting [/boot/kernel/kernel]...               
staging 0x14000000 (not copying) tramp 0x1df40000 PT4 0x1df27000
Start @ 0xffffffff80381000 ...
EFI framebuffer information:
addr, size     0xc0000000, 0x1000000
dimensions     1024 x 768
stride         1024
masks          0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
---<<BOOT>>---
Copyright (c) 1992-2023 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC amd64
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
VT(efifb): resolution 1024x768
CPU: Intel(R) N100 (800.00-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0xb06e0  Family=0x6  Model=0xbe  Stepping=0
  Features=0x9f83fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,SS,HTT,PBE>
  Features2=0xfeda7a17<SSE3,PCLMULQDQ,DTES64,DS_CPL,SSSE3,SDBG,FMA,CX16,xTPR,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  Structured Extended Features=0x201407a9<FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,RDSEED,SMAP,SHA>
  Structured Extended Features2=0x400600<VAES,VPCLMULQDQ,RDPID>
  Structured Extended Features3=0x400<MD_CLEAR>
  XSAVE Features=0x1<XSAVEOPT>
  TSC: P-state invariant
Hypervisor: Origin = "bhyve bhyve "
real memory  = 536870912 (512 MB)
avail memory = 471126016 (449 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <BHYVE  BVAPIC >
WARNING: L1 data cache covers fewer APIC IDs than a core (0 < 1)
WARNING: L2 data cache covers fewer APIC IDs than a core (0 < 1)
WARNING: L3 data cache covers fewer APIC IDs than a core (0 < 1)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 1 core(s) x 2 hardware threads
random: registering fast source Intel Secure Key RNG
random: fast provider: "Intel Secure Key RNG"
arc4random: WARNING: initial seeding bypassed the cryptographic random device because it was not yet seeded and the knob 'bypass_before_seeding' was enabled.
ioapic0 <Version 1.1> irqs 0-31
Launching APs: 1
random: entropy device external interface
kbd1 at kbdmux0
efirtc0: <EFI Realtime Clock>
efirtc0: registered as a time-of-day clock, resolution 1.000000s
smbios0: <System Management BIOS> at iomem 0x1fbd0000-0x1fbd001e
smbios0: Entry point: v2.1 (32-bit), Version: 2.8, BCD Revision: 2.8
aesni0: <AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS,SHA1,SHA256>
acpi0: <BHYVE BVFACP >
acpi0: Power Button (fixed)
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 16777216 Hz quality 950
Event timer "HPET" frequency 16777216 Hz quality 550
Event timer "HPET1" frequency 16777216 Hz quality 450
Event timer "HPET2" frequency 16777216 Hz quality 450
Event timer "HPET3" frequency 16777216 Hz quality 450
Event timer "HPET4" frequency 16777216 Hz quality 450
Event timer "HPET5" frequency 16777216 Hz quality 450
Event timer "HPET6" frequency 16777216 Hz quality 450
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
virtio_pci0: <VirtIO PCI (legacy) Network adapter> port 0x2080-0x20bf mem 0xc1002000-0xc1003fff irq 23 at device 2.0 on pci0
vtnet0: <VirtIO Networking Adapter> on virtio_pci0
vtnet0: Ethernet address: 00:a0:98:f0:55:05
vtnet0: netmap queues/slots: TX 1/1024, RX 1/512
000.000185 [ 452] vtnet_netmap_attach       vtnet attached txq=1, txd=1024 rxq=1, rxd=512
virtio_pci1: <VirtIO PCI (legacy) Block adapter> port 0x2000-0x207f mem 0xc1000000-0xc1001fff irq 16 at device 3.0 on pci0
vtblk0: <VirtIO Block Adapter> on virtio_pci1
vtblk0: 6177MB (12651956 512 byte sectors)
vgapci0: <VGA-compatible display> mem 0xc1004000-0xc100407f,0xc0000000-0xc0ffffff at device 29.0 on pci0
vgapci0: Boot video device
vmgenc0: <VM Generation Counter> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
driver bug: Unable to set devclass (class: atkbdc devname: (unknown))
Unhandled ps2 mouse command 0xe1
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
WARNING: Device "psm" is Giant locked and may be deleted before FreeBSD 15.0.
psm0: model Generic PS/2 mouse, device ID 0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (115200,n,8,1)
uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
uart2: <16550 or compatible> port 0x3e8-0x3ef irq 4 on acpi0
uart3: <16550 or compatible> port 0x2e8-0x2ef irq 3 on acpi0
vga0: <Generic ISA VGA> at port 0x3b0-0x3bb iomem 0xb0000-0xb7fff pnpid PNP0900 on isa0
Timecounter "TSC" frequency 806407392 Hz quality 1000
Timecounters tick every 10.000 msec
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
usb_needs_explore_all: no devclass
random: unblocking device.
Trying to mount root from zfs:zroot/ROOT/default []...
Dual Console: Serial Primary, Video Secondary
Setting hostuuid: c6361785-d3af-7031-a1a7-632cbe344f91.
Setting hostid: 0x9a7050ea.
This system supports ZFS pool feature flags.

Enabled the following features on 'zroot':
  async_destroy
  empty_bpobj
  lz4_compress
  multi_vdev_crash_dump
  spacemap_histogram
  enabled_txg
  hole_birth
  extensible_dataset
  embedded_data
  bookmarks
  filesystem_limits
  large_blocks
  large_dnode
  sha512
  skein
  edonr
  userobj_accounting
  encryption
  project_quota
  device_removal
  obsolete_counts
  zpool_checkpoint
  spacemap_v2
  allocation_classes
  resilver_defer
  bookmark_v2
  redaction_bookmarks
  redacted_datasets
  bookmark_written
  log_spacemap
  livelist
  device_rebuild
  zstd_compress
  draid
  zilsaxattr
  head_errlog
  blake3
  block_cloning
  vdev_zaps_v2

Pool 'zroot' has the bootfs property set, you might need to update
the boot code. See gptzfsboot(8) and loader.efi(8) for details.
Starting file system checks:
/dev/gpt/efiesp: FILESYSTEM CLEAN; SKIPPING CHECKS
Growing root partition to fill device
vtbd0 recovering is not needed
gpart: autofill: No space left on device
Mounting local filesystems:.
/etc/rc: ERROR: Impossible to find a cloud init provider
Setting hostname: freebsd.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg /usr/local/lib/compat/pkg
32-bit compatibility ldconfig path: /usr/lib32
Setting up harvesting: PURE_VMGENID,PURE_RDRAND,[CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
ifconfig: ioctl(SIOCGIFINFO_IN6): Invalid argument
ifconfig: ioctl(SIOCGIFINFO_IN6): Invalid argument
lo0: link state changed to UP
ifconfig: ioctl(SIOCGIFINFO_IN6): Invalid argument
ifconfig: ioctl(SIOCGIFINFO_IN6): Invalid argument
vtnet0: link state changed to UP
Starting dhclient.
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 192.168.241.129
DHCPREQUEST on vtnet0 to 255.255.255.255 port 67
DHCPACK from 192.168.241.129
bound to 192.168.241.132 -- renewal in 17881 seconds.
Starting Network: lo0 vtnet0.
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
vtnet0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether 00:a0:98:f0:55:05
        inet 192.168.241.132 netmask 0xffffff00 broadcast 192.168.241.255
        inet6 fe80::2a0:98ff:fef0:5505%vtnet0 prefixlen 64 scopeid 0x1
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
Starting devd.
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Updating /var/run/os-release done.
Clearing /tmp (X related).
Updating motd:.
Creating and/or trimming log files.
Starting syslogd.
No core dumps found.
freebsd-update 792 - - src component not installed, skipped
freebsd-update 792 - - Looking up update.FreeBSD.org mirrors... none found.
freebsd-update 792 - - Fetching public key from update.FreeBSD.org... failed.
freebsd-update 792 - - No mirrors remaining, giving up.
freebsd-update 792 - - 
freebsd-update 792 - - This may be because upgrading from this platform (amd64)
freebsd-update 792 - - or release (14.3-RELEASE) is unsupported by freebsd-update. Only
freebsd-update 792 - - platforms with Tier 1 support can be upgraded by freebsd-update.
freebsd-update 792 - - See https://www.freebsd.org/platforms/ for more info.
freebsd-update 792 - - 
freebsd-update 792 - - If unsupported, FreeBSD must be upgraded by source.
Mounting late filesystems:.
Starting cron.
Generating RSA host key.
3072 SHA256:pa9jjBQwS7j0mA0c5uOZRWu1A+G0fIK78pT5VpZmt5g root@freebsd (RSA)
Generating ECDSA host key.
256 SHA256:NG7hvu6/R+8q8CoRlSYb533tfv5QKjGejmAYEk3feCw root@freebsd (ECDSA)
Generating ED25519 host key.
256 SHA256:VQ9zp4G0CLHs7adARjqVQTKLHtLmYGlBYpfPVSmGbd8 root@freebsd (ED25519)
Performing sanity check on sshd configuration.
Starting sshd.
Starting background file system checks in 60 seconds.

Thu Jun 12 14:28:30 UTC 2025

FreeBSD/amd64 (freebsd) (ttyu0)

login: root
Jun 12 14:28:33 freebsd login[1179]: ROOT LOGIN (root) ON ttyu0
FreeBSD 14.3-RELEASE (GENERIC) releng/14.3-n271432-8c9ce319fef7

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List:        https://www.FreeBSD.org/lists/questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
root@freebsd:~ # periodic daily
root@freebsd:~ # 
root@freebsd:~ #
Comment 5 mike 2025-06-12 22:41:23 UTC
On another box that is 14.3 Stable just importing the pool and doing a find on the file system panics the host.  I built a GENERIC-DEBUG kernel and panic below. Again, this is the 14.3 release VM image. 


fetch https://download.freebsd.org/releases/VM-IMAGES/14.3-RELEASE/amd64/Latest/FreeBSD-14.3-RELEASE-amd64-zfs.raw.xz
xz -d FreeBSD-14.3-RELEASE-amd64-zfs.raw.xz
mdconfig -f FreeBSD-14.3-RELEASE-amd64-zfs.raw
md0
0{vbboxtest}# zpool import -fR /scratch/raw zroot zroot-zfs-raw

0{vbboxtest}# find /scratch/raw -type f > /dev/null 


 panic: VERIFY3(zfs_btree_find(tree, node, &where) == NULL) failed (0xfffff804eaf5b7a0x == 0x)

cpuid = 22
time = 1749782031
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe030f8dd6e0
vpanic() at vpanic+0x161/frame 0xfffffe030f8dd810
spl_panic() at spl_panic+0x3a/frame 0xfffffe030f8dd870
zfs_btree_add() at zfs_btree_add+0x6e/frame 0xfffffe030f8dd8a0
mze_insert() at mze_insert+0x96/frame 0xfffffe030f8dd8d0
zap_lockdir_impl() at zap_lockdir_impl+0x333/frame 0xfffffe030f8dd9a0
zap_lockdir() at zap_lockdir+0x84/frame 0xfffffe030f8dda10
zap_cursor_retrieve() at zap_cursor_retrieve+0x19b/frame 0xfffffe030f8dda80
zfs_freebsd_readdir() at zfs_freebsd_readdir+0x393/frame 0xfffffe030f8ddcb0
VOP_READDIR_APV() at VOP_READDIR_APV+0x32/frame 0xfffffe030f8ddcd0
kern_getdirentries() at kern_getdirentries+0x1d7/frame 0xfffffe030f8dddd0
sys_getdirentries() at sys_getdirentries+0x29/frame 0xfffffe030f8dde00
amd64_syscall() at amd64_syscall+0x15a/frame 0xfffffe030f8ddf30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe030f8ddf30
--- syscall (554, FreeBSD ELF64, getdirentries), rip = 0x17152e57721a, rsp = 0x17152d00e128, rbp = 0x17152d00e160 ---
KDB: enter: panic
[ thread pid 1803 tid 101650 ]
Stopped at      kdb_enter+0x33: movq    $0,0x101ddb2(%rip)
db> show pcpu
cpuid        = 22
dynamic pcpu = 0xfffffe0155a551c0
curthread    = 0xfffff801782f9740: pid 1803 tid 101650 critnest 1 "find"
curpcb       = 0xfffff801782f9c60
fpcurthread  = 0xfffff801782f9740: pid 1803 "find"
idlethread   = 0xfffff80105bcb740: tid 100025 "idle: cpu22"
self         = 0xffffffff82c26000
curpmap      = 0xfffff80107d1f600
tssp         = 0xffffffff82c26384
rsp0         = 0xfffffe030f8de000
kcr3         = 0xffffffffffffffff
ucr3         = 0xffffffffffffffff
scr3         = 0x0
gs32p        = 0xffffffff82c26404
ldt          = 0xffffffff82c26444
tss          = 0xffffffff82c26434
curvnet      = 0
spin locks held:
db> show registers
cs                        0x20
ds                        0x3b
es                        0x3b
fs                        0x13
gs                        0x1b
ss                        0x28
rax                       0x12
rcx         0xfeb0d8beedf6fff2
rdx         0xffffffff8129d1f0
rbx                      0x100
rsp         0xfffffe030f8dd6e8
rbp         0xfffffe030f8dd810
rsi         0xfffffe030f8dd5a0
rdi         0xffffffff81b803a0  cnputs_mtx
r8                        0x10
r9                        0x10
r10                        0xf
r11                       0x10
r12                          0
r13                     0x5a8e  _binary_elf_vdso_so_1_size+0x547e
r14         0xffffffff824c2c9a  .L.str.95+0x1feb
r15         0xfffff801782f9740
rip         0xffffffff80bbddd3  kdb_enter+0x33
rflags                    0x82
kdb_enter+0x33: movq    $0,0x101ddb2(%rip)
db>
Comment 6 mike 2025-06-12 23:01:58 UTC
Out of curiosity, I tried to import the image into Ubuntu 24 6.8.0-60-generic and it gives a similar panic. 

VERIFY3(zfs_btree_find(tree, node, &where) == NULL) failed (ffff92ecc35941a0 == 0000000000000000)
PANIC at btree.c:1405:zfs_btree_add()
Comment 7 Mark Johnston freebsd_committer freebsd_triage 2025-06-16 20:07:57 UTC
This is indeed due to a makefs bug.  I failed to implement a collision differentiator for microZAPs, and it seems that the 14.3 ZFS image contains such a collision.  Small changes to the image contents may well hide the problem, as the hash salt is determined by random().

I believe it is not too hard to fix, but we should pull the 14.3 ZFS image since it's not usable.  To verify other ZFS images for collisions, it should be sufficient to run "find /", since that forces ZFS to load all directory entries into a lookup tree, and ZFS will check for collisions even in non-debug kernels, so the failure is deterministic.
Comment 8 mike 2025-06-16 20:34:44 UTC
(In reply to Mark Johnston from comment #7)

Thanks Mark!  The .qcow2 image seems ok as does the vhd and vmdk.


xz -d FreeBSD-14.3-RELEASE-amd64-zfs.vhd.xz 
1{vbboxtest}# qemu-img convert -f vpc -O raw FreeBSD-14.3-RELEASE-amd64-zfs.vhd vhd.raw
0{vbboxtest}# mdconfig -f vhd.raw 
md0
0{vbboxtest}# 
0{vbboxtest}# zfs mount vhd-zroot/ROOT/default
0{vbboxtest}# find /mnt -type f > /dev/null
0{vbboxtest}# 
0{vbboxtest}# zpool upgrade vhd-zroot
This system supports ZFS pool feature flags.

Enabled the following features on 'vhd-zroot':
  async_destroy
  empty_bpobj
  lz4_compress
  multi_vdev_crash_dump
  spacemap_histogram
  enabled_txg
  hole_birth
  extensible_dataset
  embedded_data
  bookmarks
  filesystem_limits
  large_blocks
  large_dnode
  sha512
  skein
  edonr
  userobj_accounting
  encryption
  project_quota
  device_removal
  obsolete_counts
  zpool_checkpoint
  spacemap_v2
  allocation_classes
  resilver_defer
  bookmark_v2
  redaction_bookmarks
  redacted_datasets
  bookmark_written
  log_spacemap
  livelist
  device_rebuild
  zstd_compress
  draid
  zilsaxattr
  head_errlog
  blake3
  block_cloning
  vdev_zaps_v2

Pool 'vhd-zroot' has the bootfs property set, you might need to update
the boot code. See gptzfsboot(8) and loader.efi(8) for details.
0{vbboxtest}# find /mnt -type f > /dev/null
0{vbboxtest}# 
0{vbboxtest}# 

0{vbboxtest}# xz -d FreeBSD-14.3-RELEASE-amd64-zfs.vmdk.xz 
0{vbboxtest}# qemu-img convert -f vmdk -O raw FreeBSD-14.3-RELEASE-amd64-zfs.vmdk vmdk.raw
0{vbboxtest}# mdconfig -f vmdk.raw 
md0
0{vbboxtest}# zpool import -R /mnt zroot zroot-vmdk
0{vbboxtest}# zpool upgrade zroot-vmdk
This system supports ZFS pool feature flags.

Enabled the following features on 'zroot-vmdk':
  async_destroy
  empty_bpobj
  lz4_compress
  multi_vdev_crash_dump
  spacemap_histogram
  enabled_txg
  hole_birth
  extensible_dataset
  embedded_data
  bookmarks
  filesystem_limits
  large_blocks
  large_dnode
  sha512
  skein
  edonr
  userobj_accounting
  encryption
  project_quota
  device_removal
  obsolete_counts
  zpool_checkpoint
  spacemap_v2
  allocation_classes
  resilver_defer
  bookmark_v2
  redaction_bookmarks
  redacted_datasets
  bookmark_written
  log_spacemap
  livelist
  device_rebuild
  zstd_compress
  draid
  zilsaxattr
  head_errlog
  blake3
  block_cloning
  vdev_zaps_v2

Pool 'zroot-vmdk' has the bootfs property set, you might need to update
the boot code. See gptzfsboot(8) and loader.efi(8) for details.
0{vbboxtest}# find /mnt -type f > /dev/null
0{vbboxtest}# zfs mount zroot-vmdk/ROOT/default
0{vbboxtest}#
0{vbboxtest}# find /mnt -type f > /dev/null
0{vbboxtest}#
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-06-16 20:50:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=64e0b2e8f75286f9f4d85a86fbb6815b435c7096

commit 64e0b2e8f75286f9f4d85a86fbb6815b435c7096
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-06-16 20:33:14 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-06-16 20:49:07 +0000

    makefs: Implement the collision differentiator for micro ZAPs

    In the unlikely event of a hash collision, the collision differentiator
    is used to create a unique lookup key for ZAP entries.  While the fat
    ZAP implementation in makefs implemented this, the micro ZAP
    implementation did not, so it's possible to end up with collisions in
    directory entries.  These are caught deterministically by OpenZFS, but
    the result is a panic.

    Implement a simple differentiator by simply assigning a unique value to
    each ZAP entry.  This scheme works since the 16-bit space of
    differentiators is larger than the maximum number of entries in a micro
    ZAP.  (While the on-disk encoding provides 32 bits of space for the
    differentiator, the in-memory representation of micro ZAP entries is
    smaller.)

    PR:             287482
    MFC after:      1 week

 usr.sbin/makefs/zfs/zap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Comment 10 devnull freebsd_committer freebsd_triage 2025-06-18 05:25:19 UTC
For now, at <https://download.freebsd.org/releases/VM-IMAGES/14.3-RELEASE/amd64/Latest/>: 

> ZFS RAW image is broken
Comment 11 devnull freebsd_committer freebsd_triage 2025-06-18 05:49:42 UTC
<https://github.com/freebsd/freebsd-doc/pull/511>

jmg@ can you attend to the torrent? <https://people.freebsd.org/~jmg/FreeBSD-14.3-R-magnet.txt>. Thanks.
Comment 12 commit-hook freebsd_committer freebsd_triage 2025-06-19 23:26:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/doc/commit/?id=c23463321cb279e25489c1861605adeff6012b4c

commit c23463321cb279e25489c1861605adeff6012b4c
Author:     Graham Perrin <grahamperrin@gmail.com>
AuthorDate: 2025-06-18 05:42:29 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-06-19 23:22:57 +0000

    14.3: late-breaking bug 287482, ZFS raw VM image

    The file FreeBSD-14.3-RELEASE-amd64-zfs.raw.xz has been removed from
    https://download.freebsd.org/releases/VM-IMAGES/14.3-RELEASE/amd64/Latest/
    as it triggers a kernel panic in ZFS code.  It is still available on
    archive.freebsd.org in case anyone wants a test case (e.g. to fix the
    kernel panic).

    PR:     287482
    Co-authored-by: cperciva

 website/content/en/releases/14.3R/errata.adoc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 14 commit-hook freebsd_committer freebsd_triage 2025-06-24 01:02:04 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=97e2915ab98e786f7310d8477aa48d71a5485e44

commit 97e2915ab98e786f7310d8477aa48d71a5485e44
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-06-16 20:33:14 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-06-24 00:40:22 +0000

    makefs: Implement the collision differentiator for micro ZAPs

    In the unlikely event of a hash collision, the collision differentiator
    is used to create a unique lookup key for ZAP entries.  While the fat
    ZAP implementation in makefs implemented this, the micro ZAP
    implementation did not, so it's possible to end up with collisions in
    directory entries.  These are caught deterministically by OpenZFS, but
    the result is a panic.

    Implement a simple differentiator by simply assigning a unique value to
    each ZAP entry.  This scheme works since the 16-bit space of
    differentiators is larger than the maximum number of entries in a micro
    ZAP.  (While the on-disk encoding provides 32 bits of space for the
    differentiator, the in-memory representation of micro ZAP entries is
    smaller.)

    PR:             287482
    MFC after:      1 week

    (cherry picked from commit 64e0b2e8f75286f9f4d85a86fbb6815b435c7096)

 usr.sbin/makefs/zfs/zap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Comment 15 mike 2025-07-01 13:00:21 UTC
ticket can probably be resolved now ?
Comment 17 devnull freebsd_committer freebsd_triage 2025-08-31 10:32:26 UTC
Re: comment 11, FreeBSD-14.3-RELEASE-amd64-zfs.raw.xz remains linked from a freebsd.org page.