summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_sysfs.h
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2014-09-09 11:47:24 +1000
committerDave Chinner <david@fromorbit.com>2014-09-09 11:47:24 +1000
commite1b05723ed834090caab56866adc05bce31c9bdd (patch)
tree224438a49422c9c30088111273aeb48fd37a234e /fs/xfs/xfs_sysfs.h
parent8018ec083c72443cc74fd2d08eb7c5dddc13af53 (diff)
xfs: add a few more verifier tests
These were exposed by fsfuzzer runs; without them we fail in various exciting and sometimes convoluted ways when we encounter disk corruption. Without the MAXLEVELS tests we tend to walk off the end of an array in a loop like this: for (i = 0; i < cur->bc_nlevels; i++) { if (cur->bc_bufs[i]) Without the dirblklog test we try to allocate more memory than we could possibly hope for and loop forever: xfs_dabuf_map() nfsb = mp->m_dir_geo->fsbcount; irecs = kmem_zalloc(sizeof(irec) * nfsb, KM_SLEEP... As for the logbsize check, that's the convoluted one. If logbsize is specified at mount time, it's sanitized in xfs_parseargs; in particular it makes sure that it's not > XLOG_MAX_RECORD_BSIZE. If not specified at mount time, it comes from the superblock via sb_logsunit; this is limited to 256k at mkfs time as well; it's copied into m_logbsize in xfs_finish_flags(). However, if for some reason the on-disk value is corrupt and too large, nothing catches it. It's a circuitous path, but that size eventually finds its way to places that make the kernel very unhappy, leading to oopses in xlog_pack_data() because we use the size as an index into iclog->ic_data, but the array is not necessarily that big. Anyway - bounds checking when we read from disk is a good thing! Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_sysfs.h')
0 files changed, 0 insertions, 0 deletions