1. 23 5月, 2018 2 次提交
  2. 21 5月, 2018 2 次提交
  3. 14 5月, 2018 6 次提交
  4. 13 5月, 2018 3 次提交
  5. 12 5月, 2018 2 次提交
  6. 10 5月, 2018 3 次提交
    • E
      ext4: use raw i_version value for ea_inode · e254d1af
      Eryu Guan 提交于
      Currently, creating large xattr (e.g. 2k) in ea_inode would cause
      ea_inode refcount corruption, e.g.
      
        Pass 4: Checking reference counts
        Extended attribute inode 13 ref count is 0, should be 1. Fix? no
      
      This is because that we save the lower 32bit of refcount in
      inode->i_version and store it in raw_inode->i_disk_version on disk.
      But since commit ee73f9a5 ("ext4: convert to new i_version
      API"), we load/store modified i_disk_version from/to disk instead of
      raw value, which causes on-disk ea_inode refcount corruption.
      
      Fix it by loading/storing raw i_version/i_disk_version, because it's
      a self-managed value in this case.
      
      Fixes: ee73f9a5 ("ext4: convert to new i_version API")
      Cc: Tahsin Erdogan <tahsin@google.com>
      Signed-off-by: NEryu Guan <guaneryu@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      e254d1af
    • E
      ext4: use XATTR_CREATE in ext4_initxattrs() · 3f706c8c
      Eryu Guan 提交于
      I hit ENOSPC error when creating new file in a newly created ext4
      with ea_inode feature enabled, if selinux is enabled and ext4 is
      mounted without any selinux context. e.g.
      
        mkfs -t ext4 -O ea_inode -F /dev/sda5
        mount /dev/sda5 /mnt/ext4
        touch /mnt/ext4/testfile  # got ENOSPC here
      
      It turns out that we run out of journal credits in
      ext4_xattr_set_handle() when creating new selinux label for the
      newly created inode.
      
      This is because that in __ext4_new_inode() we use
      __ext4_xattr_set_credits() to calculate the reserved credits for new
      xattr, with the 'is_create' argument being true, which implies less
      credits in the ea_inode case. But we calculate the required credits
      in ext4_xattr_set_handle() with 'is_create' being false, which means
      we need more credits if ea_inode feature is enabled. So we don't
      have enough credits and error out with ENOSPC.
      
      Fix it by simply calling ext4_xattr_set_handle() with XATTR_CREATE
      flag in ext4_initxattrs(), so we end up with requiring less credits
      than reserved. The semantic of XATTR_CREATE is "Perform a pure
      create, which fails if the named attribute exists already." (from
      setxattr(2)), which is fine in this case, because we only call
      ext4_initxattrs() on newly created inode.
      
      Fixes: af65207c ("ext4: fix __ext4_new_inode() journal credits calculation")
      Cc: Tahsin Erdogan <tahsin@google.com>
      Signed-off-by: NEryu Guan <guaneryu@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      3f706c8c
    • M
      ext4: make function ‘ext4_getfsmap_find_fixed_metadata’ static · 472d8ea1
      Mathieu Malaterre 提交于
      Since function ‘ext4_getfsmap_find_fixed_metadata’ can be made static,
      make it so. Remove the following gcc warning (W=1):
      
        fs/ext4/fsmap.c:405:5: warning: no previous prototype for ‘ext4_getfsmap_find_fixed_metadata’ [-Wmissing-prototypes]
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      472d8ea1
  7. 26 4月, 2018 1 次提交
  8. 24 4月, 2018 1 次提交
    • L
      ext4: fix bitmap position validation · 22be37ac
      Lukas Czerner 提交于
      Currently in ext4_valid_block_bitmap() we expect the bitmap to be
      positioned anywhere between 0 and s_blocksize clusters, but that's
      wrong because the bitmap can be placed anywhere in the block group. This
      causes false positives when validating bitmaps on perfectly valid file
      system layouts. Fix it by checking whether the bitmap is within the group
      boundary.
      
      The problem can be reproduced using the following
      
      mkfs -t ext3 -E stride=256 /dev/vdb1
      mount /dev/vdb1 /mnt/test
      cd /mnt/test
      wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz
      tar xf linux-4.16.3.tar.xz
      
      This will result in the warnings in the logs
      
      EXT4-fs error (device vdb1): ext4_validate_block_bitmap:399: comm tar: bg 84: block 2774529: invalid block bitmap
      
      [ Changed slightly for clarity and to not drop a overflow test -- TYT ]
      Signed-off-by: NLukas Czerner <lczerner@redhat.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reported-by: NIlya Dryomov <idryomov@gmail.com>
      Fixes: 7dac4a17 ("ext4: add validity checks for bitmap block numbers")
      Cc: stable@vger.kernel.org
      22be37ac
  9. 12 4月, 2018 1 次提交
    • E
      ext4: prevent right-shifting extents beyond EXT_MAX_BLOCKS · 349fa7d6
      Eric Biggers 提交于
      During the "insert range" fallocate operation, extents starting at the
      range offset are shifted "right" (to a higher file offset) by the range
      length.  But, as shown by syzbot, it's not validated that this doesn't
      cause extents to be shifted beyond EXT_MAX_BLOCKS.  In that case
      ->ee_block can wrap around, corrupting the extent tree.
      
      Fix it by returning an error if the space between the end of the last
      extent and EXT4_MAX_BLOCKS is smaller than the range being inserted.
      
      This bug can be reproduced by running the following commands when the
      current directory is on an ext4 filesystem with a 4k block size:
      
              fallocate -l 8192 file
              fallocate --keep-size -o 0xfffffffe000 -l 4096 -n file
              fallocate --insert-range -l 8192 file
      
      Then after unmounting the filesystem, e2fsck reports corruption.
      
      Reported-by: syzbot+06c885be0edcdaeab40c@syzkaller.appspotmail.com
      Fixes: 331573fe ("ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate")
      Cc: stable@vger.kernel.org # v4.2+
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      349fa7d6
  10. 02 4月, 2018 1 次提交
    • T
      ext4: force revalidation of directory pointer after seekdir(2) · e40ff213
      Theodore Ts'o 提交于
      A malicious user could force the directory pointer to be in an invalid
      spot by using seekdir(2).  Use the mechanism we already have to notice
      if the directory has changed since the last time we called
      ext4_readdir() to force a revalidation of the pointer.
      
      Reported-by: syzbot+1236ce66f79263e8a862@syzkaller.appspotmail.com
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      e40ff213
  11. 31 3月, 2018 4 次提交
  12. 30 3月, 2018 10 次提交
  13. 28 3月, 2018 1 次提交
  14. 27 3月, 2018 1 次提交
  15. 26 3月, 2018 2 次提交