opnsense-src/sys/ufs/ffs
Kirk McKusick 6b9d4fbb7f Explicitly initialize rather than reading newly allocated UFS inodes.
The function ffs_vgetf() is used to find or load UFS inodes into a
vnode. It first looks up the inode and if found in the cache its
vnode is returned. If it is not already in the cache, a new vnode
is allocated and its associated inode read in from the disk. The
read is done even for inodes that are being initially created.
The contents for the inode on the disk are assumed to be empty. If
the on-disk contents had been corrupted either due to a hardware
glitch or an agent deliberately trying to exploit the system, the
UFS code could panic from the unexpected partially-allocated inode.

Rather then having fsck_ffs(8) verify that all unallocated inodes
are properly empty, it is easier and quicker to add a flag to
ffs_vgetf() to indicate that the request is for a newly allocated
inode. When set, the disk read is skipped and the inode is set to
its expected empty (zero'ed out) initial state. As a side benefit,
an unneeded disk I/O is avoided.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-13 13:51:25 -07:00
..
ffs_alloc.c Explicitly initialize rather than reading newly allocated UFS inodes. 2022-08-13 13:51:25 -07:00
ffs_balloc.c ffs: lock buffers after snaplk with LK_NOWITNESS 2022-02-01 06:54:50 +02:00
ffs_extern.h Explicitly initialize rather than reading newly allocated UFS inodes. 2022-08-13 13:51:25 -07:00
ffs_inode.c Another fix to build from 064e6b4. 2022-07-13 21:05:05 -07:00
ffs_rawread.c vmapbuf: don't smuggle address or length in buf 2020-10-21 16:00:15 +00:00
ffs_snapshot.c Fix unused variable warning in ffs_snapshot.c 2022-07-26 21:32:51 +02:00
ffs_softdep.c AST: rework 2022-08-02 21:11:09 +03:00
ffs_subr.c Move the ability to search for alternate UFS superblocks from fsck_ffs(8) 2022-08-13 12:43:40 -07:00
ffs_suspend.c ffs: remove unused thread argument from ffs_reload() 2021-09-04 12:25:10 -08:00
ffs_tables.c
ffs_vfsops.c Explicitly initialize rather than reading newly allocated UFS inodes. 2022-08-13 13:51:25 -07:00
ffs_vnops.c Rewrite function definitions in the UFS/FFS code base with identifier lists. 2022-07-13 14:08:05 -07:00
fs.h Move the ability to search for alternate UFS superblocks from fsck_ffs(8) 2022-08-13 12:43:40 -07:00
softdep.h Clean up orphaned indirdep dependency structures after disk failure. 2021-07-29 16:31:16 -07:00