aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs/ufs/dinode.h
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 /sys/ufs/ufs/dinode.h
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 'sys/ufs/ufs/dinode.h')
-rw-r--r--sys/ufs/ufs/dinode.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/ufs/ufs/dinode.h b/sys/ufs/ufs/dinode.h
index 0a201ce0b43b..1f0f25c4d5ec 100644
--- a/sys/ufs/ufs/dinode.h
+++ b/sys/ufs/ufs/dinode.h
@@ -149,7 +149,8 @@ struct ufs2_dinode {
ufs2_daddr_t di_ib[UFS_NIADDR]; /* 208: Indirect disk blocks. */
u_int64_t di_modrev; /* 232: i_modrev for NFSv4 */
uint32_t di_freelink; /* 240: SUJ: Next unlinked inode. */
- uint32_t di_spare[3]; /* 244: Reserved; currently unused */
+ uint32_t di_ckhash; /* 244: if CK_INODE, its check-hash */
+ uint32_t di_spare[2]; /* 248: Reserved; currently unused */
};
/*