1. 16 Apr, 2020 2 commits
  2. 14 Apr, 2020 1 commit
  3. 03 Apr, 2020 3 commits
    • Mikulas Patocka's avatar
      dm integrity: fix logic bug in integrity tag testing · 8267d8fb
      Mikulas Patocka authored
      If all the bytes are equal to DISCARD_FILLER, we want to accept the
      buffer. If any of the bytes are different, we must do thorough
      tag-by-tag checking.
      
      The condition was inverted.
      
      Fixes: 84597a44 ("dm integrity: add optional discard support")
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      8267d8fb
    • Mike Snitzer's avatar
      Revert "dm: always call blk_queue_split() in dm_process_bio()" · 120c9257
      Mike Snitzer authored
      This reverts commit effd58c9.
      
      blk_queue_split() is causing excessive IO splitting -- because
      blk_max_size_offset() depends on 'chunk_sectors' limit being set and
      if it isn't (as is the case for DM targets!) it falls back to
      splitting on a 'max_sectors' boundary regardless of offset.
      
      "Fix" this by reverting back to _not_ using blk_queue_split() in
      dm_process_bio() for normal IO (reads and writes).  Long-term fix is
      still TBD but it should focus on training blk_max_size_offset() to
      call into a DM provided hook (to call DM's max_io_len()).
      
      Test results from simple misaligned IO test on 4-way dm-striped device
      with chunksize of 128K and stripesize of 512K:
      
      xfs_io -d -c 'pread -b 2m 224s 4072s' /dev/mapper/stripe_dev
      
      before this revert:
      
      253,0   21        1     0.000000000  2206  Q   R 224 + 4072 [xfs_io]
      253,0   21        2     0.000008267  2206  X   R 224 / 480 [xfs_io]
      253,0   21        3     0.000010530  2206  X   R 224 / 256 [xfs_io]
      253,0   21        4     0.000027022  2206  X   R 480 / 736 [xfs_io]
      253,0   21        5     0.000028751  2206  X   R 480 / 512 [xfs_io]
      253,0   21        6     0.000033323  2206  X   R 736 / 992 [xfs_io]
      253,0   21        7     0.000035130  2206  X   R 736 / 768 [xfs_io]
      253,0   21        8     0.000039146  2206  X   R 992 / 1248 [xfs_io]
      253,0   21        9     0.000040734  2206  X   R 992 / 1024 [xfs_io]
      253,0   21       10     0.000044694  2206  X   R 1248 / 1504 [xfs_io]
      253,0   21       11     0.000046422  2206  X   R 1248 / 1280 [xfs_io]
      253,0   21       12     0.000050376  2206  X   R 1504 / 1760 [xfs_io]
      253,0   21       13     0.000051974  2206  X   R 1504 / 1536 [xfs_io]
      253,0   21       14     0.000055881  2206  X   R 1760 / 2016 [xfs_io]
      253,0   21       15     0.000057462  2206  X   R 1760 / 1792 [xfs_io]
      253,0   21       16     0.000060999  2206  X   R 2016 / 2272 [xfs_io]
      253,0   21       17     0.000062489  2206  X   R 2016 / 2048 [xfs_io]
      253,0   21       18     0.000066133  2206  X   R 2272 / 2528 [xfs_io]
      253,0   21       19     0.000067507  2206  X   R 2272 / 2304 [xfs_io]
      253,0   21       20     0.000071136  2206  X   R 2528 / 2784 [xfs_io]
      253,0   21       21     0.000072764  2206  X   R 2528 / 2560 [xfs_io]
      253,0   21       22     0.000076185  2206  X   R 2784 / 3040 [xfs_io]
      253,0   21       23     0.000077486  2206  X   R 2784 / 2816 [xfs_io]
      253,0   21       24     0.000080885  2206  X   R 3040 / 3296 [xfs_io]
      253,0   21       25     0.000082316  2206  X   R 3040 / 3072 [xfs_io]
      253,0   21       26     0.000085788  2206  X   R 3296 / 3552 [xfs_io]
      253,0   21       27     0.000087096  2206  X   R 3296 / 3328 [xfs_io]
      253,0   21       28     0.000093469  2206  X   R 3552 / 3808 [xfs_io]
      253,0   21       29     0.000095186  2206  X   R 3552 / 3584 [xfs_io]
      253,0   21       30     0.000099228  2206  X   R 3808 / 4064 [xfs_io]
      253,0   21       31     0.000101062  2206  X   R 3808 / 3840 [xfs_io]
      253,0   21       32     0.000104956  2206  X   R 4064 / 4096 [xfs_io]
      253,0   21       33     0.001138823     0  C   R 4096 + 200 [0]
      
      after this revert:
      
      253,0   18        1     0.000000000  4430  Q   R 224 + 3896 [xfs_io]
      253,0   18        2     0.000018359  4430  X   R 224 / 256 [xfs_io]
      253,0   18        3     0.000028898  4430  X   R 256 / 512 [xfs_io]
      253,0   18        4     0.000033535  4430  X   R 512 / 768 [xfs_io]
      253,0   18        5     0.000065684  4430  X   R 768 / 1024 [xfs_io]
      253,0   18        6     0.000091695  4430  X   R 1024 / 1280 [xfs_io]
      253,0   18        7     0.000098494  4430  X   R 1280 / 1536 [xfs_io]
      253,0   18        8     0.000114069  4430  X   R 1536 / 1792 [xfs_io]
      253,0   18        9     0.000129483  4430  X   R 1792 / 2048 [xfs_io]
      253,0   18       10     0.000136759  4430  X   R 2048 / 2304 [xfs_io]
      253,0   18       11     0.000152412  4430  X   R 2304 / 2560 [xfs_io]
      253,0   18       12     0.000160758  4430  X   R 2560 / 2816 [xfs_io]
      253,0   18       13     0.000183385  4430  X   R 2816 / 3072 [xfs_io]
      253,0   18       14     0.000190797  4430  X   R 3072 / 3328 [xfs_io]
      253,0   18       15     0.000197667  4430  X   R 3328 / 3584 [xfs_io]
      253,0   18       16     0.000218751  4430  X   R 3584 / 3840 [xfs_io]
      253,0   18       17     0.000226005  4430  X   R 3840 / 4096 [xfs_io]
      253,0   18       18     0.000250404  4430  Q   R 4120 + 176 [xfs_io]
      253,0   18       19     0.000847708     0  C   R 4096 + 24 [0]
      253,0   18       20     0.000855783     0  C   R 4120 + 176 [0]
      
      Fixes: effd58c9 ("dm: always call blk_queue_split() in dm_process_bio()")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Tested-by: default avatarBarry Marson <bmarson@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      120c9257
    • Mike Snitzer's avatar
      dm integrity: fix ppc64le warning · e7fc1e57
      Mike Snitzer authored
      Otherwise:
      
      In file included from drivers/md/dm-integrity.c:13:
      drivers/md/dm-integrity.c: In function 'dm_integrity_status':
      drivers/md/dm-integrity.c:3061:10: error: format '%llu' expects
      argument of type 'long long unsigned int', but argument 4 has type
      'long int' [-Werror=format=]
         DMEMIT("%llu %llu",
                ^~~~~~~~~~~
          atomic64_read(&ic->number_of_mismatches),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/device-mapper.h:550:46: note: in definition of macro 'DMEMIT'
            0 : scnprintf(result + sz, maxlen - sz, x))
                                                    ^
      cc1: all warnings being treated as errors
      
      Fixes: 7649194a ("dm integrity: remove sector type casts")
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      e7fc1e57
  4. 27 Mar, 2020 5 commits
    • Nikos Tsironis's avatar
      dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions() · 81d5553d
      Nikos Tsironis authored
      dm_clone_nr_of_hydrated_regions() returns the number of regions that
      have been hydrated so far. In order to do so it employs bitmap_weight().
      
      Until now, the return type of dm_clone_nr_of_hydrated_regions() was
      unsigned long.
      
      Because bitmap_weight() returns an int, in case BITS_PER_LONG == 64 and
      the return value of bitmap_weight() is 2^31 (the maximum allowed number
      of regions for a device), the result is sign extended from 32 bits to 64
      bits and an incorrect value is displayed, in the status output of
      dm-clone, as the number of hydrated regions.
      
      Fix this by having dm_clone_nr_of_hydrated_regions() return an unsigned
      int.
      
      Fixes: 7431b783 ("dm: add clone target")
      Cc: stable@vger.kernel.org # v5.4+
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      81d5553d
    • Nikos Tsironis's avatar
      dm clone: Add missing casts to prevent overflows and data corruption · 9fc06ff5
      Nikos Tsironis authored
      Add missing casts when converting from regions to sectors.
      
      In case BITS_PER_LONG == 32, the lack of the appropriate casts can lead
      to overflows and miscalculation of the device sector.
      
      As a result, we could end up discarding and/or copying the wrong parts
      of the device, thus corrupting the device's data.
      
      Fixes: 7431b783 ("dm: add clone target")
      Cc: stable@vger.kernel.org # v5.4+
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      9fc06ff5
    • Nikos Tsironis's avatar
      dm clone: Add overflow check for number of regions · cd481c12
      Nikos Tsironis authored
      Add overflow check for clone->nr_regions variable, which holds the
      number of regions of the target.
      
      The overflow can occur with sufficiently large devices, if BITS_PER_LONG
      == 32. E.g., if the region size is 8 sectors (4K), the overflow would
      occur for device sizes > 34359738360 sectors (~16TB).
      
      This could result in multiple device sectors wrongly mapping to the same
      region number, due to the truncation from 64 bits to 32 bits, which
      would lead to data corruption.
      
      Fixes: 7431b783 ("dm: add clone target")
      Cc: stable@vger.kernel.org # v5.4+
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      cd481c12
    • Nikos Tsironis's avatar
      dm clone: Fix handling of partial region discards · 4b514290
      Nikos Tsironis authored
      There is a bug in the way dm-clone handles discards, which can lead to
      discarding the wrong blocks or trying to discard blocks beyond the end
      of the device.
      
      This could lead to data corruption, if the destination device indeed
      discards the underlying blocks, i.e., if the discard operation results
      in the original contents of a block to be lost.
      
      The root of the problem is the code that calculates the range of regions
      covered by a discard request and decides which regions to discard.
      
      Since dm-clone handles the device in units of regions, we don't discard
      parts of a region, only whole regions.
      
      The range is calculated as:
      
          rs = dm_sector_div_up(bio->bi_iter.bi_sector, clone->region_size);
          re = bio_end_sector(bio) >> clone->region_shift;
      
      , where 'rs' is the first region to discard and (re - rs) is the number
      of regions to discard.
      
      The bug manifests when we try to discard part of a single region, i.e.,
      when we try to discard a block with size < region_size, and the discard
      request both starts at an offset with respect to the beginning of that
      region and ends before the end of the region.
      
      The root cause is the following comparison:
      
        if (rs == re)
          // skip discard and complete original bio immediately
      
      , which doesn't take into account that 'rs' might be greater than 're'.
      
      Thus, we then issue a discard request for the wrong blocks, instead of
      skipping the discard all together.
      
      Fix the check to also take into account the above case, so we don't end
      up discarding the wrong blocks.
      
      Also, add some range checks to dm_clone_set_region_hydrated() and
      dm_clone_cond_set_range(), which update dm-clone's region bitmap.
      
      Note that the aforementioned bug doesn't cause invalid memory accesses,
      because dm_clone_is_range_hydrated() returns True for this case, so the
      checks are just precautionary.
      
      Fixes: 7431b783 ("dm: add clone target")
      Cc: stable@vger.kernel.org # v5.4+
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      4b514290
    • Mikulas Patocka's avatar
      dm writecache: add cond_resched to avoid CPU hangs · 1edaa447
      Mikulas Patocka authored
      Initializing a dm-writecache device can take a long time when the
      persistent memory device is large.  Add cond_resched() to a few loops
      to avoid warnings that the CPU is stuck.
      
      Cc: stable@vger.kernel.org # v4.18+
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      1edaa447
  5. 24 Mar, 2020 15 commits
  6. 15 Mar, 2020 10 commits
    • Linus Torvalds's avatar
      Linux 5.6-rc6 · fb33c651
      Linus Torvalds authored
      fb33c651
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a42a7bb6
      Linus Torvalds authored
      Pull irq fix from Thomas Gleixner:
       "A single commit to handle an erratum in Cavium ThunderX to prevent
        access to GIC registers which are broken in the implementation"
      
      * tag 'irq-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Workaround Cavium erratum 38539 when reading GICD_TYPER2
      a42a7bb6
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 34d5a4b3
      Linus Torvalds authored
      Pull futex fix from Thomas Gleixner:
       "Fix for yet another subtle futex issue.
      
        The futex code used ihold() to prevent inodes from vanishing, but
        ihold() does not guarantee inode persistence. Replace the inode
        pointer with a per boot, machine wide, unique inode identifier.
      
        The second commit fixes the breakage of the hash mechanism which
        causes a 100% performance regression"
      
      * tag 'locking-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        futex: Unbreak futex hashing
        futex: Fix inode life-time issue
      34d5a4b3
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ec181b7f
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "Two fixes for x86:
      
         - Map EFI runtime service data as encrypted when SEV is enabled.
      
           Otherwise e.g. SMBIOS data cannot be properly decoded by dmidecode.
      
         - Remove the warning in the vector management code which triggered
           when a managed interrupt affinity changed outside of a CPU hotplug
           operation.
      
           The warning was correct until the recent core code change that
           introduced a CPU isolation feature which needs to migrate managed
           interrupts away from online CPUs under certain conditions to
           achieve the isolation"
      
      * tag 'x86-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/vector: Remove warning on managed interrupt migration
        x86/ioremap: Map EFI runtime services data as encrypted for SEV
      ec181b7f
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e99bc917
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "A pile of perf fixes:
      
        Kernel side:
      
         - AMD uncore driver: Replace the open coded sanity check with the
           core variant, which provides the correct error code and also leaves
           a hint in dmesg
      
        Tooling:
      
         - Fix the stdio input handling with glibc versions >= 2.28
      
         - Unbreak the futex-wake benchmark which was reduced to 0 test
           threads due to the conversion to cpumaps
      
         - Initialize sigaction structs before invoking sys_sigactio()
      
         - Plug the mapfile memory leak in perf jevents
      
         - Fix off by one relative directory includes
      
         - Fix an undefined string comparison in perf diff"
      
      * tag 'perf-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/amd/uncore: Replace manual sampling check with CAP_NO_INTERRUPT flag
        tools: Fix off-by 1 relative directory includes
        perf jevents: Fix leak of mapfile memory
        perf bench: Clear struct sigaction before sigaction() syscall
        perf bench futex-wake: Restore thread count default to online CPU count
        perf top: Fix stdio interface input handling with glibc 2.28+
        perf diff: Fix undefined string comparision spotted by clang's -Wstring-compare
        perf symbols: Don't try to find a vmlinux file when looking for kernel modules
        perf bench: Share some global variables to fix build with gcc 10
        perf parse-events: Use asprintf() instead of strncpy() to read tracepoint files
        perf env: Do not return pointers to local variables
        perf tests bp_account: Make global variable static
      e99bc917
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ffe6da91
      Linus Torvalds authored
      Pull timer fix from Thomas Gleixner:
       "A single fix adding the missing time namespace adjustment in
        sys/sysinfo which caused sys/sysinfo to be inconsistent with
        /proc/uptime when read from a task inside a time namespace"
      
      * tag 'timers-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sys/sysinfo: Respect boottime inside time namespace
      ffe6da91
    • Linus Torvalds's avatar
      Merge tag 'ras-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 52ac3777
      Linus Torvalds authored
      Pull RAS fixes from Thomas Gleixner:
       "Two RAS related fixes:
      
         - Shut down the per CPU thermal throttling poll work properly when a
           CPU goes offline.
      
           The missing shutdown caused the poll work to be migrated to a
           unbound worker which triggered warnings about the usage of
           smp_processor_id() in preemptible context
      
         - Fix the PPIN feature initialization which missed to enable the
           functionality when PPIN_CTL was enabled but the MSR locked against
           updates"
      
      * tag 'ras-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mce: Fix logic and comments around MSR_PPIN_CTL
        x86/mce/therm_throt: Undo thermal polling properly on CPU offline
      52ac3777
    • Linus Torvalds's avatar
      Merge tag 'efi-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b67775e1
      Linus Torvalds authored
      Pull EFI fixes from Thomas Gleixner:
       "Two EFI fixes:
      
         - Prevent a race and buffer overflow in the sysfs efivars interface
           which causes kernel memory corruption.
      
         - Add the missing NULL pointer checks in efivar_store_raw()"
      
      * tag 'efi-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi: Add a sanity check to efivar_store_raw()
        efi: Fix a race and a buffer overflow while reading efivars via sysfs
      b67775e1
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · de28a65c
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
      
       - Intel VT-d fixes:
          - RCU list handling fixes
          - Replace WARN_TAINT with pr_warn + add_taint for reporting firmware
            issues
          - DebugFS fixes
          - Fix for hugepage handling in iova_to_phys implementation
          - Fix for handling VMD devices, which have a domain number which
            doesn't fit into 16 bits
          - Warning message fix
      
       - MSI allocation fix for iommu-dma code
      
       - Sign-extension fix for io page-table code
      
       - Fix for AMD-Vi to properly update the is-running bit when AVIC is
         used
      
      * tag 'iommu-fixes-v5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Populate debugfs if IOMMUs are detected
        iommu/amd: Fix IOMMU AVIC not properly update the is_run bit in IRTE
        iommu/vt-d: Ignore devices with out-of-spec domain number
        iommu/vt-d: Fix the wrong printing in RHSA parsing
        iommu/vt-d: Fix debugfs register reads
        iommu/vt-d: quirk_ioat_snb_local_iommu: replace WARN_TAINT with pr_warn + add_taint
        iommu/vt-d: dmar_parse_one_rmrr: replace WARN_TAINT with pr_warn + add_taint
        iommu/vt-d: dmar: replace WARN_TAINT with pr_warn + add_taint
        iommu/vt-d: Silence RCU-list debugging warnings
        iommu/vt-d: Fix RCU-list bugs in intel_iommu_init()
        iommu/dma: Fix MSI reservation allocation
        iommu/io-pgtable-arm: Fix IOVA validation for 32-bit
        iommu/vt-d: Fix a bug in intel_iommu_iova_to_phys() for huge page
        iommu/vt-d: Fix RCU list debugging warnings
      de28a65c
    • Thomas Gleixner's avatar
      Merge tag 'irqchip-fixes-5.6-2' of... · 92c22755
      Thomas Gleixner authored
      Merge tag 'irqchip-fixes-5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/urgent
      
      Pull irqchip fixes from Marc Zyngier:
      
      - Add workaround for Cavium/Marvell ThunderX unimplemented GIC registers
      92c22755
  7. 14 Mar, 2020 4 commits