aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/main.c
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2018-12-11 22:14:37 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2018-12-11 22:14:37 +0000
commit8f829a5cf0fa341a95fd4bed7091d6c44129d68f (patch)
tree2cb40f5c8c0521451556577ffdfcd8b8aeb90861 /sbin/fsck_ffs/main.c
parentd3cc40300eaa672ce8f7d1782454267d3ea15dfb (diff)
downloadsrc-8f829a5cf0fa341a95fd4bed7091d6c44129d68f.tar.gz
src-8f829a5cf0fa341a95fd4bed7091d6c44129d68f.zip
Continuing efforts to provide hardening of FFS. This change adds a
check hash to the filesystem inodes. Access attempts to files associated with an inode with an invalid check hash will fail with EINVAL (Invalid argument). Access is reestablished after an fsck is run to find and validate the inodes with invalid check-hashes. This check avoids a class of filesystem panics related to corrupted inodes. The hash is done using crc32c. Note this check-hash is for the inode itself and not any of its indirect blocks. Check-hash validation may be extended to also cover indirect block pointers, but that will be a separate (and more costly) feature. Check hashes are added only to UFS2 and not to UFS1 as UFS1 is primarily used in embedded systems with small memories and low-powered processors which need as light-weight a filesystem as possible. Reviewed by: kib Tested by: Peter Holm Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=341836
Diffstat (limited to 'sbin/fsck_ffs/main.c')
-rw-r--r--sbin/fsck_ffs/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index ce4d0a89a36a..47bd3987c8e8 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -468,13 +468,13 @@ checkfilesys(char *filesys)
ckhashadd |= CK_SUPERBLOCK;
sblock.fs_metackhash |= CK_SUPERBLOCK;
}
-#ifdef notyet
if ((sblock.fs_metackhash & CK_INODE) == 0 &&
getosreldate() >= P_OSREL_CK_INODE &&
reply("ADD INODE CHECK-HASH PROTECTION") != 0) {
ckhashadd |= CK_INODE;
sblock.fs_metackhash |= CK_INODE;
}
+#ifdef notyet
if ((sblock.fs_metackhash & CK_INDIR) == 0 &&
getosreldate() >= P_OSREL_CK_INDIR &&
reply("ADD INDIRECT BLOCK CHECK-HASH PROTECTION") != 0) {