DragonFlyBSD Kernel Audit
DF-2215 / run.log
← back to finding ↓ download raw
[*] DF-2215 dm_target_zero unconditional memset on FREEBLKS bios
[*] Bug: dm_target_zero.c:43 memset(bp->b_data,0,bp->b_bcount)
[*]       is unconditional -- runs for FREEBLKS where b_data=NULL
[*] Reachability: FREEBLKS requires D_CANFREE on dm_ops (absent)
[*] create 'df2215dev': rv=0 (ok)
[*] reload zero: rv=0 (ok)
[*] resume: rv=0 (ok)

[*] Attempting: newfs + mount -o trim /dev/mapper/df2215dev
/dev/mapper/df2215dev: media size  64.00MB
Warning: Block size restricts cylinders per group to 101.
/dev/mapper/df2215dev:	131072 sectors in 32 cylinders of 1 tracks, 4096 sectors
	64.0MB in 1 cyl groups (101 c/g, 202.00MB/g, 8192 i/g)
super-block backups (for fsck -b # #) at:
 32
cg 0: bad magic number
cg 0: bad magic number
usage: mount_ufs [-o options] special node
Device:/dev/mapper/df2215dev does not support the TRIM command
[newfs] exit=31
[mount] exit=1

[!] mount -o trim FAILED -- dm device does not support TRIM.
[!] dm_ops (device-mapper.c:73) lacks D_CANFREE.
[!] Without MNT_TRIM, ffs_blkfree never generates FREEBLKS bios.
[!] VOP_FREEBLKS -> devfs_spec_freeblks checks SI_CANFREE and
[!] returns early for dm devices.

[!] CONCLUSION: The code-level bug in dm_target_zero_strategy
[!] is REAL (memset is unconditional, would panic on FREEBLKS),
[!] but UNREACHABLE on this kernel because FREEBLKS bios never
[!] reach a dm device. This is a LATENT bug / defense-in-depth
[!] hardening gap. See fix.diff for the guard.
RC=0