Whamcloud - gitweb
LU-1540 e2fsck: add missing symlink NUL terminator
authorAndreas Dilger <andreas.dilger@intel.com>
Sat, 14 Jul 2012 02:33:01 +0000 (20:33 -0600)
committerLi Dongyang <dongyangli@ddn.com>
Wed, 15 Aug 2018 02:08:04 +0000 (12:08 +1000)
commitb511e5b27da470584debb595c4f672e2ab4e1b8a
tree93115dc1c9d0562531681b38864a83e396dcdca5
parentc67897f5e0a1df037b7d324b44ec3bfe332c38a3
LU-1540 e2fsck: add missing symlink NUL terminator

If a long symbolic link target is written into an external block
without a NUL terminator, its length is decided by the inode's size.
Make symlink check add a NUL termination in such cases if needed.

Such faulty symlinks were generated by osd-ldiskfs on the MDS until
Lustre 2.1.3 and Lustre 2.3.  The in-kernel code would handle such
unterminated symlinks correctly, since it used the inode size to
determine the symlink length, but e2fsck would assume the symlink
is broken if there wasn't a trailing NUL.

  LU-2627 e2fsck: check_symlink() SIGSEGV

  Since e2fsck_pass1_check_symlink() calls into check_symlink()
  with pctx == NULL, we should use 'ino' instead of 'pctx->ino'
  in check_symlink().

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
  Change-Id: If9c16f96d0655d5a886ef607f1f47ced6176f8d8

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I4419b30f1adb4a7d273796a936427aa351510213
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/problem.c
e2fsck/problem.h
tests/f_badsymlinks/expect.1
tests/f_badsymlinks/expect.2
tests/f_badsymlinks2/expect.1
tests/f_badsymlinks2/expect.2