1. 11 Apr, 2024 8 commits
    • Linus Torvalds's avatar
      Merge tag 'bcachefs-2024-04-10' of https://evilpiepirate.org/git/bcachefs · e1dc191d
      Linus Torvalds authored
      Pull more bcachefs fixes from Kent Overstreet:
       "Notable user impacting bugs
      
         - On multi device filesystems, recovery was looping in
           btree_trans_too_many_iters(). This checks if a transaction has
           touched too many btree paths (because of iteration over many keys),
           and isuses a restart to drop unneeded paths.
      
           But it's now possible for some paths to exceed the previous limit
           without iteration in the interior btree update path, since the
           transaction commit will do alloc updates for every old and new
           btree node, and during journal replay we don't use the btree write
           buffer for locking reasons and thus those updates use btree paths
           when they wouldn't normally.
      
         - Fix a corner case in rebalance when moving extents on a
           durability=0 device. This wouldn't be hit when a device was
           formatted with durability=0 since in that case we'll only use it as
           a write through cache (only cached extents will live on it), but
           durability can now be changed on an existing device.
      
         - bch2_get_acl() could rarely forget to handle a transaction restart;
           this manifested as the occasional missing acl that came back after
           dropping caches.
      
         - Fix a major performance regression on high iops multithreaded write
           workloads (only since 6.9-rc1); a previous fix for a deadlock in
           the interior btree update path to check the journal watermark
           introduced a dependency on the state of btree write buffer flushing
           that we didn't want.
      
         - Assorted other repair paths and recovery fixes"
      
      * tag 'bcachefs-2024-04-10' of https://evilpiepirate.org/git/bcachefs: (25 commits)
        bcachefs: Fix __bch2_btree_and_journal_iter_init_node_iter()
        bcachefs: Kill read lock dropping in bch2_btree_node_lock_write_nofail()
        bcachefs: Fix a race in btree_update_nodes_written()
        bcachefs: btree_node_scan: Respect member.data_allowed
        bcachefs: Don't scan for btree nodes when we can reconstruct
        bcachefs: Fix check_topology() when using node scan
        bcachefs: fix eytzinger0_find_gt()
        bcachefs: fix bch2_get_acl() transaction restart handling
        bcachefs: fix the count of nr_freed_pcpu after changing bc->freed_nonpcpu list
        bcachefs: Fix gap buffer bug in bch2_journal_key_insert_take()
        bcachefs: Rename struct field swap to prevent macro naming collision
        MAINTAINERS: Add entry for bcachefs documentation
        Documentation: filesystems: Add bcachefs toctree
        bcachefs: JOURNAL_SPACE_LOW
        bcachefs: Disable errors=panic for BCH_IOCTL_FSCK_OFFLINE
        bcachefs: Fix BCH_IOCTL_FSCK_OFFLINE for encrypted filesystems
        bcachefs: fix rand_delete unit test
        bcachefs: fix ! vs ~ typo in __clear_bit_le64()
        bcachefs: Fix rebalance from durability=0 device
        bcachefs: Print shutdown journal sequence number
        ...
      e1dc191d
    • Linus Torvalds's avatar
      Merge tag 'tag-chrome-platform-fixes-for-v6.9-rc4' of... · 346668f0
      Linus Torvalds authored
      Merge tag 'tag-chrome-platform-fixes-for-v6.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
      
      Pull chrome platform fix from Tzung-Bi Shih:
       "Fix a NULL pointer dereference"
      
      * tag 'tag-chrome-platform-fixes-for-v6.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
        platform/chrome: cros_ec_uart: properly fix race condition
      346668f0
    • Linus Torvalds's avatar
      Merge tag 'probes-fixes-v6.9-rc3' of... · e8c39d0f
      Linus Torvalds authored
      Merge tag 'probes-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
      
      Pull probes fixes from Masami Hiramatsu:
       "Fix possible use-after-free issue on kprobe registration.
      
        check_kprobe_address_safe() uses `is_module_text_address()` and
        `__module_text_address()` separately.
      
        As a result, if the probed address is in a module that is being
        unloaded, the first `is_module_text_address()` might return true but
        then the `__module_text_address()` call might return NULL if the
        module has been unloaded between the two.
      
        The result is that kprobe believes the probe is on the kernel text,
        and skips getting a module reference. In this case, when it arms a
        breakpoint on the probe address, it may cause a use-after-free.
      
        To fix this issue, only use `__module_text_address()` once and get a
        reference to the module then. If it fails, reject the probe"
      
      * tag 'probes-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        kprobes: Fix possible use-after-free issue on kprobe registration
      e8c39d0f
    • Linus Torvalds's avatar
      Merge tag 'bootconfig-fixes-v6.9-rc3' of... · 03a55b63
      Linus Torvalds authored
      Merge tag 'bootconfig-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
      
      Pull bootconfig fixes from Masami Hiramatsu:
      
       - show the original cmdline only once, and only if it was modeified by
         bootconfig
      
      * tag 'bootconfig-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        fs/proc: Skip bootloader comment if no embedded kernel parameters
        fs/proc: remove redundant comments from /proc/bootconfig
      03a55b63
    • Kent Overstreet's avatar
      bcachefs: Fix __bch2_btree_and_journal_iter_init_node_iter() · 1189bdda
      Kent Overstreet authored
      We weren't respecting trans->journal_replay_not_finished - we shouldn't
      be searching the journal keys unless we have a ref on them.
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      1189bdda
    • Kent Overstreet's avatar
      bcachefs: Kill read lock dropping in bch2_btree_node_lock_write_nofail() · 517236cb
      Kent Overstreet authored
      dropping read locks in bch2_btree_node_lock_write_nofail() dates from
      before we had the cycle detector; we can now tell the cycle detector
      directly when taking a lock may not fail because we can't handle
      transaction restarts.
      
      This is needed for adding should_be_locked asserts.
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      517236cb
    • Kent Overstreet's avatar
      bcachefs: Fix a race in btree_update_nodes_written() · beccf291
      Kent Overstreet authored
      One btree update might have terminated in a node update, and then while
      it is in flight another btree update might free that original node.
      
      This race has to be handled in btree_update_nodes_written() - we were
      missing a READ_ONCE().
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      beccf291
    • Noah Loomans's avatar
      platform/chrome: cros_ec_uart: properly fix race condition · 5e700b38
      Noah Loomans authored
      The cros_ec_uart_probe() function calls devm_serdev_device_open() before
      it calls serdev_device_set_client_ops(). This can trigger a NULL pointer
      dereference:
      
          BUG: kernel NULL pointer dereference, address: 0000000000000000
          ...
          Call Trace:
           <TASK>
           ...
           ? ttyport_receive_buf
      
      A simplified version of crashing code is as follows:
      
          static inline size_t serdev_controller_receive_buf(struct serdev_controller *ctrl,
                                                            const u8 *data,
                                                            size_t count)
          {
                  struct serdev_device *serdev = ctrl->serdev;
      
                  if (!serdev || !serdev->ops->receive_buf) // CRASH!
                      return 0;
      
                  return serdev->ops->receive_buf(serdev, data, count);
          }
      
      It assumes that if SERPORT_ACTIVE is set and serdev exists, serdev->ops
      will also exist. This conflicts with the existing cros_ec_uart_probe()
      logic, as it first calls devm_serdev_device_open() (which sets
      SERPORT_ACTIVE), and only later sets serdev->ops via
      serdev_device_set_client_ops().
      
      Commit 01f95d42 ("platform/chrome: cros_ec_uart: fix race
      condition") attempted to fix a similar race condition, but while doing
      so, made the window of error for this race condition to happen much
      wider.
      
      Attempt to fix the race condition again, making sure we fully setup
      before calling devm_serdev_device_open().
      
      Fixes: 01f95d42 ("platform/chrome: cros_ec_uart: fix race condition")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNoah Loomans <noah@noahloomans.com>
      Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
      Link: https://lore.kernel.org/r/20240410182618.169042-2-noah@noahloomans.comSigned-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
      5e700b38
  2. 10 Apr, 2024 9 commits
    • Linus Torvalds's avatar
      Merge tag 'media/v6.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 9875c0be
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
      
       - some fixes for mediatec vcodec encoder/decoder oopses
      
      * tag 'media/v6.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: mediatek: vcodec: support 36 bits physical address
        media: mediatek: vcodec: adding lock to protect encoder context list
        media: mediatek: vcodec: adding lock to protect decoder context list
        media: mediatek: vcodec: Fix oops when HEVC init fails
        media: mediatek: vcodec: Handle VP9 superframe bitstream with 8 sub-frames
      9875c0be
    • Linus Torvalds's avatar
      Merge tag 'hardening-v6.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · fe5b5ef8
      Linus Torvalds authored
      Pull hardening fixes from Kees Cook:
      
       - gcc-plugins/stackleak: Avoid .head.text section (Ard Biesheuvel)
      
       - ubsan: fix unused variable warning in test module (Arnd Bergmann)
      
       - Improve entropy diffusion in randomize_kstack
      
      * tag 'hardening-v6.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        randomize_kstack: Improve entropy diffusion
        ubsan: fix unused variable warning in test module
        gcc-plugins/stackleak: Avoid .head.text section
      fe5b5ef8
    • Linus Torvalds's avatar
      Merge tag 'turbostat-2024.04.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux · a6189a74
      Linus Torvalds authored
      Pull turbostat updates from Len Brown:
      
       - Use of the CPU MSR driver is now optional
      
       - Perf is now preferred for many counters
      
       - Non-root users can now execute turbostat, though with limited
         functionality
      
       - Add counters for some new GFX hardware
      
       - Minor fixes
      
      * tag 'turbostat-2024.04.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (26 commits)
        tools/power turbostat: v2024.04.10
        tools/power/turbostat: Add support for Xe sysfs knobs
        tools/power/turbostat: Add support for new i915 sysfs knobs
        tools/power/turbostat: Introduce BIC_SAM_mc6/BIC_SAMMHz/BIC_SAMACTMHz
        tools/power/turbostat: Fix uncore frequency file string
        tools/power/turbostat: Unify graphics sysfs snapshots
        tools/power/turbostat: Cache graphics sysfs path
        tools/power/turbostat: Enable MSR_CORE_C1_RES support for ICX
        tools/power turbostat: Add selftests
        tools/power turbostat: read RAPL counters via perf
        tools/power turbostat: Add proper re-initialization for perf file descriptors
        tools/power turbostat: Clear added counters when in no-msr mode
        tools/power turbostat: add early exits for permission checks
        tools/power turbostat: detect and disable unavailable BICs at runtime
        tools/power turbostat: Add reading aperf and mperf via perf API
        tools/power turbostat: Add --no-perf option
        tools/power turbostat: Add --no-msr option
        tools/power turbostat: enhance -D (debug counter dump) output
        tools/power turbostat: Fix warning upon failed /dev/cpu_dma_latency read
        tools/power turbostat: Read base_hz and bclk from CPUID.16H if available
        ...
      a6189a74
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.9-2' of... · 3679d9d1
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Ilpo Järvinen:
       "Fixes:
      
         - intel/hid: Solve spurious hibernation aborts (power button release)
      
         - toshiba_acpi: Ignore 2 keys to avoid log noise during
           suspend/resume
      
         - intel-vbtn: Fix probe by restoring VBDL and VGBS evalutation order
      
         - lg-laptop: Fix W=1 %s null argument warning
      
        New HW Support:
      
         - acer-wmi: PH18-71 mode button and fan speed sensor
      
         - intel/hid: Lunar Lake and Arrow Lake HID IDs"
      
      * tag 'platform-drivers-x86-v6.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: lg-laptop: fix %s null argument warning
        platform/x86: intel-vbtn: Update tablet mode switch at end of probe
        platform/x86: intel-vbtn: Use acpi_has_method to check for switch
        platform/x86: toshiba_acpi: Silence logging for some events
        platform/x86/intel/hid: Add Lunar Lake and Arrow Lake support
        platform/x86/intel/hid: Don't wake on 5-button releases
        platform/x86: acer-wmi: Add support for Acer PH18-71
      3679d9d1
    • Zheng Yejian's avatar
      kprobes: Fix possible use-after-free issue on kprobe registration · 325f3fb5
      Zheng Yejian authored
      When unloading a module, its state is changing MODULE_STATE_LIVE ->
       MODULE_STATE_GOING -> MODULE_STATE_UNFORMED. Each change will take
      a time. `is_module_text_address()` and `__module_text_address()`
      works with MODULE_STATE_LIVE and MODULE_STATE_GOING.
      If we use `is_module_text_address()` and `__module_text_address()`
      separately, there is a chance that the first one is succeeded but the
      next one is failed because module->state becomes MODULE_STATE_UNFORMED
      between those operations.
      
      In `check_kprobe_address_safe()`, if the second `__module_text_address()`
      is failed, that is ignored because it expected a kernel_text address.
      But it may have failed simply because module->state has been changed
      to MODULE_STATE_UNFORMED. In this case, arm_kprobe() will try to modify
      non-exist module text address (use-after-free).
      
      To fix this problem, we should not use separated `is_module_text_address()`
      and `__module_text_address()`, but use only `__module_text_address()`
      once and do `try_module_get(module)` which is only available with
      MODULE_STATE_LIVE.
      
      Link: https://lore.kernel.org/all/20240410015802.265220-1-zhengyejian1@huawei.com/
      
      Fixes: 28f6c37a ("kprobes: Forbid probing on trampoline and BPF code areas")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      325f3fb5
    • Len Brown's avatar
      tools/power turbostat: v2024.04.10 · 3ab7296a
      Len Brown authored
      Much of turbostat can now run with perf, rather than using the MSR driver
      
      Some of turbostat can now run as a regular non-root user.
      
      Add some new output columns for some new GFX hardware.
      
      [This patch updates the version, but otherwise changes no function;
       it touches up some checkpatch issues from previous patches]
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      3ab7296a
    • Zhang Rui's avatar
      tools/power/turbostat: Add support for Xe sysfs knobs · 91a91d38
      Zhang Rui authored
      Xe graphics driver uses different graphics sysfs knobs including
         /sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms
         /sys/class/drm/card0/device/tile0/gt0/freq0/cur_freq
         /sys/class/drm/card0/device/tile0/gt0/freq0/act_freq
         /sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms
         /sys/class/drm/card0/device/tile0/gt1/freq0/cur_freq
         /sys/class/drm/card0/device/tile0/gt1/freq0/act_freq
      
      Plus that,
         /sys/class/drm/card0/device/tile0/gt<n>/gtidle/name
      returns either gt<n>-rc or gt<n>-mc. rc is for GFX and mc is SA Media.
      
      Enhance turbostat to prefer the Xe sysfs knobs when they are available.
      Export gt<n>-rc via BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz.
      Export gt<n>-mc via BIC_SMA_mc6/BIC_SMAMHz/BIC_SMAACTMHz.
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      91a91d38
    • Zhang Rui's avatar
      tools/power/turbostat: Add support for new i915 sysfs knobs · dc02dc93
      Zhang Rui authored
      On Meteorlake platform, i915 driver supports the traditional graphics
      sysfs knobs including
         /sys/class/drm/card0/power/rc6_residency_ms
         /sys/class/drm/card0/gt_cur_freq_mhz
         /sys/class/drm/card0/gt_act_freq_mhz
      
      At the same time, it also supports
         /sys/class/drm/card0/gt/gt0/rc6_residency_ms
         /sys/class/drm/card0/gt/gt0/rps_cur_freq_mhz
         /sys/class/drm/card0/gt/gt0/rps_act_freq_mhz
         /sys/class/drm/card0/gt/gt1/rc6_residency_ms
         /sys/class/drm/card0/gt/gt1/rps_cur_freq_mhz
         /sys/class/drm/card0/gt/gt1/rps_act_freq_mhz
      gt0 is for GFX and gt1 is for SA Media.
      
      Enhance turbostat to prefer the i915 new sysfs knobs.
      Export gt0 via BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz.
      Export gt1 via BIC_SMA_mc6/BIC_SMAMHz/BIC_SMAACTMHz.
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      dc02dc93
    • Zhang Rui's avatar
      tools/power/turbostat: Introduce BIC_SAM_mc6/BIC_SAMMHz/BIC_SAMACTMHz · 3bbb331c
      Zhang Rui authored
      Graphics driver (i915/Xe) on mordern platforms splits GFX and SA Media
      information via different sysfs knobs.
      
      Existing BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz columns can be reused for
      GFX.
      
      Introduce BIC_SAM_mc6/BIC_SAMMHz/BIC_SAMACTMHz columns for SA Media.
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      3bbb331c
  3. 09 Apr, 2024 16 commits
  4. 08 Apr, 2024 7 commits