Whamcloud - gitweb
e2fsck: add support for expanding the inode size
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 13 Apr 2012 00:03:37 +0000 (18:03 -0600)
committerLi Dongyang <dongyangli@ddn.com>
Wed, 27 May 2020 01:20:50 +0000 (11:20 +1000)
commite47509eb35940d21a983f3357defda2c71111836
tree7bad7bc75d689f93372b8b4d5f1f7ac72bf857dd
parent779202ab58e46de0106a8b6dc0f7282e4fcf4dd7
e2fsck: add support for expanding the inode size

This patch adds a "-E expand_extra_isize" feature which makes sure
that _every_ used inode has i_extra_isize >= s_min_extra_isize if
s_min_extra_isize is set. Else it makes sure that i_extra_isize
of every inode is equal to sizeof(ext2_inode_large) - 128.

This is useful for the case where nanosecond timestamps or 64-bit
inode version fields are required for all inodes in the filesystem.

There is also a fix for test f_itable_collision, the original
E2FSCK_TIME would overflow on a 32bit system when adding with
ctx->time_fudge in EXT4_XTIME_FUTURE, making us increase the
inode badness incorrectly.

  LU-10205 libext2fs: fix buffer overrun in ext2fs_expand_extra_isize

  In ext2fs_expand_extra_isize, we size buffer using 'size' but then
  do the memcpy with the rounded-up size, which can overflow the buffer.

  With MALLOC_CHECK_=2, I see:
  Error in `../e2fsck/e2fsck': free(): invalid pointer: <addr>

  Change-Id: I31be58de12d4d50646c7aa96959de0efc5c279c3
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
  Reviewed-on: https://review.whamcloud.com/29975
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Change-Id: I306ff4f81d8bd6bdf0446c76d6772951043fead4
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
15 files changed:
e2fsck/e2fsck.c
e2fsck/e2fsck.h
e2fsck/emptydir.c
e2fsck/pass1.c
e2fsck/pass5.c
e2fsck/problem.c
e2fsck/problem.h
e2fsck/unix.c
lib/ext2fs/ext2_err.et.in
lib/ext2fs/ext2_ext_attr.h
lib/ext2fs/ext2_fs.h
lib/ext2fs/ext2fs.h
lib/ext2fs/ext_attr.c
tests/f_itable_collision/expect.1
tests/f_itable_collision/script