1. 12 Jan, 2021 1 commit
    • Ignat Korchagin's avatar
      dm crypt: do not call bio_endio() from the dm-crypt tasklet · 8e14f610
      Ignat Korchagin authored
      Sometimes, when dm-crypt executes decryption in a tasklet, we may get
      "BUG: KASAN: use-after-free in tasklet_action_common.constprop..."
      with a kasan-enabled kernel.
      
      When the decryption fully completes in the tasklet, dm-crypt will call
      bio_endio(), which in turn will call clone_endio() from dm.c core code. That
      function frees the resources associated with the bio, including per bio private
      structures. For dm-crypt it will free the current struct dm_crypt_io, which
      contains our tasklet object, causing use-after-free, when the tasklet is being
      dequeued by the kernel.
      
      To avoid this, do not call bio_endio() from the current tasklet context, but
      delay its execution to the dm-crypt IO workqueue.
      
      Fixes: 39d42fa9 ("dm crypt: add flags to optionally bypass kcryptd workqueues")
      Cc: <stable@vger.kernel.org> # v5.9+
      Signed-off-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      8e14f610
  2. 08 Jan, 2021 2 commits
  3. 06 Jan, 2021 1 commit
    • Akilesh Kailash's avatar
      dm snapshot: flush merged data before committing metadata · fcc42338
      Akilesh Kailash authored
      If the origin device has a volatile write-back cache and the following
      events occur:
      
      1: After finishing merge operation of one set of exceptions,
         merge_callback() is invoked.
      2: Update the metadata in COW device tracking the merge completion.
         This update to COW device is flushed cleanly.
      3: System crashes and the origin device's cache where the recent
         merge was completed has not been flushed.
      
      During the next cycle when we read the metadata from the COW device,
      we will skip reading those metadata whose merge was completed in
      step (1). This will lead to data loss/corruption.
      
      To address this, flush the origin device post merge IO before
      updating the metadata.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAkilesh Kailash <akailash@google.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      fcc42338
  4. 04 Jan, 2021 5 commits
    • Ignat Korchagin's avatar
      dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq · d68b2958
      Ignat Korchagin authored
      Commit 39d42fa9 ("dm crypt: add flags to optionally bypass kcryptd
      workqueues") made it possible for some code paths in dm-crypt to be
      executed in softirq context, when the underlying driver processes IO
      requests in interrupt/softirq context.
      
      In this case sometimes when allocating a new crypto request we may get
      a stacktrace like below:
      
      [  210.103008][    C0] BUG: sleeping function called from invalid context at mm/mempool.c:381
      [  210.104746][    C0] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2602, name: fio
      [  210.106599][    C0] CPU: 0 PID: 2602 Comm: fio Tainted: G        W         5.10.0+ #50
      [  210.108331][    C0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
      [  210.110212][    C0] Call Trace:
      [  210.110921][    C0]  <IRQ>
      [  210.111527][    C0]  dump_stack+0x7d/0xa3
      [  210.112411][    C0]  ___might_sleep.cold+0x122/0x151
      [  210.113527][    C0]  mempool_alloc+0x16b/0x2f0
      [  210.114524][    C0]  ? __queue_work+0x515/0xde0
      [  210.115553][    C0]  ? mempool_resize+0x700/0x700
      [  210.116586][    C0]  ? crypt_endio+0x91/0x180
      [  210.117479][    C0]  ? blk_update_request+0x757/0x1150
      [  210.118513][    C0]  ? blk_mq_end_request+0x4b/0x480
      [  210.119572][    C0]  ? blk_done_softirq+0x21d/0x340
      [  210.120628][    C0]  ? __do_softirq+0x190/0x611
      [  210.121626][    C0]  crypt_convert+0x29f9/0x4c00
      [  210.122668][    C0]  ? _raw_spin_lock_irqsave+0x87/0xe0
      [  210.123824][    C0]  ? kasan_set_track+0x1c/0x30
      [  210.124858][    C0]  ? crypt_iv_tcw_ctr+0x4a0/0x4a0
      [  210.125930][    C0]  ? kmem_cache_free+0x104/0x470
      [  210.126973][    C0]  ? crypt_endio+0x91/0x180
      [  210.127947][    C0]  kcryptd_crypt_read_convert+0x30e/0x420
      [  210.129165][    C0]  blk_update_request+0x757/0x1150
      [  210.130231][    C0]  blk_mq_end_request+0x4b/0x480
      [  210.131294][    C0]  blk_done_softirq+0x21d/0x340
      [  210.132332][    C0]  ? _raw_spin_lock+0x81/0xd0
      [  210.133289][    C0]  ? blk_mq_stop_hw_queue+0x30/0x30
      [  210.134399][    C0]  ? _raw_read_lock_irq+0x40/0x40
      [  210.135458][    C0]  __do_softirq+0x190/0x611
      [  210.136409][    C0]  ? handle_edge_irq+0x221/0xb60
      [  210.137447][    C0]  asm_call_irq_on_stack+0x12/0x20
      [  210.138507][    C0]  </IRQ>
      [  210.139118][    C0]  do_softirq_own_stack+0x37/0x40
      [  210.140191][    C0]  irq_exit_rcu+0x110/0x1b0
      [  210.141151][    C0]  common_interrupt+0x74/0x120
      [  210.142171][    C0]  asm_common_interrupt+0x1e/0x40
      
      Fix this by allocating crypto requests with GFP_ATOMIC mask in
      interrupt context.
      
      Fixes: 39d42fa9 ("dm crypt: add flags to optionally bypass kcryptd workqueues")
      Cc: stable@vger.kernel.org # v5.9+
      Reported-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Acked-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      d68b2958
    • Ignat Korchagin's avatar
      dm crypt: do not wait for backlogged crypto request completion in softirq · 8abec36d
      Ignat Korchagin authored
      Commit 39d42fa9 ("dm crypt: add flags to optionally bypass kcryptd
      workqueues") made it possible for some code paths in dm-crypt to be
      executed in softirq context, when the underlying driver processes IO
      requests in interrupt/softirq context.
      
      When Crypto API backlogs a crypto request, dm-crypt uses
      wait_for_completion to avoid sending further requests to an already
      overloaded crypto driver. However, if the code is executing in softirq
      context, we might get the following stacktrace:
      
      [  210.235213][    C0] BUG: scheduling while atomic: fio/2602/0x00000102
      [  210.236701][    C0] Modules linked in:
      [  210.237566][    C0] CPU: 0 PID: 2602 Comm: fio Tainted: G        W         5.10.0+ #50
      [  210.239292][    C0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
      [  210.241233][    C0] Call Trace:
      [  210.241946][    C0]  <IRQ>
      [  210.242561][    C0]  dump_stack+0x7d/0xa3
      [  210.243466][    C0]  __schedule_bug.cold+0xb3/0xc2
      [  210.244539][    C0]  __schedule+0x156f/0x20d0
      [  210.245518][    C0]  ? io_schedule_timeout+0x140/0x140
      [  210.246660][    C0]  schedule+0xd0/0x270
      [  210.247541][    C0]  schedule_timeout+0x1fb/0x280
      [  210.248586][    C0]  ? usleep_range+0x150/0x150
      [  210.249624][    C0]  ? unpoison_range+0x3a/0x60
      [  210.250632][    C0]  ? ____kasan_kmalloc.constprop.0+0x82/0xa0
      [  210.251949][    C0]  ? unpoison_range+0x3a/0x60
      [  210.252958][    C0]  ? __prepare_to_swait+0xa7/0x190
      [  210.254067][    C0]  do_wait_for_common+0x2ab/0x370
      [  210.255158][    C0]  ? usleep_range+0x150/0x150
      [  210.256192][    C0]  ? bit_wait_io_timeout+0x160/0x160
      [  210.257358][    C0]  ? blk_update_request+0x757/0x1150
      [  210.258582][    C0]  ? _raw_spin_lock_irq+0x82/0xd0
      [  210.259674][    C0]  ? _raw_read_unlock_irqrestore+0x30/0x30
      [  210.260917][    C0]  wait_for_completion+0x4c/0x90
      [  210.261971][    C0]  crypt_convert+0x19a6/0x4c00
      [  210.263033][    C0]  ? _raw_spin_lock_irqsave+0x87/0xe0
      [  210.264193][    C0]  ? kasan_set_track+0x1c/0x30
      [  210.265191][    C0]  ? crypt_iv_tcw_ctr+0x4a0/0x4a0
      [  210.266283][    C0]  ? kmem_cache_free+0x104/0x470
      [  210.267363][    C0]  ? crypt_endio+0x91/0x180
      [  210.268327][    C0]  kcryptd_crypt_read_convert+0x30e/0x420
      [  210.269565][    C0]  blk_update_request+0x757/0x1150
      [  210.270563][    C0]  blk_mq_end_request+0x4b/0x480
      [  210.271680][    C0]  blk_done_softirq+0x21d/0x340
      [  210.272775][    C0]  ? _raw_spin_lock+0x81/0xd0
      [  210.273847][    C0]  ? blk_mq_stop_hw_queue+0x30/0x30
      [  210.275031][    C0]  ? _raw_read_lock_irq+0x40/0x40
      [  210.276182][    C0]  __do_softirq+0x190/0x611
      [  210.277203][    C0]  ? handle_edge_irq+0x221/0xb60
      [  210.278340][    C0]  asm_call_irq_on_stack+0x12/0x20
      [  210.279514][    C0]  </IRQ>
      [  210.280164][    C0]  do_softirq_own_stack+0x37/0x40
      [  210.281281][    C0]  irq_exit_rcu+0x110/0x1b0
      [  210.282286][    C0]  common_interrupt+0x74/0x120
      [  210.283376][    C0]  asm_common_interrupt+0x1e/0x40
      [  210.284496][    C0] RIP: 0010:_aesni_enc1+0x65/0xb0
      
      Fix this by making crypt_convert function reentrant from the point of
      a single bio and make dm-crypt defer further bio processing to a
      workqueue, if Crypto API backlogs a request in interrupt context.
      
      Fixes: 39d42fa9 ("dm crypt: add flags to optionally bypass kcryptd workqueues")
      Cc: stable@vger.kernel.org # v5.9+
      Signed-off-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Acked-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      8abec36d
    • Arnd Bergmann's avatar
      dm zoned: select CONFIG_CRC32 · b690bd54
      Arnd Bergmann authored
      Without crc32 support, this driver fails to link:
      
      arm-linux-gnueabi-ld: drivers/md/dm-zoned-metadata.o: in function `dmz_write_sb':
      dm-zoned-metadata.c:(.text+0xe98): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/md/dm-zoned-metadata.o: in function `dmz_check_sb':
      dm-zoned-metadata.c:(.text+0x7978): undefined reference to `crc32_le'
      
      Fixes: 3b1a94c8 ("dm zoned: drive-managed zoned block device target")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      b690bd54
    • Anthony Iliopoulos's avatar
      dm integrity: select CRYPTO_SKCIPHER · f7b347ac
      Anthony Iliopoulos authored
      The integrity target relies on skcipher for encryption/decryption, but
      certain kernel configurations may not enable CRYPTO_SKCIPHER, leading to
      compilation errors due to unresolved symbols. Explicitly select
      CRYPTO_SKCIPHER for DM_INTEGRITY, since it is unconditionally dependent
      on it.
      Signed-off-by: default avatarAnthony Iliopoulos <ailiop@suse.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      f7b347ac
    • Mike Snitzer's avatar
      dm raid: fix discard limits for raid1 · cc07d72b
      Mike Snitzer authored
      Block core warned that discard_granularity was 0 for dm-raid with
      personality of raid1.  Reason is that raid_io_hints() was incorrectly
      special-casing raid1 rather than raid0.
      
      Fix raid_io_hints() by removing discard limits settings for
      raid1. Check for raid0 instead.
      
      Fixes: 61697a6a ("dm: eliminate 'split_discard_bios' flag from DM target interface")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarZdenek Kabelac <zkabelac@redhat.com>
      Reported-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reported-by: default avatarStephan Bärwolf <stephan@matrixstorm.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      cc07d72b
  5. 03 Jan, 2021 1 commit
  6. 02 Jan, 2021 3 commits
    • Linus Torvalds's avatar
      Merge tag 's390-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 3516bd72
      Linus Torvalds authored
      Pull s390 cleanups from Vasily Gorbik:
       "Update defconfigs and sort config select list"
      
      * tag 's390-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/Kconfig: sort config S390 select list once again
        s390: update defconfigs
      3516bd72
    • Linus Torvalds's avatar
      Merge tag 'pm-5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · d9296a7b
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix a crash in intel_pstate during resume from suspend-to-RAM
        that may occur after recent changes and two resource leaks in error
        paths in the operating performance points (OPP) framework, add a new
        C-states table to intel_idle and update the cpuidle MAINTAINERS entry
        to cover the governors too.
      
        Specifics:
      
         - Fix recently introduced crash in the intel_pstate driver that
           occurs if scale-invariance is disabled during resume from
           suspend-to-RAM due to inconsistent changes of APERF or MPERF MSR
           values made by the platform firmware (Rafael Wysocki).
      
         - Fix a memory leak and add a missing clk_put() in error paths in the
           OPP framework (Quanyang Wang, Viresh Kumar).
      
         - Add new C-states table for SnowRidge processors to the intel_idle
           driver (Artem Bityutskiy).
      
         - Update the MAINTAINERS entry for cpuidle to make it clear that the
           governors are covered by it too (Lukas Bulwahn)"
      
      * tag 'pm-5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        intel_idle: add SnowRidge C-state table
        cpufreq: intel_pstate: Fix fast-switch fallback path
        opp: Call the missing clk_put() on error
        opp: fix memory leak in _allocate_opp_table
        MAINTAINERS: include governors into CPU IDLE TIME MANAGEMENT FRAMEWORK
      d9296a7b
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-cpufreq' and 'pm-cpuidle' · 89ecf09e
      Rafael J. Wysocki authored
      * pm-cpufreq:
        cpufreq: intel_pstate: Fix fast-switch fallback path
      
      * pm-cpuidle:
        intel_idle: add SnowRidge C-state table
        MAINTAINERS: include governors into CPU IDLE TIME MANAGEMENT FRAMEWORK
      89ecf09e
  7. 01 Jan, 2021 4 commits
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · eda809ae
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a load of driver fixes (12 ufs, 1 mpt3sas, 1 cxgbi).
      
        The big core two fixes are for power management ("block: Do not accept
        any requests while suspended" and "block: Fix a race in the runtime
        power management code") which finally sorts out the resume problems
        we've occasionally been having.
      
        To make the resume fix, there are seven necessary precursors which
        effectively renames REQ_PREEMPT to REQ_PM, so every "special" request
        in block is automatically a power management exempt one.
      
        All of the non-PM preempt cases are removed except for the one in the
        SCSI Parallel Interface (spi) domain validation which is a genuine
        case where we have to run requests at high priority to validate the
        bus so this becomes an autopm get/put protected request"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (22 commits)
        scsi: cxgb4i: Fix TLS dependency
        scsi: ufs: Un-inline ufshcd_vops_device_reset function
        scsi: ufs: Re-enable WriteBooster after device reset
        scsi: ufs-mediatek: Use correct path to fix compile error
        scsi: mpt3sas: Signedness bug in _base_get_diag_triggers()
        scsi: block: Do not accept any requests while suspended
        scsi: block: Remove RQF_PREEMPT and BLK_MQ_REQ_PREEMPT
        scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE
        scsi: scsi_transport_spi: Set RQF_PM for domain validation commands
        scsi: ide: Mark power management requests with RQF_PM instead of RQF_PREEMPT
        scsi: ide: Do not set the RQF_PREEMPT flag for sense requests
        scsi: block: Introduce BLK_MQ_REQ_PM
        scsi: block: Fix a race in the runtime power management code
        scsi: ufs-pci: Enable UFSHCD_CAP_RPM_AUTOSUSPEND for Intel controllers
        scsi: ufs-pci: Fix recovery from hibernate exit errors for Intel controllers
        scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->poweroff()
        scsi: ufs-pci: Fix restore from S4 for Intel controllers
        scsi: ufs-mediatek: Keep VCC always-on for specific devices
        scsi: ufs: Allow regulators being always-on
        scsi: ufs: Clear UAC for RPMB after ufshcd resets
        ...
      eda809ae
    • Linus Torvalds's avatar
      Merge tag 'block-5.11-2021-01-01' of git://git.kernel.dk/linux-block · 8b4805c6
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Two minor block fixes from this last week that should go into 5.11:
      
         - Add missing NOWAIT debugfs definition (Andres)
      
         - Fix kerneldoc warning introduced this merge window (Randy)"
      
      * tag 'block-5.11-2021-01-01' of git://git.kernel.dk/linux-block:
        block: add debugfs stanza for QUEUE_FLAG_NOWAIT
        fs: block_dev.c: fix kernel-doc warnings from struct block_device changes
      8b4805c6
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.11-2021-01-01' of git://git.kernel.dk/linux-block · dc3e24b2
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "A few fixes that should go into 5.11, all marked for stable as well:
      
         - Fix issue around identity COW'ing and users that share a ring
           across processes
      
         - Fix a hang associated with unregistering fixed files (Pavel)
      
         - Move the 'process is exiting' cancelation a bit earlier, so
           task_works aren't affected by it (Pavel)"
      
      * tag 'io_uring-5.11-2021-01-01' of git://git.kernel.dk/linux-block:
        kernel/io_uring: cancel io_uring before task works
        io_uring: fix io_sqe_files_unregister() hangs
        io_uring: add a helper for setting a ref node
        io_uring: don't assume mm is constant across submits
      dc3e24b2
    • Linus Torvalds's avatar
      depmod: handle the case of /sbin/depmod without /sbin in PATH · cedd1862
      Linus Torvalds authored
      Commit 436e980e ("kbuild: don't hardcode depmod path") stopped
      hard-coding the path of depmod, but in the process caused trouble for
      distributions that had that /sbin location, but didn't have it in the
      PATH (generally because /sbin is limited to the super-user path).
      
      Work around it for now by just adding /sbin to the end of PATH in the
      depmod.sh script.
      Reported-and-tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cedd1862
  8. 31 Dec, 2020 3 commits
  9. 30 Dec, 2020 6 commits
  10. 29 Dec, 2020 14 commits