Bug 257557 - geom(4): Garbage on disk (or USB memory stick) can cause GEOM taste ffs_sbget() to crash via g_label_ufs_taste_common: panic: vm_fault_lookup: fault on nofault entry, addr: 0xfffffe0009409000
Summary: geom(4): Garbage on disk (or USB memory stick) can cause GEOM taste ffs_sbget...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-geom (Nobody)
URL:
Keywords: crash, needs-qa
Depends on:
Blocks: 263979
  Show dependency treegraph
 
Reported: 2021-08-02 12:27 UTC by Robert Morris
Modified: 2022-11-18 22:38 UTC (History)
7 users (show)

See Also:
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments
A usb key image that causes a kernel page fault. (200.00 KB, application/octet-stream)
2021-08-02 12:27 UTC, Robert Morris
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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 freebsd_triage 2021-08-04 02:52:00 UTC
See also https://people.freebsd.org/~pho/stress/log/log0159.txt
Comment 2 Kirk McKusick freebsd_committer freebsd_triage 2022-05-16 00:22:59 UTC
Please check to see if my proposed change in https://reviews.freebsd.org/D35219 resolves this bug.
Comment 3 Robert Morris 2022-05-18 09:25:46 UTC
(In reply to Kirk McKusick from comment #2)
Yes -- your validate_sblock() of Apr 12 makes this problem go away.
Comment 4 Kirk McKusick freebsd_committer freebsd_triage 2022-05-27 19:30:21 UTC
Fixed by https://reviews.freebsd.org/D35219

Will close when MFC'ed to 13.
Comment 5 Kirk McKusick freebsd_committer freebsd_triage 2022-11-18 22:38:33 UTC
MFC'ed to 13 with commit b999366aab4e2d59cb8869b0e5ef0f70ab9b9bbe on Fri May 27 12:21:11 2022 -0700