Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jul 23, 2024
  2. Jul 13, 2024
    • Steve French's avatar
      cifs: fix setting SecurityFlags to true · d2346e28
      Steve French authored
      
      If you try to set /proc/fs/cifs/SecurityFlags to 1 it
      will set them to CIFSSEC_MUST_NTLMV2 which no longer is
      relevant (the less secure ones like lanman have been removed
      from cifs.ko) and is also missing some flags (like for
      signing and encryption) and can even cause mount to fail,
      so change this to set it to Kerberos in this case.
      
      Also change the description of the SecurityFlags to remove mention
      of flags which are no longer supported.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      d2346e28
  3. Jul 11, 2024
    • Kent Overstreet's avatar
      bcachefs: bch2_gc_btree() should not use btree_root_lock · 1841027c
      Kent Overstreet authored
      
      btree_root_lock is for the root keys in btree_root, not the pointers to
      the nodes themselves; this fixes a lock ordering issue between
      btree_root_lock and btree node locks.
      
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      1841027c
    • Kent Overstreet's avatar
      bcachefs: Set PF_MEMALLOC_NOFS when trans->locked · f236ea4b
      Kent Overstreet authored
      
      proper lock ordering is: fs_reclaim -> btree node locks
      
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      f236ea4b
    • Kent Overstreet's avatar
      bcachefs; Use trans_unlock_long() when waiting on allocator · f0f3e511
      Kent Overstreet authored
      
      not using unlock_long() blocks key cache reclaim, and the allocator may
      take awhile
      
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      f0f3e511
    • Kent Overstreet's avatar
      Revert "bcachefs: Mark bch_inode_info as SLAB_ACCOUNT" · aacd897d
      Kent Overstreet authored
      This reverts commit 86d81ec5
      
      .
      
      This wasn't tested with memcg enabled, it immediately hits a null ptr
      deref in list_lru_add().
      
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      aacd897d
    • Filipe Manana's avatar
      btrfs: avoid races when tracking progress for extent map shrinking · 44849405
      Filipe Manana authored
      
      We store the progress (root and inode numbers) of the extent map shrinker
      in fs_info without any synchronization but we can have multiple tasks
      calling into the shrinker during memory allocations when there's enough
      memory pressure for example.
      
      This can result in a task A reading fs_info->extent_map_shrinker_last_ino
      after another task B updates it, and task A reading
      fs_info->extent_map_shrinker_last_root before task B updates it, making
      task A see an odd state that isn't necessarily harmful but may make it
      skip certain inode ranges or do more work than necessary by going over
      the same inodes again. These unprotected accesses would also trigger
      warnings from tools like KCSAN.
      
      So add a lock to protect access to these progress fields.
      
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      44849405
    • Filipe Manana's avatar
      btrfs: stop extent map shrinker if reschedule is needed · b3ebb9b7
      Filipe Manana authored
      
      The extent map shrinker can be called in a variety of contexts where we
      are under memory pressure, and of them is when a task is trying to
      allocate memory. For this reason the shrinker is typically called with a
      value of struct shrink_control::nr_to_scan that is much smaller than what
      we return in the nr_cached_objects callback of struct super_operations
      (fs/btrfs/super.c:btrfs_nr_cached_objects()), so that the shrinker does
      not take a long time and cause high latencies. However we can still take
      a lot of time in the shrinker even for a limited amount of nr_to_scan:
      
      1) When traversing the red black tree that tracks open inodes in a root,
         as for example with millions of open inodes we get a deep tree which
         takes time searching for an inode;
      
      2) Iterating over the extent map tree, which is a red black tree, of an
         inode when doing the rb_next() calls and when removing an extent map
         from the tree, since often that requires rebalancing the red black
         tree;
      
      3) When trying to write lock an inode's extent map tree we may wait for a
         significant amount of time, because there's either another task about
         to do IO and searching for an extent map in the tree or inserting an
         extent map in the tree, and we can have thousands or even millions of
         extent maps for an inode. Furthermore, there can be concurrent calls
         to the shrinker so the lock might be busy simply because there is
         already another task shrinking extent maps for the same inode;
      
      4) We often reschedule if we need to, which further increases latency.
      
      So improve on this by stopping the extent map shrinking code whenever we
      need to reschedule and make it skip an inode if we can't immediately lock
      its extent map tree.
      
      Reported-by: default avatarMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
      Reported-by: default avatarAndrea Gelmini <andrea.gelmini@gmail.com>
      Link: https://lore.kernel.org/linux-btrfs/CABXGCsMmmb36ym8hVNGTiU8yfUS_cGvoUmGCcBrGWq9OxTrs+A@mail.gmail.com/
      
      
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      b3ebb9b7
    • Filipe Manana's avatar
      btrfs: use delayed iput during extent map shrinking · 68a3ebd1
      Filipe Manana authored
      When putting an inode during extent map shrinking we're doing a standard
      iput() but that may take a long time in case the inode is dirty and we are
      doing the final iput that triggers eviction - the VFS will have to wait
      for writeback before calling the btrfs evict callback (see
      fs/inode.c:evict()).
      
      This slows down the task running the shrinker which may have been
      triggered while updating some tree for example, meaning locks are held
      as well as an open transaction handle.
      
      Also if the iput() ends up triggering eviction and the inode has no links
      anymore, then we trigger item truncation which requires flushing delayed
      items, space reservation to start a transaction and that may trigger the
      space reclaim task and wait for it, resulting in deadlocks in case the
      reclaim task needs for example to commit a transaction and the shrinker
      is being triggered from a path holding a transaction handle.
      
      Syzbot reported such a case with the following stack traces:
      
         ...
      68a3ebd1
  4. Jul 10, 2024
  5. Jul 06, 2024
    • Edward Adam Davis's avatar
      hfsplus: fix uninit-value in copy_name · 0570730c
      Edward Adam Davis authored
      
      [syzbot reported]
      BUG: KMSAN: uninit-value in sized_strscpy+0xc4/0x160
       sized_strscpy+0xc4/0x160
       copy_name+0x2af/0x320 fs/hfsplus/xattr.c:411
       hfsplus_listxattr+0x11e9/0x1a50 fs/hfsplus/xattr.c:750
       vfs_listxattr fs/xattr.c:493 [inline]
       listxattr+0x1f3/0x6b0 fs/xattr.c:840
       path_listxattr fs/xattr.c:864 [inline]
       __do_sys_listxattr fs/xattr.c:876 [inline]
       __se_sys_listxattr fs/xattr.c:873 [inline]
       __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873
       x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Uninit was created at:
       slab_post_alloc_hook mm/slub.c:3877 [inline]
       slab_alloc_node mm/slub.c:3918 [inline]
       kmalloc_trace+0x57b/0xbe0 mm/slub.c:4065
       kmalloc include/linux/slab.h:628 [inline]
       hfsplus_listxattr+0x4cc/0x1a50 fs/hfsplus/xattr.c:699
       vfs_listxattr fs/xattr.c:493 [inline]
       listxattr+0x1f3/0x6b0 fs/xattr.c:840
       path_listxattr fs/xattr.c:864 [inline]
       __do_sys_listxattr fs/xattr.c:876 [inline]
       __se_sys_listxattr fs/xattr.c:873 [inline]
       __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873
       x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      [Fix]
      When allocating memory to strbuf, initialize memory to 0.
      
      Reported-and-tested-by: default avatar <syzbot+efde959319469ff8d4d7@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Link: https://lore.kernel.org/r/tencent_8BBB6433BC9E1C1B7B4BDF1BF52574BA8808@qq.com
      
      
      Reported-and-tested-by: default avatar <syzbot+01ade747b16e9c8030e0@syzkaller.appspotmail.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      0570730c
  6. Jul 05, 2024
  7. Jul 04, 2024
  8. Jul 03, 2024