Bug 257768 - Corrupt UDF disk image can cause crash when mounted.
Summary: Corrupt UDF disk image can cause crash when mounted.
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-fs (Nobody)
Depends on:
Reported: 2021-08-11 13:19 UTC by Robert Morris
Modified: 2021-09-05 16:29 UTC (History)
1 user (show)

See Also:

A corrupt UDF disk image that causes a crash when mounted. (22.91 KB, application/x-gzip)
2021-08-11 14:02 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-11 13:19:25 UTC
If a corrupt (or malicious) UDF disk contains root_icb.len -2032,
udf_mountfs() ends up passing a size of zero to breadn_flags(),
which causes it to return a bp with an unmapped b_data, which causes
udf_mountfs()/udf_checktag() to pagefault. You can see this with the
attached UDF image, using

  mdconfig -f bad-udf.iso
  mount_udf /dev/md0 /mnt

which yields (on my amd64 13.0-RELEASE-p3 machine):

panic: vm_fault_lookup: fault on nofault entry, addr: 0xfffffe0009cd8000
cpuid = 0
time = 1628673343
KDB: stack backtrace:
#0 0xffffffff80c57515 at kdb_backtrace+0x65
#1 0xffffffff80c09ef1 at vpanic+0x181
#2 0xffffffff80c09d63 at panic+0x43
#3 0xffffffff80f289db at vm_fault+0x144b
#4 0xffffffff80f274b1 at vm_fault_trap+0xb1
#5 0xffffffff8108b3b8 at trap_pfault+0x1f8
#6 0xffffffff8108a86d at trap+0x27d
#7 0xffffffff810619a8 at calltrap+0x8
#8 0xffffffff80cdaa09 at vfs_domount+0x5e9
#9 0xffffffff80cd9c27 at vfs_donmount+0x8e7
#10 0xffffffff80cd9309 at sys_nmount+0x69
#11 0xffffffff8108babc at amd64_syscall+0x10c
#12 0xffffffff810622ce at fast_syscall_common+0xf8
Comment 1 Robert Morris 2021-08-11 14:02:26 UTC
Created attachment 227112 [details]
A corrupt UDF disk image that causes a crash when mounted.
Comment 2 Graham Perrin 2021-09-05 16:29:00 UTC
Comparably interesting: bug 244342 and seven other UFS-related kernel panic bugs that were reported by Neeraj on 2020-02-23