freebsd-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_extern.h Explicitly initialize rather than reading newly allocated UFS inodes. 2022-08-13 13:51:25 -07:00
ffs_inode.c
ffs_rawread.c
ffs_snapshot.c
ffs_softdep.c
ffs_subr.c
ffs_suspend.c
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
fs.h
softdep.h