Skip to content
Snippets Groups Projects
  1. Jul 27, 2023
    • Yu Kuai's avatar
      md: add a mutex to synchronize idle and frozen in action_store() · 6f56f0c4
      Yu Kuai authored
      
      Currently, for idle and frozen, action_store will hold 'reconfig_mutex'
      and call md_reap_sync_thread() to stop sync thread, however, this will
      cause deadlock (explained in the next patch). In order to fix the
      problem, following patch will release 'reconfig_mutex' and wait on
      'resync_wait', like md_set_readonly() and do_md_stop() does.
      
      Consider that action_store() will set/clear 'MD_RECOVERY_FROZEN'
      unconditionally, which might cause unexpected problems, for example,
      frozen just set 'MD_RECOVERY_FROZEN' and is still in progress, while
      'idle' clear 'MD_RECOVERY_FROZEN' and new sync thread is started, which
      might starve in progress frozen. A mutex is added to synchronize idle
      and frozen from action_store().
      
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20230529132037.2124527-4-yukuai1@huaweicloud.com
      6f56f0c4
    • Yu Kuai's avatar
      md: refactor action_store() for 'idle' and 'frozen' · 64e5e09a
      Yu Kuai authored
      
      Prepare to handle 'idle' and 'frozen' differently to fix a deadlock, there
      are no functional changes except that MD_RECOVERY_RUNNING is checked
      again after 'reconfig_mutex' is held.
      
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20230529132037.2124527-3-yukuai1@huaweicloud.com
      64e5e09a
    • Yu Kuai's avatar
      Revert "md: unlock mddev before reap sync_thread in action_store" · a865b96c
      Yu Kuai authored
      
      This reverts commit 9dfbdafd.
      
      Because it will introduce a defect that sync_thread can be running while
      MD_RECOVERY_RUNNING is cleared, which will cause some unexpected problems,
      for example:
      
      list_add corruption. prev->next should be next (ffff0001ac1daba0), but was ffff0000ce1a02a0. (prev=ffff0000ce1a02a0).
      Call trace:
       __list_add_valid+0xfc/0x140
       insert_work+0x78/0x1a0
       __queue_work+0x500/0xcf4
       queue_work_on+0xe8/0x12c
       md_check_recovery+0xa34/0xf30
       raid10d+0xb8/0x900 [raid10]
       md_thread+0x16c/0x2cc
       kthread+0x1a4/0x1ec
       ret_from_fork+0x10/0x18
      
      This is because work is requeued while it's still inside workqueue:
      
      t1:			t2:
      action_store
       mddev_lock
        if (mddev->sync_thread)
         mddev_unlock
         md_unregister_thread
         // first sync_thread is done
      			md_check_recovery
      			 mddev_try_lock
      			 /*
      			  * once MD_RECOVERY_DONE is set, new sync_thread
      			  * can start.
      			  */
      			 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery)
      			 INIT_WORK(&mddev->del_work, md_start_sync)
      			 queue_work(md_misc_wq, &mddev->del_work)
      			  test_and_set_bit(WORK_STRUCT_PENDING_BIT, ...)
      			  // set pending bit
      			  insert_work
      			   list_add_tail
      			 mddev_unlock
         mddev_lock_nointr
         md_reap_sync_thread
         // MD_RECOVERY_RUNNING is cleared
       mddev_unlock
      
      t3:
      
      // before queued work started from t2
      md_check_recovery
       // MD_RECOVERY_RUNNING is not set, a new sync_thread can be started
       INIT_WORK(&mddev->del_work, md_start_sync)
        work->data = 0
        // work pending bit is cleared
       queue_work(md_misc_wq, &mddev->del_work)
        insert_work
         list_add_tail
         // list is corrupted
      
      The above commit is reverted to fix the problem, the deadlock this
      commit tries to fix will be fixed in following patches.
      
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20230529132037.2124527-2-yukuai1@huaweicloud.com
      a865b96c
  2. Jul 26, 2023
  3. Jul 25, 2023
  4. Jul 20, 2023
  5. Jul 17, 2023
  6. Jul 16, 2023
  7. Jul 15, 2023
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 831fe284
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A couple of fairly minor driver specific fixes here, plus a bunch of
        maintainership and admin updates. Nothing too remarkable"
      
      * tag 'spi-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        mailmap: add entry for Jonas Gorski
        MAINTAINERS: add myself for spi-bcm63xx
        spi: s3c64xx: clear loopback bit after loopback test
        spi: bcm63xx: fix max prepend length
        MAINTAINERS: Add myself as a maintainer for Microchip SPI
      831fe284
    • Linus Torvalds's avatar
      Merge tag 'regmap-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap · 393ea781
      Linus Torvalds authored
      Pull regmap fix from Mark Brown:
       "One fix for an out of bounds access in the interupt code here"
      
      * tag 'regmap-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
        regmap-irq: Fix out-of-bounds access when allocating config buffers
      393ea781
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 82678ab2
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - Fix a regression causing a crash on sysfs access of iommu-group
         specific files
      
       - Fix signedness bug in SVA code
      
      * tag 'iommu-fixes-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/sva: Fix signedness bug in iommu_sva_alloc_pasid()
        iommu: Fix crash during syfs iommu_groups/N/type
      82678ab2
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b6e6cc1f
      Linus Torvalds authored
      Pull x86 CFI fixes from Peter Zijlstra:
       "Fix kCFI/FineIBT weaknesses
      
        The primary bug Alyssa noticed was that with FineIBT enabled function
        prologues have a spurious ENDBR instruction:
      
          __cfi_foo:
      	endbr64
      	subl	$hash, %r10d
      	jz	1f
      	ud2
      	nop
          1:
          foo:
      	endbr64 <--- *sadface*
      
        This means that any indirect call that fails to target the __cfi
        symbol and instead targets (the regular old) foo+0, will succeed due
        to that second ENDBR.
      
        Fixing this led to the discovery of a single indirect call that was
        still doing this: ret_from_fork(). Since that's an assembly stub the
        compiler would not generate the proper kCFI indirect call magic and it
        would not get patched.
      
        Brian came up with the most comprehensive fix -- convert the thing to
        C with only a very thin asm wrapper. This ensures the kernel thread
        boostrap is a proper kCFI call.
      
        While discussing all this, Kees noted that kCFI hashes could/should be
        poisoned to seal all functions whose address is never taken, further
        limiting the valid kCFI targets -- much like we already do for IBT.
      
        So what was a 'simple' observation and fix cascaded into a bunch of
        inter-related CFI infrastructure fixes"
      
      * tag 'x86_urgent_for_6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cfi: Only define poison_cfi() if CONFIG_X86_KERNEL_IBT=y
        x86/fineibt: Poison ENDBR at +0
        x86: Rewrite ret_from_fork() in C
        x86/32: Remove schedule_tail_wrapper()
        x86/cfi: Extend ENDBR sealing to kCFI
        x86/alternative: Rename apply_ibt_endbr()
        x86/cfi: Extend {JMP,CAKK}_NOSPEC comment
      b6e6cc1f
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · be522ac7
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a bunch of small driver fixes and a larger rework of zone disk
        handling (which reaches into blk and nvme).
      
        The aacraid array-bounds fix is now critical since the security people
        turned on -Werror for some build tests, which now fail without it"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: storvsc: Handle SRB status value 0x30
        scsi: block: Improve checks in blk_revalidate_disk_zones()
        scsi: block: virtio_blk: Set zone limits before revalidating zones
        scsi: block: nullblk: Set zone limits before revalidating zones
        scsi: nvme: zns: Set zone limits before revalidating zones
        scsi: sd_zbc: Set zone limits before revalidating zones
        scsi: ufs: core: Add support for qTimestamp attribute
        scsi: aacraid: Avoid -Warray-bounds warning
        scsi: ufs: ufs-mediatek: Add dependency for RESET_CONTROLLER
        scsi: ufs: core: Update contact email for monitor sysfs nodes
        scsi: scsi_debug: Remove dead code
        scsi: qla2xxx: Use vmalloc_array() and vcalloc()
        scsi: fnic: Use vmalloc_array() and vcalloc()
        scsi: qla2xxx: Fix error code in qla2x00_start_sp()
        scsi: qla2xxx: Silence a static checker warning
        scsi: lpfc: Fix a possible data race in lpfc_unregister_fcf_rescan()
      be522ac7
Loading