1. 21 9月, 2020 1 次提交
  2. 06 9月, 2020 1 次提交
    • M
      xfs: don't update mtime on COW faults · b17164e2
      Mikulas Patocka 提交于
      When running in a dax mode, if the user maps a page with MAP_PRIVATE and
      PROT_WRITE, the xfs filesystem would incorrectly update ctime and mtime
      when the user hits a COW fault.
      
      This breaks building of the Linux kernel.  How to reproduce:
      
       1. extract the Linux kernel tree on dax-mounted xfs filesystem
       2. run make clean
       3. run make -j12
       4. run make -j12
      
      at step 4, make would incorrectly rebuild the whole kernel (although it
      was already built in step 3).
      
      The reason for the breakage is that almost all object files depend on
      objtool.  When we run objtool, it takes COW page fault on its .data
      section, and these faults will incorrectly update the timestamp of the
      objtool binary.  The updated timestamp causes make to rebuild the whole
      tree.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b17164e2
  3. 03 9月, 2020 1 次提交
  4. 27 8月, 2020 4 次提交
    • D
      xfs: initialize the shortform attr header padding entry · 125eac24
      Darrick J. Wong 提交于
      Don't leak kernel memory contents into the shortform attr fork.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      125eac24
    • E
      xfs: fix boundary test in xfs_attr_shortform_verify · f4020438
      Eric Sandeen 提交于
      The boundary test for the fixed-offset parts of xfs_attr_sf_entry in
      xfs_attr_shortform_verify is off by one, because the variable array
      at the end is defined as nameval[1] not nameval[].
      Hence we need to subtract 1 from the calculation.
      
      This can be shown by:
      
      # touch file
      # setfattr -n root.a file
      
      and verifications will fail when it's written to disk.
      
      This only matters for a last attribute which has a single-byte name
      and no value, otherwise the combination of namelen & valuelen will
      push endp further out and this test won't fail.
      
      Fixes: 1e1bbd8e ("xfs: create structure verifier function for shortform xattrs")
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      f4020438
    • B
      xfs: fix off-by-one in inode alloc block reservation calculation · 657f1019
      Brian Foster 提交于
      The inode chunk allocation transaction reserves inobt_maxlevels-1
      blocks to accommodate a full split of the inode btree. A full split
      requires an allocation for every existing level and a new root
      block, which means inobt_maxlevels is the worst case block
      requirement for a transaction that inserts to the inobt. This can
      lead to a transaction block reservation overrun when tmpfile
      creation allocates an inode chunk and expands the inobt to its
      maximum depth. This problem has been observed in conjunction with
      overlayfs, which makes frequent use of tmpfiles internally.
      
      The existing reservation code goes back as far as the Linux git repo
      history (v2.6.12). It was likely never observed as a problem because
      the traditional file/directory creation transactions also include
      worst case block reservation for directory modifications, which most
      likely is able to make up for a single block deficiency in the inode
      allocation portion of the calculation. tmpfile support is relatively
      more recent (v3.15), less heavily used, and only includes the inode
      allocation block reservation as tmpfiles aren't linked into the
      directory tree on creation.
      
      Fix up the inode alloc block reservation macro and a couple of the
      block allocator minleft parameters that enforce an allocation to
      leave enough free blocks in the AG for a full inobt split.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      657f1019
    • B
      xfs: finish dfops on every insert range shift iteration · 9c516e0e
      Brian Foster 提交于
      The recent change to make insert range an atomic operation used the
      incorrect transaction rolling mechanism. The explicit transaction
      roll does not finish deferred operations. This means that intents
      for rmapbt updates caused by extent shifts are not logged until the
      final transaction commits. Thus if a crash occurs during an insert
      range, log recovery might leave the rmapbt in an inconsistent state.
      This was discovered by repeated runs of generic/455.
      
      Update insert range to finish dfops on every shift iteration. This
      is similar to collapse range and ensures that intents are logged
      with the transactions that make associated changes.
      
      Fixes: dd87f87d ("xfs: rework insert range into an atomic operation")
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      9c516e0e
  5. 08 8月, 2020 1 次提交
    • E
      xfs: Fix UBSAN null-ptr-deref in xfs_sysfs_init · 96cf2a2c
      Eiichi Tsukata 提交于
      If xfs_sysfs_init is called with parent_kobj == NULL, UBSAN
      shows the following warning:
      
        UBSAN: null-ptr-deref in ./fs/xfs/xfs_sysfs.h:37:23
        member access within null pointer of type 'struct xfs_kobj'
        Call Trace:
         dump_stack+0x10e/0x195
         ubsan_type_mismatch_common+0x241/0x280
         __ubsan_handle_type_mismatch_v1+0x32/0x40
         init_xfs_fs+0x12b/0x28f
         do_one_initcall+0xdd/0x1d0
         do_initcall_level+0x151/0x1b6
         do_initcalls+0x50/0x8f
         do_basic_setup+0x29/0x2b
         kernel_init_freeable+0x19f/0x20b
         kernel_init+0x11/0x1e0
         ret_from_fork+0x22/0x30
      
      Fix it by checking parent_kobj before the code accesses its member.
      Signed-off-by: NEiichi Tsukata <devel@etsukata.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      [darrick: minor whitespace edits]
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      96cf2a2c
  6. 06 8月, 2020 2 次提交
  7. 05 8月, 2020 1 次提交
  8. 29 7月, 2020 29 次提交