1. 27 Aug, 2024 2 commits
    • Edward Adam Davis's avatar
      jfs: check if leafidx greater than num leaves per dmap tree · d64ff0d2
      Edward Adam Davis authored
      syzbot report a out of bounds in dbSplit, it because dmt_leafidx greater
      than num leaves per dmap tree, add a checking for dmt_leafidx in dbFindLeaf.
      
      Shaggy:
      Modified sanity check to apply to control pages as well as leaf pages.
      
      Reported-and-tested-by: syzbot+dca05492eff41f604890@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=dca05492eff41f604890Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
      d64ff0d2
    • Edward Adam Davis's avatar
      jfs: Fix uaf in dbFreeBits · d6c1b359
      Edward Adam Davis authored
      [syzbot reported]
      ==================================================================
      BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:587 [inline]
      BUG: KASAN: slab-use-after-free in __mutex_lock+0xfe/0xd70 kernel/locking/mutex.c:752
      Read of size 8 at addr ffff8880229254b0 by task syz-executor357/5216
      
      CPU: 0 UID: 0 PID: 5216 Comm: syz-executor357 Not tainted 6.11.0-rc3-syzkaller-00156-gd7a5aa4b #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:93 [inline]
       dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
       print_address_description mm/kasan/report.c:377 [inline]
       print_report+0x169/0x550 mm/kasan/report.c:488
       kasan_report+0x143/0x180 mm/kasan/report.c:601
       __mutex_lock_common kernel/locking/mutex.c:587 [inline]
       __mutex_lock+0xfe/0xd70 kernel/locking/mutex.c:752
       dbFreeBits+0x7ea/0xd90 fs/jfs/jfs_dmap.c:2390
       dbFreeDmap fs/jfs/jfs_dmap.c:2089 [inline]
       dbFree+0x35b/0x680 fs/jfs/jfs_dmap.c:409
       dbDiscardAG+0x8a9/0xa20 fs/jfs/jfs_dmap.c:1650
       jfs_ioc_trim+0x433/0x670 fs/jfs/jfs_discard.c:100
       jfs_ioctl+0x2d0/0x3e0 fs/jfs/ioctl.c:131
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:907 [inline]
       __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:893
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
      
      Freed by task 5218:
       kasan_save_stack mm/kasan/common.c:47 [inline]
       kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
       kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
       poison_slab_object+0xe0/0x150 mm/kasan/common.c:240
       __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256
       kasan_slab_free include/linux/kasan.h:184 [inline]
       slab_free_hook mm/slub.c:2252 [inline]
       slab_free mm/slub.c:4473 [inline]
       kfree+0x149/0x360 mm/slub.c:4594
       dbUnmount+0x11d/0x190 fs/jfs/jfs_dmap.c:278
       jfs_mount_rw+0x4ac/0x6a0 fs/jfs/jfs_mount.c:247
       jfs_remount+0x3d1/0x6b0 fs/jfs/super.c:454
       reconfigure_super+0x445/0x880 fs/super.c:1083
       vfs_cmd_reconfigure fs/fsopen.c:263 [inline]
       vfs_fsconfig_locked fs/fsopen.c:292 [inline]
       __do_sys_fsconfig fs/fsopen.c:473 [inline]
       __se_sys_fsconfig+0xb6e/0xf80 fs/fsopen.c:345
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      [Analysis]
      There are two paths (dbUnmount and jfs_ioc_trim) that generate race
      condition when accessing bmap, which leads to the occurrence of uaf.
      
      Use the lock s_umount to synchronize them, in order to avoid uaf caused
      by race condition.
      
      Reported-and-tested-by: syzbot+3c010e21296f33a5dc16@syzkaller.appspotmail.com
      Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
      d6c1b359
  2. 23 Aug, 2024 5 commits
  3. 22 Aug, 2024 28 commits
  4. 21 Aug, 2024 5 commits
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.11-4' of... · 872cf28b
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Ilpo Järvinen:
      
       - ISST: Fix an error-handling corner case
      
       - platform/surface: aggregator: Minor corner case fix and new HW
         support
      
      * tag 'platform-drivers-x86-v6.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: ISST: Fix return value on last invalid resource
        platform/surface: aggregator: Fix warning when controller is destroyed in probe
        platform/surface: aggregator_registry: Add support for Surface Laptop 6
        platform/surface: aggregator_registry: Add fan and thermal sensor support for Surface Laptop 5
        platform/surface: aggregator_registry: Add support for Surface Laptop Studio 2
        platform/surface: aggregator_registry: Add support for Surface Laptop Go 3
        platform/surface: aggregator_registry: Add Support for Surface Pro 10
        platform/x86: asus-wmi: Add quirk for ROG Ally X
      872cf28b
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-6.11-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · 5c6154ff
      Linus Torvalds authored
      Pull erofs fixes from Gao Xiang:
       "As I mentioned in the merge window pull request, there is a regression
        which could cause system hang due to page migration. The corresponding
        fix landed upstream through MM tree last week (commit 2e6506e1:
        "mm/migrate: fix deadlock in migrate_pages_batch() on large folios"),
        therefore large folios can be safely allowed for compressed inodes and
        stress tests have been running on my fleet for over 20 days without
        any regression. Users have explicitly requested this for months, so
        let's allow large folios for EROFS full cases now for wider testing.
      
        Additionally, there is a fix which addresses invalid memory accesses
        on a failure path triggered by fault injection and two minor cleanups
        to simplify the codebase.
      
        Summary:
      
         - Allow large folios on compressed inodes
      
         - Fix invalid memory accesses if z_erofs_gbuf_growsize() partially
           fails
      
         - Two minor cleanups"
      
      * tag 'erofs-for-6.11-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails
        erofs: allow large folios for compressed files
        erofs: get rid of check_layout_compatibility()
        erofs: simplify readdir operation
      5c6154ff
    • Michael Ellerman's avatar
      ata: pata_macio: Use WARN instead of BUG · d4bc0a26
      Michael Ellerman authored
      The overflow/underflow conditions in pata_macio_qc_prep() should never
      happen. But if they do there's no need to kill the system entirely, a
      WARN and failing the IO request should be sufficient and might allow the
      system to keep running.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      d4bc0a26
    • Michael Ellerman's avatar
      ata: pata_macio: Fix DMA table overflow · 822c8020
      Michael Ellerman authored
      Kolbjørn and Jonáš reported that their 32-bit PowerMacs were crashing
      in pata-macio since commit 09fe2bfa ("ata: pata_macio: Fix
      max_segment_size with PAGE_SIZE == 64K").
      
      For example:
      
        kernel BUG at drivers/ata/pata_macio.c:544!
        Oops: Exception in kernel mode, sig: 5 [#1]
        BE PAGE_SIZE=4K MMU=Hash SMP NR_CPUS=2 DEBUG_PAGEALLOC PowerMac
        ...
        NIP pata_macio_qc_prep+0xf4/0x190
        LR  pata_macio_qc_prep+0xfc/0x190
        Call Trace:
          0xc1421660 (unreliable)
          ata_qc_issue+0x14c/0x2d4
          __ata_scsi_queuecmd+0x200/0x53c
          ata_scsi_queuecmd+0x50/0xe0
          scsi_queue_rq+0x788/0xb1c
          __blk_mq_issue_directly+0x58/0xf4
          blk_mq_plug_issue_direct+0x8c/0x1b4
          blk_mq_flush_plug_list.part.0+0x584/0x5e0
          __blk_flush_plug+0xf8/0x194
          __submit_bio+0x1b8/0x2e0
          submit_bio_noacct_nocheck+0x230/0x304
          btrfs_work_helper+0x200/0x338
          process_one_work+0x1a8/0x338
          worker_thread+0x364/0x4c0
          kthread+0x100/0x104
          start_kernel_thread+0x10/0x14
      
      That commit increased max_segment_size to 64KB, with the justification
      that the SCSI core was already using that size when PAGE_SIZE == 64KB,
      and that there was existing logic to split over-sized requests.
      
      However with a sufficiently large request, the splitting logic causes
      each sg to be split into two commands in the DMA table, leading to
      overflow of the DMA table, triggering the BUG_ON().
      
      With default settings the bug doesn't trigger, because the request size
      is limited by max_sectors_kb == 1280, however max_sectors_kb can be
      increased, and apparently some distros do that by default using udev
      rules.
      
      Fix the bug for 4KB kernels by reverting to the old max_segment_size.
      
      For 64KB kernels the sg_tablesize needs to be halved, to allow for the
      possibility that each sg will be split into two.
      
      Fixes: 09fe2bfa ("ata: pata_macio: Fix max_segment_size with PAGE_SIZE == 64K")
      Cc: stable@vger.kernel.org # v6.10+
      Reported-by: default avatarKolbjørn Barmen <linux-ppc@kolla.no>
      Closes: https://lore.kernel.org/all/62d248bb-e97a-25d2-bcf2-9160c518cae5@kolla.no/Reported-by: default avatarJonáš Vidra <vidra@ufal.mff.cuni.cz>
      Closes: https://lore.kernel.org/all/3b6441b8-06e6-45da-9e55-f92f2c86933e@ufal.mff.cuni.cz/Tested-by: default avatarKolbjørn Barmen <linux-ppc@kolla.no>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      822c8020
    • Linus Torvalds's avatar
      Merge tag '6.11-rc4-server-fixes' of git://git.samba.org/ksmbd · b311c1b4
      Linus Torvalds authored
      Pull smb server fixes from Steve French:
      
       - important reconnect fix
      
       - fix for memcpy issues on mount
      
       - two minor cleanup patches
      
      * tag '6.11-rc4-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: Replace one-element arrays with flexible-array members
        ksmbd: fix spelling mistakes in documentation
        ksmbd: fix race condition between destroy_previous_session() and smb2 operations()
        ksmbd: Use unsafe_memcpy() for ntlm_negotiate
      b311c1b4