Bug 257557

Summary: Garbage on disk (or USB memory stick) can cause GEOM taste ffs_sbget() to crash.
Product: Base System Reporter: Robert Morris <rtm>
Component: kernAssignee: freebsd-geom (Nobody) <geom>
Status: New ---    
Severity: Affects Some People CC: emaste, grahamperrin, pho
Priority: ---    
Version: 13.0-RELEASE   
Hardware: Any   
OS: Any   
Description Flags
A usb key image that causes a kernel page fault. none

Description Robert Morris 2021-08-02 12:27:20 UTC
Created attachment 226873 [details]
A usb key image that causes a kernel page fault.

A USB memory stick with the attached content, if inserted
in my 13.0-RELEASE-p3 amd64 machine, causes a crash. Here's a
kernel backtrace:

panic: vm_fault_lookup: fault on nofault entry, addr: 0xfffffe0009409000
cpuid = 0
time = 1627895621
KDB: stack backtrace:
#0 0xffffffff80c57515 at kdb_backtrace+0x65
#1 0xffffffff80c09ef1 at vpanic+0x181
#2 0xffffffff80c09d63 at panic+0x43
#3 0xffffffff80f289ab at vm_fault+0x144b
#4 0xffffffff80f27481 at vm_fault_trap+0xb1
#5 0xffffffff8108b3b8 at trap_pfault+0x1f8
#6 0xffffffff8108a86d at trap+0x27d
#7 0xffffffff81061978 at calltrap+0x8
#8 0xffffffff80efc974 at ffs_sbget+0x3c4
#9 0xffffffff80b54a77 at g_label_ufs_taste_common+0x57
#10 0xffffffff80b533af at g_label_taste+0x1df
#11 0xffffffff80b51aba at g_new_provider_event+0x7a
#12 0xffffffff80b4cc3e at g_run_events+0x12e
#13 0xffffffff80bc7e2e at fork_exit+0x7e
#14 0xffffffff810629fe at fork_trampoline+0xe

You can also get the crash with

  % sudo mdconfig -f fat12.img

fat12.img contains garbage that apparently looks enough
like an FFS file system that GEOM taste's call to ffs_sbget()
proceeds, but then crashes near the end.
Comment 1 Peter Holm freebsd_committer 2021-08-04 02:52:00 UTC
See also https://people.freebsd.org/~pho/stress/log/log0159.txt