1. 24 Mar, 2018 5 commits
    • Darrick J. Wong's avatar
      xfs: refactor bmap record validation · 30b0984d
      Darrick J. Wong authored
      Refactor the bmap validator into a more complete helper that looks for
      extents that run off the end of the device, overflow into the next AG,
      or have invalid flag states.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      30b0984d
    • Darrick J. Wong's avatar
      xfs: sanity-check the unused space before trying to use it · 6915ef35
      Darrick J. Wong authored
      In xfs_dir2_data_use_free, we examine on-disk metadata and ASSERT if
      it doesn't make sense.  Since a carefully crafted fuzzed image can cause
      the kernel to crash after blowing a bunch of assertions, let's move
      those checks into a validator function and rig everything up to return
      EFSCORRUPTED to userspace.  Found by lastbit fuzzing ltail.bestcount via
      xfs/391.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      6915ef35
    • Brian Foster's avatar
      xfs: detect agfl count corruption and reset agfl · a27ba260
      Brian Foster authored
      The struct xfs_agfl v5 header was originally introduced with
      unexpected padding that caused the AGFL to operate with one less
      slot than intended. The header has since been packed, but the fix
      left an incompatibility for users who upgrade from an old kernel
      with the unpacked header to a newer kernel with the packed header
      while the AGFL happens to wrap around the end. The newer kernel
      recognizes one extra slot at the physical end of the AGFL that the
      previous kernel did not. The new kernel will eventually attempt to
      allocate a block from that slot, which contains invalid data, and
      cause a crash.
      
      This condition can be detected by comparing the active range of the
      AGFL to the count. While this detects a padding mismatch, it can
      also trigger false positives for unrelated flcount corruption. Since
      we cannot distinguish a size mismatch due to padding from unrelated
      corruption, we can't trust the AGFL enough to simply repopulate the
      empty slot.
      
      Instead, avoid unnecessarily complex detection logic and and use a
      solution that can handle any form of flcount corruption that slips
      through read verifiers: distrust the entire AGFL and reset it to an
      empty state. Any valid blocks within the AGFL are intentionally
      leaked. This requires xfs_repair to rectify (which was already
      necessary based on the state the AGFL was found in). The reset
      mitigates the side effect of the padding mismatch problem from a
      filesystem crash to a free space accounting inconsistency. The
      generic approach also means that this patch can be safely backported
      to kernels with or without a packed struct xfs_agfl.
      
      Check the AGF for an invalid freelist count on initial read from
      disk. If detected, set a flag on the xfs_perag to indicate that a
      reset is required before the AGFL can be used. In the first
      transaction that attempts to use a flagged AGFL, reset it to empty,
      warn the user about the inconsistency and allow the freelist fixup
      code to repopulate the AGFL with new blocks. The xfs_perag flag is
      cleared to eliminate the need for repeated checks on each block
      allocation operation.
      
      This allows kernels that include the packing fix commit 96f859d5
      ("libxfs: pack the agfl header structure so XFS_AGFL_SIZE is correct")
      to handle older unpacked AGFL formats without a filesystem crash.
      Suggested-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by Dave Chiluk <chiluk+linuxxfs@indeed.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      a27ba260
    • Christoph Hellwig's avatar
      xfs: unwind the try_again loop in xfs_log_force · 3e4da466
      Christoph Hellwig authored
      Instead split out a __xfs_log_fore_lsn helper that gets called again
      with the already_slept flag set to true in case we had to sleep.
      
      This prepares for aio_fsync support.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      3e4da466
    • Christoph Hellwig's avatar
      xfs: refactor xfs_log_force_lsn · 93806299
      Christoph Hellwig authored
      Use the the smallest possible loop as preable to find the correct iclog
      buffer, and then use gotos for unwinding to straighten the code.
      
      Also fix the top of function comment while we're at it.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      93806299
  2. 15 Mar, 2018 6 commits
  3. 14 Mar, 2018 6 commits
  4. 12 Mar, 2018 19 commits
  5. 11 Mar, 2018 4 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ed58d66f
      Linus Torvalds authored
      Pull x86/pti updates from Thomas Gleixner:
       "Yet another pile of melted spectrum related updates:
      
         - Drop native vsyscall support finally as it causes more trouble than
           benefit.
      
         - Make microcode loading more robust. There were a few issues
           especially related to late loading which are now surfacing because
           late loading of the IB* microcodes addressing spectre issues has
           become more widely used.
      
         - Simplify and robustify the syscall handling in the entry code
      
         - Prevent kprobes on the entry trampoline code which lead to kernel
           crashes when the probe hits before CR3 is updated
      
         - Don't check microcode versions when running on hypervisors as they
           are considered as lying anyway.
      
         - Fix the 32bit objtool build and a coment typo"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/kprobes: Fix kernel crash when probing .entry_trampoline code
        x86/pti: Fix a comment typo
        x86/microcode: Synchronize late microcode loading
        x86/microcode: Request microcode on the BSP
        x86/microcode/intel: Look into the patch cache first
        x86/microcode: Do not upload microcode if CPUs are offline
        x86/microcode/intel: Writeback and invalidate caches before updating microcode
        x86/microcode/intel: Check microcode revision before updating sibling threads
        x86/microcode: Get rid of struct apply_microcode_ctx
        x86/spectre_v2: Don't check microcode versions when running under hypervisors
        x86/vsyscall/64: Drop "native" vsyscalls
        x86/entry/64/compat: Save one instruction in entry_INT80_compat()
        x86/entry: Do not special-case clone(2) in compat entry
        x86/syscalls: Use COMPAT_SYSCALL_DEFINEx() macros for x86-only compat syscalls
        x86/syscalls: Use proper syscall definition for sys_ioperm()
        x86/entry: Remove stale syscall prototype
        x86/syscalls/32: Simplify $entry == $compat entries
        objtool: Fix 32-bit build
      ed58d66f
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1ad5daa6
      Linus Torvalds authored
      Pull timer fix from Thomas Gleixner:
       "Just a single fix which adds a missing Kconfig dependency to avoid
        unmet dependency warnings"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource/atmel-st: Add 'depends on HAS_IOMEM' to fix unmet dependency
      1ad5daa6
    • Linus Torvalds's avatar
      Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ebb3762e
      Linus Torvalds authored
      Pull RAS fixes from Thomas Gleixner:
       "Two small fixes for RAS/MCE:
      
         - Serialize sysfs changes to avoid concurrent modificaiton of
           underlying data
      
         - Add microcode revision to Machine Check records. This should have
           been there forever, but now with the broken microcode versions in
           the wild it has become important"
      
      * 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/MCE: Serialize sysfs changes
        x86/MCE: Save microcode revision in machine check records
      ebb3762e
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8ad44243
      Linus Torvalds authored
      Pull perf updates from Thomas Gleixner:
       "Another set of perf updates:
      
         - Fix a Skylake Uncore event format declaration
      
         - Prevent perf pipe mode from crahsing which was caused by a missing
           buffer allocation
      
         - Make the perf top popup message which tells the user that it uses
           fallback mode on older kernels a debug message.
      
         - Make perf context rescheduling work correcctly
      
         - Robustify the jump error drawing in perf browser mode so it does
           not try to create references to NULL initialized offset entries
      
         - Make trigger_on() robust so it does not enable the trigger before
           everything is set up correctly to handle it
      
         - Make perf auxtrace respect the --no-itrace option so it does not
           try to queue AUX data for decoding.
      
         - Prevent having different number of field separators in CVS output
           lines when a counter is not supported.
      
         - Make the perf kallsyms man page usage behave like it does for all
           other perf commands.
      
         - Synchronize the kernel headers"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Fix ctx_event_type in ctx_resched()
        perf tools: Fix trigger class trigger_on()
        perf auxtrace: Prevent decoding when --no-itrace
        perf stat: Fix CVS output format for non-supported counters
        tools headers: Sync x86's cpufeatures.h
        tools headers: Sync copy of kvm UAPI headers
        perf record: Fix crash in pipe mode
        perf annotate browser: Be more robust when drawing jump arrows
        perf top: Fix annoying fallback message on older kernels
        perf kallsyms: Fix the usage on the man page
        perf/x86/intel/uncore: Fix Skylake UPI event format
      8ad44243