Commit Graph

53761 Commits

Author SHA1 Message Date
Linus Torvalds
4cbdd58dfa Perf events updates:
- Support SIMD/eGPRs/SSP register sampling in perf
    (Dapeng Mi, Kan Liang)
 
  - Turn amd_uncore_ctx events into a flexible array (Rosen Penev)
 
  - Finish the work related to fixing the guest PEBS path to not
    set unwanted PERF_GLOBAL_CTRL bits, for which urgent fixes
    are upstream already (Sean Christopherson)
 
  - Drop redundant counter slot searches in the AMD uncore
    driver (Usama Arif)
 
  - Don't WARN when the ext_regs_buf allocation fails (vineash)
 
  - Annotate x86_pmu::hybrid_pmu with __counted_by_ptr (Thorsten Blum)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmrUmW4RHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1hhcA/9GLLMd5OOBjw8i2ckWMOoi5UgmflkApBa
 BiAV9jEaIt3AaOS4hUe1Ttnrk02rWuq1NppwJm4n4foxysEI54ZwMfsWYeXLjdQ7
 Lw5Q+4/NwvuMPkE8pcasyM+OYE7BOnNRZijjqcDycYHcx0E464n4/sWFG9HQxhVa
 mNTLNvix9tIQTLjBTWWJdBDWYMvMlqvkjqCYNAf3CPDWP718pc29ilvZ3HW/qh2w
 iLELMP2+wPInfB7mDNy5aSdv0nLuSZHtmFshYSMK0d1MfIYd1a8p7XEYQ61iOCMz
 ZXKO3h21Ri0Ze7c3v6URlu3JsDv6lWiFyqW+ZyG9XFkmzam0Lk/HqFEg84QKUbPt
 9qiMxpLKQFhjumJRacZiswb/pKHGPbYQGkjt3wl5J5wSikiB57VnF+yPqwXFAlmx
 LIa7qLThGSy9Ju6dqbbpEkiiRkl7+Gb9zPAISbTjse9BdXiCUCKihUT689nAfmqT
 t7bTwocrYvSZiNK1ipEf+ARRb9lqLBF6LZ59WsFlVddMfiBb/f1x0b0M5sVEKucv
 JMOywESH6SFE0j533WA6WY6+iRG+FFa+k7mu78RO2nnKSXEXsLDQ5o3iyhQ2B4uD
 xaUq7J4DTRfu6XU1bK4HpBnKDgWzdkLrD+m8mTKPeNW5kMZC6QYakjQtqpC3Qks4
 liX/+yGieJs=
 =+I0p
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf events updates from Ingo Molnar:

 - Support SIMD/eGPRs/SSP register sampling in perf
   (Dapeng Mi, Kan Liang)

 - Turn amd_uncore_ctx events into a flexible array (Rosen Penev)

 - Finish the work related to fixing the guest PEBS path to not
   set unwanted PERF_GLOBAL_CTRL bits, for which urgent fixes
   are upstream already (Sean Christopherson)

 - Drop redundant counter slot searches in the AMD uncore
   driver (Usama Arif)

 - Don't WARN when the ext_regs_buf allocation fails (vineash)

 - Annotate x86_pmu::hybrid_pmu with __counted_by_ptr (Thorsten Blum)

* tag 'perf-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (34 commits)
  perf/x86: Don't WARN when the ext_regs_buf allocation fails
  perf/x86/amd/uncore: Free counter slot by index
  perf/x86/amd/uncore: Remove redundant event slot scan
  perf/x86/intel: Check only PMC bits in PEBS_ENABLED when detecting host PEBS usage
  KVM: VMX: Only tell perf to enable PEBS counters for fully enabled PMCs
  KVM: VMX: Drop a redundant pmu->global_ctrl check when processing pebs_enable
  perf/x86/intel: KVM: Handle cross-mapped PEBS PMCs entirely within KVM
  perf/x86: KVM: Have perf define a dedicated struct for getting guest PEBS data
  perf/x86/intel: Invert names of intel_ctrl_{guest,host}_mask
  perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
  perf/x86/amd/uncore: Turn amd_uncore_ctx events into a flexible array
  perf/x86/intel: Add sanity check for PEBS record/fragment size
  perf/x86: Activate back-to-back NMI detection for arch-PEBS induced NMIs
  perf/x86/intel: Advertise PERF_PMU_CAP_SIMD_REGS capability
  perf/x86/intel: Support arch-PEBS based SIMD/eGPRs sampling
  perf/x86: Support SSP sampling using sample_regs_* fields
  perf/x86: Support eGPRs sampling using sample_regs_* fields
  perf: Enhance perf_reg_validate() with simd_enabled argument
  perf/x86: Support OPMASK sampling using sample_simd_pred_reg_* fields
  perf/x86: Support ZMM sampling using sample_simd_vec_reg_* fields
  ...
2026-10-20 13:00:41 -10:00
Linus Torvalds
776bb6df3f Locking updates:
- In the refcount checking code, BUG() on UAF related errors if
    CONFIG_BUG_ON_DATA_CORRUPTION=y (Jann Horn)
 
  - Add {over,under}flow detection for local_interrupt_{enable,disable}()
    (Boqun Feng)
 
  - Add kunit test case for max local_interrupt_disable() nesting level
    (Boqun Feng)
 
  - Clarify comment (Boqun Feng)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmrUlMkRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1jSug//cjg5WItJ31KfJuzjlRhLJmMdjaPflV+7
 y99hHMLZFu8+L20U8lqBLCCdjmgS3RnPUHsncSwxZHOIrp3zAduc85oa4FMultwq
 XT39jTLEiIfa/2S5/k48PCFZbB6kgFGZGLiAd/h8HuUi4w8t0deGNggdtQCANOdF
 OnpZedXttevu+tbqZFVn2CBZ9Y83S8au1GNuQTu/CAILAPFOalJWP/L+yxns6uZo
 W/5oJvW+RmjswKBFKEgPJSOg56VPURZBPqPZntB9TVyiUSAx7wQeXhMdVFL6e6hx
 MEE5uxbKAqau0LmbTJy7GHpZym4p2hNHIyACxiQX7eXd4l20C/INHVgwYvSRgF9F
 V2VgBMPxH6wXxxNeFujBnNfeUaZfb/9c/E0AQfIQNhexqXahA8bBfmwDy3T+2smq
 usRFLW676zAam2WybsJmANSHZ+KhKaVolOBJTLEUnGA2CG5ONt/xa3HqHNTKCI22
 CY6D6iSgKBzhmso2A7EGdajx3kBkNycfdrVlqXz6YIw7MiNZlONPWf7698bzszPL
 HcE9KWr+0Pt23R5t6g1BBg7T0mnARX8/k3UR5fUC+1zovoKQAm4k8VacDMhF1GSP
 xt7EKiQgNjSRPKdlF+vAlk97qEWqIqkHjvyw5dX+Gz3d4uJ+UHwJDqMM50dEm8g6
 JgqckejzN1A=
 =nN01
 -----END PGP SIGNATURE-----

Merge tag 'locking-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking updates from Ingo Molnar:

 - In the refcount checking code, BUG() on UAF related errors if
   CONFIG_BUG_ON_DATA_CORRUPTION=y (Jann Horn)

 - Add {over,under}flow detection for local_interrupt_{enable,disable}()
   (Boqun Feng)

 - Add kunit test case for max local_interrupt_disable() nesting level
   (Boqun Feng)

 - Clarify comment (Boqun Feng)

* tag 'locking-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irq: Add max local_interrupt_disable() nesting level kunit test case
  irq: Explain better on NMI_MASK overflow condition
  irq: Add {over,under}flow detection for local_interrupt_{enable,disable}
  refcount: Use CONFIG_BUG_ON_DATA_CORRUPTION for UAF-related errors
2026-10-20 12:43:05 -10:00
Linus Torvalds
cb95904b47 Scheduler updates:
Kconfig updates:
 
  - Simplify PREEMPT_DYNAMIC (Mark Rutland)
 
 Fair scheduler updates:
 
  - Remove redundant RUN_TO_PARITY check (Elif Topuz)
 
  - Declare augmented callbacks per field, fix rb_add_augmented_cached()
    descent (Yiwei Lin, Peter Zijlstra)
 
  - Restart fair hrtick after same-task repicks (Shubhang Kaushik)
 
  - Improve the scheduling latency of short slice tasks (Vincent Guittot)
 
 Deadline/RT scheduler updates:
 
  - Check start_dl_timer expiry with ktime_before()
    (Liang Hao)
 
  - irq_work: CPU-hotplug improvements on PREEMPT_RT (Sebastian Andrzej
    Siewior)
 
 Energy-aware scheduling updates:
 
  - Implement the steal_governor, introduce preferred CPUs and
    steal-driven vCPU backoff (Shrikanth Hegde)
 
 Multi-processor load-balancing updates:
 
  - Enable preferred SMT siblings on NVIDIA Olympus (Andrea Righi)
 
  - Randomize equally shallow idle CPU picks (Christian Loehle)
 
  - Remove redundant core_sched_seq (Hui Su)
 
 Cache-aware scheduling updates:
 
  - Avoid publishing partial LLC utilization (Jemmy Wong)
 
 NUMA-balancing updates:
 
  - Reset NUMA fault locality after scan period update (Eric Kim)
 
 Proxy execution updates:
 
  - Ongoing work to implement sleeping owner handling for proxy
    execution (John Stultz, Vasily Gorbik)
 
  - Preparatory steps to make sched_ext compatible with proxy
    execution (Andrea Righi)
 
 Scheduler infrastructure updates & fixes:
 
  - Remove the RCU wait from PSI trigger destruction (Shakeel Butt)
 
  - Avoid modifying wait-entry on failed priority registration
    (Hui Su)
 
  - Use the new static key API for sched_feat (Hongyan Xia)
 
  - Convert paravirt_steal to new static key APIs (Hongyan Xia)
 
  - cputime: Don't account idle time twice after dyntick-idle
    (Stian Halseth)
 
 Scheduler debugging updates:
 
  - Set TIF_NEED_RESCHED before calling __trace_set_need_resched()
    (Sechang Lim)
 
  - Fix context analysis errors in non-preferred CPU push (Shrikanth
    Hegde)
 
 Misc cleanups and fixes by Christian Loehle, Shubhang Kaushik,
 Thomas Huth and Vladimir Zapolskiy.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmrUomIRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1ik+Q/+Jx0tXmwOm/wk1ba50zz/tkUL17APJzD1
 0TdHSf0sqssyVnQVmGBNWoKfp30zzrnd8Yf46PH5kUmyIxX0LqazAXsPA/0lxAY6
 jB2b5ZGosyQQPqyjM1q48K/BMB+GGO9xDKlFxxkBsICi+vS+6diBzXM70xla9M4O
 CcAO5DHb50otN/TljfnkmbxG7vgssCVZyS7XG6bSyhd6tUrcr4DVD7gYOMbSVcaL
 8Cgu+b54rOAcrcWU1454YKHI5etUOTjblCbFgISrdw7lwf4dKVtTAKSanFX9n522
 q9sQ1vzuRz6JfSak9nxFkCy5SMjuHJ53DkVNR4eUXNmM0tHdAcVd8jOexmQVBrug
 Yjloo/WydUqGT2TYYEVQPi4J+jMqMRyDIp3TL9UuQjwcjHRnUpd8EVmoNme0TOi+
 e3SoS+xOSVBLgbMFwrjJR/tQuqDPjgBrgIyg8wL+ed5cY6Equ+J3467wp8lO7RBN
 uGwChvxQAOaMlkh5tIR38Zjq9kzs79y85vz3uD2SNk17TcvijVw9UsmQKfAkpdZo
 5FUDM2AdyOhOtZkzMNLHfjjBLSMVCBRo726c6WbELibhuWN7xTAJSJx8o8JNOCrC
 vOBcNNAHpU7BwqA0gFIA3lL1uMXvKn9npKKjnB2C4WxhFGf23NF6uPapyA4sMZ00
 YwRGvOeDvu4=
 =cPCx
 -----END PGP SIGNATURE-----

Merge tag 'sched-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler updates from Ingo Molnar:
 "Kconfig updates:

   - Simplify PREEMPT_DYNAMIC (Mark Rutland)

  Fair scheduler updates:

   - Remove redundant RUN_TO_PARITY check (Elif Topuz)

   - Declare augmented callbacks per field, fix
     rb_add_augmented_cached() descent (Yiwei Lin, Peter Zijlstra)

   - Restart fair hrtick after same-task repicks (Shubhang Kaushik)

   - Improve the scheduling latency of short slice tasks (Vincent
     Guittot)

  Deadline/RT scheduler updates:

   - Check start_dl_timer expiry with ktime_before() (Liang Hao)

   - irq_work: CPU-hotplug improvements on PREEMPT_RT (Sebastian Andrzej
     Siewior)

  Energy-aware scheduling updates:

   - Implement the steal_governor, introduce preferred CPUs and
     steal-driven vCPU backoff (Shrikanth Hegde)

  Multi-processor load-balancing updates:

   - Enable preferred SMT siblings on NVIDIA Olympus (Andrea Righi)

   - Randomize equally shallow idle CPU picks (Christian Loehle)

   - Remove redundant core_sched_seq (Hui Su)

  Cache-aware scheduling updates:

   - Avoid publishing partial LLC utilization (Jemmy Wong)

  NUMA-balancing updates:

   - Reset NUMA fault locality after scan period update (Eric Kim)

  Proxy execution updates:

   - Ongoing work to implement sleeping owner handling for proxy
     execution (John Stultz, Vasily Gorbik)

   - Preparatory steps to make sched_ext compatible with proxy execution
     (Andrea Righi)

  Scheduler infrastructure updates & fixes:

   - Remove the RCU wait from PSI trigger destruction (Shakeel Butt)

   - Avoid modifying wait-entry on failed priority registration
     (Hui Su)

   - Use the new static key API for sched_feat (Hongyan Xia)

   - Convert paravirt_steal to new static key APIs (Hongyan Xia)

   - cputime: Don't account idle time twice after dyntick-idle
     (Stian Halseth)

  Scheduler debugging updates:

   - Set TIF_NEED_RESCHED before calling __trace_set_need_resched()
     (Sechang Lim)

   - Fix context analysis errors in non-preferred CPU push (Shrikanth
     Hegde)

  Misc cleanups and fixes by Christian Loehle, Shubhang Kaushik,
  Thomas Huth and Vladimir Zapolskiy"

* tag 'sched-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (64 commits)
  sched: Replace nr_iowait_cpu() with a bool accessor
  Revert "sched/fair: Remove dead code on enqueue_task_fair()"
  sched/cache: Avoid publishing partial LLC utilization
  sched/cputime: Don't account idle time twice after dyntick-idle
  sched/psi: Remove the RCU wait from trigger destruction
  sched/eevdf: Remove redundant RUN_TO_PARITY check
  sched/wait: Avoid modifying entry on failed priority registration
  rbtree_test: Use rb_add_augmented_cached() for the cached augmented test
  rbtree: Update augmented data on the way down in rb_add_augmented_cached()
  rbtree: Declare augmented callbacks per field with RB_AUG()
  rbtree_test: Use rb_add() and rb_add_cached() for the basic tests
  smpboot: Don't park the thread if work is pending
  irq_work: Flush lazy work CPU down on PREEMPT_RT
  irq_work: Update a comment regarding CPU hotplug invocation
  sched/topology: Add asymmetric SMT packing override
  sched/fair: Honor asymmetric SMT priority in idle selection
  sched: Set TIF_NEED_RESCHED before calling __trace_set_need_resched()
  sched/core: Fix context analysis errors in non-preferred CPU push
  virt/steal_governor: Enable the driver
  virt/steal_governor: Implement steal_governor policy loop
  ...
2026-10-20 12:35:35 -10:00
Linus Torvalds
5d92881a85 - Resolve NR_CPUS versus NR_CPUS_DEFAULT confusion
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEV76QKkVc4xCGURexaDWVMHDJkrAFAmrWMUIACgkQaDWVMHDJ
 krAyKw//fep0gaWaIVQnn9l18CVwW+awSCUVPhg4+NdHnWr1yb5iPK+ihh5gEreC
 nW96Ni0vrkq8qdDZ298EbUxbwtmV6/+HnDo4SyuUMBdNOEUxtkr5QZdACBQHwk0J
 bb3BOwtopCmC1JTOEERjUnMDxG4KAzBomq+ls3ByOkvoMsSwCwb8N57BdRSCbGVf
 2dLzDpUHF0jvwsARFFjrpWLzitiCPobuDlymy6zyat/9ivKDJs4V6B3CuWjaxFU2
 tydl5i2JrcaYog+DZwX2ijZkZ/lfPFpM+bX/s8e2HQqcb9xMrbvXMJtrdqrNe+D/
 3AjEL0m0wNNieJcT1dLP/+FMqUTg7IODXWx1lO3u7CjOL7vwkhHwiAPaqO/3VNeq
 o7Cjloa1PbdPqIyCzlUJ+/mW2Ze6xe/1tATo7i9HqbCo0HouIICmII2H4/vDc4aK
 wkuISoi0NfJPNjmxogmBzep0yKFkzBc7BGQgOO+QjMZyan0+NnoKaAaiNSXmTsaK
 VeyMJWgoYmFWqUnNe7RLBwi4Qp+iL3lL1N4zpWRP9w+zYEPZb2hivg3/BcqG1qAj
 ITYyHNz8sgev6//JcQzGbuL3ODYd9FAiAkQH/0q1IKFX5Mlvr1LOlBu7LVn7IDH9
 0hQNG4j6HH1bqLGNhA3+oLDiiDOO7DcMXrmM8WUbor9mhA90ZXU=
 =IH9T
 -----END PGP SIGNATURE-----

Merge tag 'x86_kdump_for_7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 kdump update from Dave Hansen:
 "Some kdump code is using NR_CPUS_DEFAULT as if it were the actual,
  in-use max number of CPUs. Move it over to use NR_CPUS instead.

  I suspect this one being in-tree for a few years means that the vast
  majority of kdump users are on distro kernels that don't drop NR_CPUS
  below the defaults"

* tag 'x86_kdump_for_7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  crash: Update stale NR_CPUS_DEFAULT references in elfcorehdr sizing docs
  x86/crash: Reserve elfcorehdr for CONFIG_NR_CPUS, not CONFIG_NR_CPUS_DEFAULT
2026-10-20 11:52:48 -10:00
Linus Torvalds
303bff3637 Core features:
- Remove big-endian kernel support: CONFIG_CPU_BIG_ENDIAN has depended
    on BROKEN for a while, so drop the remaining code (BE hypervisor
    object, BPF JIT, assembly/crypto/library routines, endianness helper
    macros, selftests) and force a little-endian build
 
  - Add preemptible this_cpu_*() operations (read/write, RMW, xchg,
    cmpxchg and cmpxchg128) that no longer need to disable preemption
    around the per-CPU address generation and access
 
  - Preparation patches for implementing CONFIG_HOTPLUG_PARALLEL on
    arm64
 
 Memory management:
 
  - Treat faults taken by EFI runtime firmware as kernel faults
 
  - Clear PTE_WRITE for EFI_MEMORY_RO mappings (with hardware dirty state
    management enabled, this is not truly read-only)
 
  - Raise the default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
    configurations (28/26/24 bits for 4K/16K/64K pages)
 
  - Implement clear_page[s]() using memset()
 
  - Enable BBML2 no-abort (a.k.a. BBML3) for the NVIDIA Rigel CPU
 
 Perf and PMU:
 
  - Support for HiSilicon's ITS PMU
 
  - Add support for some new events: INST_SIMD_ALU_VEC for Apple PMUs and
    a cycle counter for the latest version of HiSilicon's MN PMU hardware
 
  - A bunch of fixes to the CXL PMU driver to address pre-existing issues
    from Sashiko
 
  - Fix generation of PERF_RECORD_ITRACE_START records for SPE and ETM
    drivers
 
  - Reduce excessive stack consumption in the Marvell DDR PMU driver
 
  - Minor driver updates and cleanups all over
 
 Arm Confidential Compute Architecture (CCA):
 
  - Add an Arm SMCCC bus for firmware services discovered through SMCCC
    and move the TRNG and CCA guest (TSM provider) drivers onto it,
    removing the dummy CCA platform device and adding a sysfs ABI for
    Realm guests
 
  - Move the Realm Service Interface (RSI) code out of arch/arm64/ into
    drivers/firmware/arm_rmm/
 
  - Add the host side of the Realm Management Interface (RMI): detect,
    configure and activate the RMM, add SRO support and wrappers for the
    Realm RMI commands
 
  - Block hibernation (new arch hook in the PM core) and kexec while the
    RMM is active. To be revisited in the future with proper support for
    deactivation
 
  - Handle Granule Protection Faults (GPFs) taken by the host, caused by
    accesses to memory delegated to the RMM. In a future patch, the
    exception table lookup will be limited to is_kdump_kernel() cases
 
 MPAM (Memory Partitioning And Monitoring):
 
  - Add support for the MPAM firmware-backed (Fb) interface, allowing
    MSC accesses to be mediated by firmware
 
  - Fix a list of theoretical issues with the driver (MSC access error
    propagation, MBWU monitor save/restore and locking, resctrl class
    handling, error interrupt restore, maximum number of PARTIDs)
 
  - Add the mailing list and a missing file to the MAINTAINERS entry
 
  - Document when to set arm64.nompam
 
 Errata and CPU features:
 
  - Add the NXP i.MX8QM/8QP workaround for the Cortex-A53 cache coherency
    issue (ERR050104), using a new ARM64_CPUCAP_SOC_ERRATUM capability
    type for SoC-level errata
 
 Miscellaneous:
 
  - Mask debug exceptions (DAIF) around the hardware breakpoint register
    manipulations when called from generic kernel code
 
  - Don't zero the SVE state buffer when the SVE state is live
 
  - Return -EPERM instead of -EBUSY from the GCS prctl() locking
    failures (matching x86), with the selftest updated. Slight ABI change
    but no software deployment yet
 
  - kselftest: fix unsound MTE fault skipping by introducing MTE-safe
    memory accessors, avoid copying each signal test binary more than
    once
 
  - Update sysreg definitions (fix three enum values and two field names,
    mark architecturally dropped fields as RES0) and remove the TME
    transaction state check from the BRBE driver
 
  - Fix the description of ARM64_HAS_LPA2 and remove a redundant
    ID_AA64MMFR0 define
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAmrRImIACgkQa9axLQDI
 XvG+mw/+Lu/PONW1zxo4M65u3vR2bTBqhx8Xo3MP15ANaNVEb3guiUX0ZGAMVdz7
 NgN5NAQFQ5lwb8V8F5LSPGPlHTZ/KEYbiu2IRqwNvUrr2xU+Bz2AZKGvTfScEokO
 PiNfe84I7pWG+U77eBotZ5TxBQiLRe+8VWetIlPOQK9QUm0PG6Z50vhBBahg5kvJ
 b0nf2K3mSIscQRskykkCfIAwTShJM1NvW4+Ygfz6UjHaTtvPg+wsHPMZunKLJW5F
 tbXjZxcJQPziTl7lsRZuKbBrW7Sm5XRl54Q5Tl5ToXQ/C8h2jKjaNoqyXfV+ETJx
 MnFMQfmSIXuKlPuhZTiZK1viVXJe886iCi0vavMwKIR1zNJBKWLWeFz7cepe/jfq
 PHnZo9dX9dNRS7vzBGVq1aYUe/pn5eVeYrUQjMWCyKF2aLvSLm5n4Tf+XtvDUrkA
 O5EuP7sHL8xY9wCJ+Mw45gX1sQiJRy2jBOBbUvZ2/F6ACgG8dvKS9lhpbIn8IsKU
 rFkwacTcsUCoKCnthOwupRApUU/S2fiyzEoUc/R/gDubmnDET3nLcSsspg/FacqP
 OOq/6ErxAQ3HA5ltK0Siq8/qud9mnpYa0xyoxs7EED3jpX2A3lLf9UZduZ+r/2IP
 k5KI+4yRkYPBqGoFjwO8nMrk8jgvZzAtTMh86EOI4LZkcNEvuzU=
 =YdKt
 -----END PGP SIGNATURE-----

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 updates from Catalin Marinas:
 "Here are the arm64 updates for 7.4.

  The more interesting bits are the removal of big-endian kernel support
  (already marked BROKEN for some time), preemptible this_cpu_*()
  operations and MPAM support for the firmware-backed (Fb) interface.

  CCA (Arm's confidential compute) is slowly trickling in with host RMI
  (Realm Management Interface) support and some refactoring, including a
  dedicated SMCCC bus to advertise firmware services. There are also the
  usual PMU updates for new hardware and a few fixes/cleanups.

  Core features:

   - Remove big-endian kernel support: CONFIG_CPU_BIG_ENDIAN has
     depended on BROKEN for a while, so drop the remaining code (BE
     hypervisor object, BPF JIT, assembly/crypto/library routines,
     endianness helper macros, selftests) and force a little-endian
     build

   - Add preemptible this_cpu_*() operations (read/write, RMW, xchg,
     cmpxchg and cmpxchg128) that no longer need to disable preemption
     around the per-CPU address generation and access

   - Preparation patches for implementing CONFIG_HOTPLUG_PARALLEL on
     arm64

  Memory management:

   - Treat faults taken by EFI runtime firmware as kernel faults

   - Clear PTE_WRITE for EFI_MEMORY_RO mappings (with hardware dirty
     state management enabled, this is not truly read-only)

   - Raise the default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
     configurations (28/26/24 bits for 4K/16K/64K pages)

   - Implement clear_page[s]() using memset()

   - Enable BBML2 no-abort (a.k.a. BBML3) for the NVIDIA Rigel CPU

  Perf and PMU:

   - Support for HiSilicon's ITS PMU

   - Add support for some new events: INST_SIMD_ALU_VEC for Apple PMUs
     and a cycle counter for the latest version of HiSilicon's MN PMU
     hardware

   - A bunch of fixes to the CXL PMU driver to address pre-existing
     issues from Sashiko

   - Fix generation of PERF_RECORD_ITRACE_START records for SPE and ETM
     drivers

   - Reduce excessive stack consumption in the Marvell DDR PMU driver

   - Minor driver updates and cleanups all over

  Arm Confidential Compute Architecture (CCA):

   - Add an Arm SMCCC bus for firmware services discovered through SMCCC
     and move the TRNG and CCA guest (TSM provider) drivers onto it,
     removing the dummy CCA platform device and adding a sysfs ABI for
     Realm guests

   - Move the Realm Service Interface (RSI) code out of arch/arm64/ into
     drivers/firmware/arm_rmm/

   - Add the host side of the Realm Management Interface (RMI): detect,
     configure and activate the RMM, add SRO support and wrappers for
     the Realm RMI commands

   - Block hibernation (new arch hook in the PM core) and kexec while
     the RMM is active. To be revisited in the future with proper
     support for deactivation

   - Handle Granule Protection Faults (GPFs) taken by the host, caused
     by accesses to memory delegated to the RMM. In a future patch, the
     exception table lookup will be limited to is_kdump_kernel() cases

  MPAM (Memory Partitioning And Monitoring):

   - Add support for the MPAM firmware-backed (Fb) interface, allowing
     MSC accesses to be mediated by firmware

   - Fix a list of theoretical issues with the driver (MSC access error
     propagation, MBWU monitor save/restore and locking, resctrl class
     handling, error interrupt restore, maximum number of PARTIDs)

   - Add the mailing list and a missing file to the MAINTAINERS entry

   - Document when to set arm64.nompam

  Errata and CPU features:

   - Add the NXP i.MX8QM/8QP workaround for the Cortex-A53 cache
     coherency issue (ERR050104), using a new ARM64_CPUCAP_SOC_ERRATUM
     capability type for SoC-level errata

  Miscellaneous:

   - Mask debug exceptions (DAIF) around the hardware breakpoint
     register manipulations when called from generic kernel code

   - Don't zero the SVE state buffer when the SVE state is live

   - Return -EPERM instead of -EBUSY from the GCS prctl() locking
     failures (matching x86), with the selftest updated. Slight ABI
     change but no software deployment yet

   - kselftest: fix unsound MTE fault skipping by introducing MTE-safe
     memory accessors, avoid copying each signal test binary more than
     once

   - Update sysreg definitions (fix three enum values and two field
     names, mark architecturally dropped fields as RES0) and remove the
     TME transaction state check from the BRBE driver

   - Fix the description of ARM64_HAS_LPA2 and remove a redundant
     ID_AA64MMFR0 define"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (144 commits)
  arm64: cpufeature: Enable BBML2 for NVIDIA Rigel
  arm64: cputype: Add NVIDIA Rigel definitions
  arm64: raise default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
  arm64/debug: mask debug exceptions when called from common code
  kselftest/arm64: signal: copy each test binary only once
  kselftest/arm64: Check for -EPERM not -EBUSY in the locking test
  arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures
  perf: arm_brbe: Remove the check for TME transaction states
  arm64: sysreg: Mark fields the architecture dropped as RES0
  arm64: sysreg: Fix the names of two misspelt fields
  arm64: sysreg: Fix three incorrect enum values
  arm64: smp: Defer RCU registration during secondary CPU bringup
  arm64: smp: Don't bother printing the I-cache policy for each CPU
  arm64: smp: Defer update of secondary CPU capabilities
  arm64: smp: Tidy up cpuinfo init and cpufeature updates
  arm64: smp: Tidy up smp_prepare_cpus()
  arm64: cpufeature: Store every ID register with its overrides applied
  arm64: cpufeature: Read MPAMIDR_EL1 in __cpuinfo_store_cpu()
  arm64: cpufeature: Add read_cpuid_with_overrides()
  arm64: cpufeature: Check arm64_ftr_regs[] before the first store
  ...
2026-10-20 07:55:19 -10:00
Linus Torvalds
f47d223627 vfs-7.4-rc1.sync_close
Please consider pulling these changes from the signed vfs-7.4-rc1.sync_close tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlwAKCRCRxhvAZXjc
 orrgAQDrCihXTPRcJkiQfDH6LGeRdV+vD0xf2Sp39MMuDOrAggEA+eya4nPNqY8n
 K7DK7PJZ/DvyEHckxQQpgmGGqlE4bw0=
 =zb7I
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.4-rc1.sync_close' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull file closing updates from Christian Brauner:
 "This makes closing files synchronous for close_range(), exec and exit.

  Since fput() was switched to task work every final __fput() of an
  exiting task is queued on task work and run from exit_task_work().
  exec and close_range() do the same. For a task with a large descriptor
  table that is a cmpxchg() and a TIF_NOTIFY_RESUME test-and-set per
  file plus a list entry for any later task_work_cancel() to search
  under pi_lock, and then a second pass over every struct file that
  isn't cache hot anymore by then. Oleg and Neil have pointed this out
  over the years.

  close_files(), close_range() and close-on-exec now flush and put each
  file inline the way close(2) does. Kernel threads aren't affected.
  They share init_files which init_task pins forever so their
  exit_files() never drops the last reference, and their fput() keeps
  punting to a workqueue. The one place that could put a table from a
  kthread context, a failing copy_process(), can't hold the last
  reference while the source table is alive.

  On a 64 vCPU KVM guest tearing down 4096, 65536 and 1M descriptors
  scattered at random positions in the table:

                           4096 fds        65536 fds        1M fds
    exit                   1045 -> 895 us  18.9 -> 14.9 ms  429 -> 306 ms
    execve, close-on-exec  1393 -> 1190 us 21.4 -> 16.9 ms  471 -> 325 ms
    close_range()          1179 -> 988 us  21.9 -> 17.4 ms  484 -> 337 ms

  So that is 16-21% or 40-150 ns per closed file, largest at 1M
  descriptors. With eight processes tearing down 65536 descriptors each
  at once it stays at 16-21% because the second pass over 16 MB of
  struct file is what gets expensive when CPUs compete for the cache.

  With 32 or 64 processes both kernels are bound by pushing millions of
  files through slab and rcu and the difference shrinks to 4-8%. Files
  whose own release dominates gain less, 13% for eventfds, 11% for
  pipes, 6% for AF_UNIX sockets. close(2) is untouched and will-it-scale
  is within 2%.

  The spufs coredump support is removed. It was the only reason
  do_coredump() unshared the descriptor table. gdb dropped Cell
  debugging in 9.1 and binutils in 2.34, the Cell blades are gone and
  nothing on the PlayStation 3 produces or reads these notes. With that
  unshare_files() goes away, exec installs its private table through the
  new switch_files_struct() and the coredump startup completion becomes
  a plain thread count waited on with the new wait_var_event_state().

  Three fixes for the synchronous close are included. A failed fork
  released its files under scx_fork_rwsem and deadlocked against the bpf
  link's release. A session leader's exit released its tty before
  disassociate_ctty() ran and the foreground job lost its SIGHUP, so the
  tty is hung up before the files are closed now. And descriptor tables
  are walked from the highest descriptor down which restores the order
  the deferred puts had and keeps a few long-standing release ordering
  bugs from deadlocking exit"

* tag 'vfs-7.4-rc1.sync_close' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  fs: close files from the highest descriptor down
  coredump: factor out coredump_wait_inactive()
  exit: hang up the tty before closing the files
  fork: release the files of a failed fork after sched_cancel_fork()
  coredump: replace the startup completion with a thread count
  sched: add wait_var_event_state()
  coredump: drop core_state->dumper
  fs: make close_cloexec_files() synchronous
  fs: rename do_close_on_exec() to close_cloexec_files()
  fs: make close_range() synchronous
  fs: make close_files() synchronous
  fs: add filp_close_sync()
  fs: remove unshare_files()
  fs: move unshare_fd() to fs/file.c
  fs: add switch_files_struct()
  coredump: stop unsharing the file descriptor table
  fs: don't open-code file_close_fd() in close_fd()
  powerpc: remove coredump support
2026-10-19 21:03:21 -10:00
Linus Torvalds
00b04f4495 vfs-7.4-rc1.idmap
Please consider pulling these changes from the signed vfs-7.4-rc1.idmap tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlgAKCRCRxhvAZXjc
 opFuAPwLL5l3D3GSRyD+SyOjKYThylgowvH9c2BcLWbSAIO6yQD9F05GX+rrcbUq
 9ijolxAaQZYpEWsemZIIHx6BBwdDBA4=
 =IH8Z
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.4-rc1.idmap' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs idmap constification from Christian Brauner:
 "This makes struct mnt_idmap const throughout the tree.

  A mount's idmapping is immutable. The only thing modified after
  alloc_mnt_idmap() is the reference count and that is hidden behind
  mnt_idmap_get() and mnt_idmap_put(). Everything else only reads from
  it. That is the same model struct cred uses and the idmapping is
  sensitive enough to deserve it.

  The conversion goes bottom up through the vfs{g,u}id and fs{g,u}id
  helpers, the privilege checks, acl, xattr and quota and then every
  inode operation that takes an idmap, so ->permission(), ->getattr(),
  ->setattr(), ->create(), ->mkdir(), ->mknod(), ->symlink(),
  ->rename(), ->tmpfile(), ->get_acl(), ->set_acl() and ->fileattr_set()
  with their implementations in every filesystem, plus the LSM hooks.

  struct vfsmount, struct mount_kattr and struct kstatmount store a
  const pointer and nop_mnt_idmap and invalid_mnt_idmap live in rodata,
  so anything that tries to modify them faults instead of silently
  corrupting the initial idmapping"

* tag 'vfs-7.4-rc1.idmap' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (27 commits)
  fs: make nop_mnt_idmap and invalid_mnt_idmap const
  fs: port mnt_idmap() and file_mnt_idmap() to const mnt_idmap
  fs: port vfs_*() helpers to const mnt_idmap
  fs: port ->setattr() to pass const mnt_idmap
  fs: port ->getattr() to pass const mnt_idmap
  fs: port ->create() to pass const mnt_idmap
  fs: port ->symlink() to pass const mnt_idmap
  fs: port ->mkdir() to pass const mnt_idmap
  fs: port ->rename() to pass const mnt_idmap
  fs: port ->mknod() to pass const mnt_idmap
  fs: port ->tmpfile() to pass const mnt_idmap
  fs: port ->get_acl() to pass const mnt_idmap
  fs: port ->set_acl() to pass const mnt_idmap
  fs: port ->fileattr_set() to pass const mnt_idmap
  fs: port xattr to const mnt_idmap
  fs: port ->permission() to pass const mnt_idmap
  fs: port acl to const mnt_idmap
  fs: port inode_init_owner() to const mnt_idmap
  fs: port inode_owner_or_capable() to const mnt_idmap
  fs: port privilege checking helpers to const mnt_idmap
  ...
2026-10-19 17:57:49 -10:00
Linus Torvalds
a1d4585be1 vfs-7.4-rc1.file
Please consider pulling these changes from the signed vfs-7.4-rc1.file tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlgAKCRCRxhvAZXjc
 osd6AP4nuqrNhsMzcp4zPk4rbMVhvJL9O3ccnoE6TLn8Mg7uLwD/WtjKIVtKAPkv
 gz58C2i14vDLLbKAAGK0P8c1EF0ZuAE=
 =jY1x
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.4-rc1.file' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull file table updates from Christian Brauner:
 "This annotates struct fdtable's fd array with __counted_by_ptr so
  KASAN and the fortified functions can bounds check it against max_fds
  and adds a KUnit suite for fdtable. A follow-up uses __struct_size()
  in the test since sparse doesn't know __builtin_dynamic_object_size().

  FD_PREPARE() is simplified. It was built as an ACQUIRE-style guard on
  infrastructure that was never needed. The ACQUIRE machinery and
  CLASS_INIT() go away, the variable is declared with __cleanup()
  directly, struct fd_prepare loses its err field since the fd either
  holds the descriptor or the error, and callers get a const pointer to
  the guard behind a UNIQUE_ID() name so they can't shadow it. Code
  generation is identical"

* tag 'vfs-7.4-rc1.file' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  file: make struct fd_prepare const and kill its err field
  cleanup: remove CLASS_INIT()
  file: declare the FD_PREPARE() variable with __cleanup() directly
  file: simplify FD_PREPARE()
  vfs: use __struct_size() in the fdtable KUnit test
  vfs: Add KUnit tests for fdtable
  vfs: Annotate struct fdtable's fd field with __counted_by_ptr
2026-10-19 17:35:50 -10:00
Linus Torvalds
ada21d495c vfs-7.4-rc1.coredump
Please consider pulling these changes from the signed vfs-7.4-rc1.coredump tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlgAKCRCRxhvAZXjc
 ouhIAP9q03aGe3fMs3tnLWC+JzSc1D48MMmo71rPxGnV6G6V+AEAzZV6Xkq8eFTU
 Zbwq6FhYvhptWeNGyNa9phUDFcBQIw4=
 =Pt3z
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.4-rc1.coredump' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull coredump updates from Christian Brauner:
 "This adds sparse coredumps and per-request memory type selection to
  the coredump socket protocol.

  A coredump sent over the socket transfers every zero of every hole in
  every mapping. For a process with 128 threads that's 1 GB of mostly
  thread stacks, 8 MB reservations with a few pages touched, and the
  holes sit in the middle of the dump rather than at the end. The
  coredump_filter bit that was proposed for this stops each PT_LOAD at
  the last populated page. But that mask says which kinds of memory to
  include and propagates across fork and exec, whereas what is selected
  here is an encoding. The usermodehelper isn't salvagable for this
  either. The coredump socket already has a handshake for exactly this.

  A server that raises COREDUMP_RECORDS in coredump_ack->mask gets the
  coredump as a sequence of records, each a struct
  coredump_record_header followed by what it describes. The stream ends
  explicitly with an end record that reports the size, so a missing one
  means truncation.

  With COREDUMP_SPARSE holes cross the socket as a bare header that says
  how many zero bytes were skipped. Reassembling the records gives back
  the same coredump, so a debugger and everything else still see an
  ordinary core file. Numbers from the selftests: the 128 thread process
  sends 1424153 bytes for a coredump of 1075150848 bytes, a 256 MB
  mapping with the first and the last page touched sends 188793 bytes
  for 268890112 bytes, and with COREDUMP_RECORDS alone the record
  overhead is under one percent.

  The selftests also simulate a server uploading to a blob store that
  can't seek and rewrites the program headers so the object is an
  ordinary ELF core file without the holes.

  COREDUMP_MEMORY_TYPES lets the server choose what memory to dump per
  request instead of relying on the static /proc/<pid>/coredump_filter
  of the crashing task. The request carries the default types and a mask
  of every type the kernel knows about, the ack carries the selection.
  Zero is valid and dumps the program headers and notes and nothing but
  the mappings that are always dumped.

  Preparatory cleanups refuse negative skips in dump_skip_to(), chunk
  every write at a page so a pipe or a socket never takes a short write
  in the middle of a record, make the dump helpers return bool and
  replace the core_dumped integer with COREDUMP_STATE_STARTED and
  COREDUMP_STATE_TRUNCATED flags.

  Also included is a fix for coredump_parse() reading core_pattern while
  it is being modified. The sysctl handler now validates a copy and
  publishes it under a spinlock and the parser works on a snapshot, so a
  rejected pattern is never visible and the rollback logic goes away.
  And to_kthread()'s lockless flags read is annotated with READ_ONCE()"

* tag 'vfs-7.4-rc1.coredump' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (29 commits)
  kthread: Annotate lockless to_kthread() flags access
  coredump: parse a snapshot of core_pattern
  selftests/coredump: test failed handshakes
  selftests/coredump: improve coredump size negotiation tests
  selftests/coredump: test COREDUMP_MEMORY_TYPES
  selftests/coredump: simplify the refusal tests
  tools: sync coredump.h header
  coredump: select memory types to include
  selftests/coredump: show how to inspect the task to decide how the coredump should be sent
  selftests/coredump: simulate a blob store
  selftests/coredump: put a hole in the middle of a sparse mapping
  selftests/coredump: hand the record stream to a sink
  selftests/coredump: test COREDUMP_RECORDS and COREDUMP_SPARSE
  coredump: describe the holes when COREDUMP_SPARSE is negotiated
  coredump: send the coredump in records if requested
  tools: sync coredump.h header
  coredump: add COREDUMP_SPARSE to the coredump socket protocol
  coredump: add COREDUMP_RECORDS to the coredump socket protocol
  coredump: clean up coredump state handling
  coredump: always chunk writes
  ...
2026-10-19 17:21:24 -10:00
Linus Torvalds
018cf9bf78 kernel-7.4-rc1.signal
Please consider pulling these changes from the signed kernel-7.4-rc1.signal tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlQAKCRCRxhvAZXjc
 ol44AP9GXKnV7oRC5J2uldXgoE7GQRjf790BwJSFf2qHGPJeUwD6AzK4IH2KIEmW
 XB8DEzDKabDKCt0bsTgM7NPqMXPOyA8=
 =o2lX
 -----END PGP SIGNATURE-----

Merge tag 'kernel-7.4-rc1.signal' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull signal handling updates from Christian Brauner:
 "This stops TIF_NOTIFY_SIGNAL from interrupting work that can't be
  restarted and fixes a bunch of coredump and signal bugs.

  TIF_NOTIFY_SIGNAL kicks a task out of an uninterruptible sleep so it
  returns to userspace, runs its task work and goes back to sleep. That
  breaks coredumps: dump_interrupted() only lets fatal signals interrupt
  a dump and writes to a regular file ignore TIF_NOTIFY_SIGNAL. But the
  pipe and the socket paths check signal_pending() Adeep down in code
  that is shared with regular syscalls and bail. So a crashing process
  with io_uring requests in flight loses most of its coredump.

  In the selftest an unfixed kernel delivers 357324 of at least 5111808
  bytes. And io_uring isn't the only source. klp_send_signals(),
  bpf_task_work_schedule_signal(), landlock's tsync, kthread_stop() and
  the printk kunit test raise the bit as well, some of them from irq
  context against any task. So this can't be fixed per subsystem and the
  state has to be per-task and ambient.

  Add PF_NO_NOTIFY_SIGNAL and no_notify_signal_save()/restore() helpers
  modelled on memalloc_nofs_save(). Inside such a section
  signal_pending() ignores TIF_NOTIFY_SIGNAL. Coredumps, the smb send
  path, which hand-rolled its own version of this, and the pid namespace
  reaper, which busy-looped when the bit kept getting raised, are
  converted.

  The second part is a set of fixes that fell out of looking at the
  coredump code with kres and modelling it in TLA+:

  - coredump_finish() woke the parked threads without holding rcu. A
    parked thread can exit on a spurious wakeup and be freed before
    wake_up_process() takes its pi_lock.

  - Only SIGKILL and the freezers interrupt a dump now and the three
    freezers agree. Power management and cgroup v1 freezing aborted a
    dump while a cgroup v2 freeze either waited for the dump or cut it
    short depending on where the core went.

  - io-wq set its exit bit without a barrier against the task work that
    creates workers. On weakly ordered architectures exit could hang on
    worker_done.

  - retarget_shared_pending() slingshotted a shared signal to the dumper
    when a zapped sibling restored its signal mask. That set
    TIF_SIGPENDING on the dumper and truncated the core.

  - A tracer could clear the signal mask of a user worker with
    PTRACE_SETSIGMASK and inject a coredump signal. An io-wq worker of
    an SQPOLL ring dumping core deadlocks the whole group.
    PTRACE_SETSIGMASK is refused for user workers now and
    __set_task_blocked() enforces the fork-time mask.

  - exec cancels io_uring requests before de_thread() so a worker
    creation queued as task work can't add a thread to a thread group
    that de_thread() just took down.

  - No io threads are created from a PF_SIGNALED or PF_POSTCOREDUMP
    creator anymore. Such a worker was invisible to zap_process() but
    still decremented threads_remaining on exit so the dumper could
    leave coredump_wait_inactive() early.

  Also included are a comment that do_each_pid_task() needs
  tasklist_lock, a READ_ONCE() in pid_alive() and a regression test for
  fork() into a pid namespace whose ancestor lost its init"

* tag 'kernel-7.4-rc1.signal' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (21 commits)
  pid: use READ_ONCE() in pid_alive()
  selftests: pid_namespace: test fork with dead ancestor
  pid: document that do_each_pid_task() needs tasklist_lock
  signal: enforce the user worker signal mask in __set_task_blocked()
  fork: use SIG_KERNEL_ONLY_MASK for the user worker signal mask
  fork: don't create io threads once PF_POSTCOREDUMP is set
  fork: move the coredump and exec checks into create_io_thread()
  exec: cancel io_uring requests before de_thread()
  selftests/coredump: expect PTRACE_SETSIGMASK to be refused on a user worker
  selftests/coredump: test a user worker as the coredumping thread
  ptrace: refuse to change the signal mask of a user worker
  selftests/coredump: test shared signal retargeting during a dump
  signal: only SIGKILL and the freezers interrupt a coredumping task
  signal: don't retarget shared signals in a dying thread group
  io-wq: order the exit bit against worker creation task work
  coredump: hold RCU while releasing parked threads
  pid_namespace: prevent TIF_NOTIFY_SIGNAL from interrupting the reaper
  smb: prevent TIF_NOTIFY_SIGNAL from interrupting
  selftests/coredump: test that TIF_NOTIFY_SIGNAL doesn't truncate a coredump
  coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps
  ...
2026-10-19 16:22:15 -10:00
Linus Torvalds
e86d265826 namespace-7.4-rc1.misc
Please consider pulling these changes from the signed namespace-7.4-rc1.misc tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlQAKCRCRxhvAZXjc
 okOqAP98o3UxyJOsSJfNJpr0OnHzk/WHbt8Qm7Lmk0Xgt2h6BgD/Ypf5v68wiCaS
 eg6X3g3wR4tLMbdTkEy5tekLG80Alg4=
 =36S+
 -----END PGP SIGNATURE-----

Merge tag 'namespace-7.4-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull namespace updates from Christian Brauner:

 - Reject uid_map, gid_map and projid_map values that don't fit in a
   u32.

   map_write() parsed with simple_strtoul() and truncated modulo 2^32 on
   64-bit so "4294967301 1000 1" was installed as "5 1000 1" without an
   error. Each field is parsed with kstrtou32() now and selftests cover
   the out-of-range, negative and in-range cases. This isn't a security
   fix. The truncated values were valid ids and every later check still
   applied to them.

 - Annotate struct uid_gid_map's forward and reverse pointers with
   __counted_by_ptr and add a KUnit suite for inserting and sorting
   extents.

   insert_extent() wrote to forward[nr_extents] before bumping the count
   which the annotation flags, so it bumps first now. Two follow-up
   fixes rename the now global helpers to uid_gid_map_insert_extent()
   and uid_gid_map_sort(), since the btrfs self-tests have their own
   insert_extent(), and guard the declarations on CONFIG_KUNIT.

 - Drop the BUG_ON() NULL checks in copy_mnt_ns() and copy_utsname().
   create_new_namespaces() always passes a valid pointer and the other
   copy_*_ns() helpers don't check either.

 - Remove a dead key_put() on the create_user_ns() error path.

* tag 'namespace-7.4-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  selftests/namespaces: add uid_map/gid_map range tests
  userns: reject uid_map/gid_map values that do not fit in u32
  userns: declare the KUnit-visible helpers whenever KUnit is enabled
  userns: rename insert_extent() and sort_idmaps()
  userns: Add KUnit test suite for uid_gid_map
  userns: Add __counted_by_ptr attribute to struct uid_gid_map
  fs: namespace: drop BUG_ON() in copy_mnt_ns()
  uts: drop BUG_ON() in copy_utsname()
  userns: remove dead key_put() on the create_user_ns() error path
2026-10-19 16:09:10 -10:00
Linus Torvalds
88328f850d Scheduler fixes:
- Fix __sched_setscheduler() class change race causing
    lost reschedules, exposed by recent RCU changes (K Prateek Nayak)
 
  - Fix s64 multiplication overflow in place_entity()'s vlag
    scaling code that can corrupt an entity's placement (Hui Su)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmrUkEcRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1j67g/+NaApCtC988ZaWipMkUyRsdYBQAxP+Nhy
 TkodntDpFgL4rqLe5guo8d3NXMLJwnvhygcAC7pVy0dfVzWai+ExAUiABggjtrjF
 mADPsPmhnzM/gNsgz//2hjJIpam5mivF9aIr20X04UtD9Dtn950RzKYqDibA6nv5
 wH7xeB8+vfBElH++le/8NmRCH+6IjVMvpzpDqphbtzssdUutDHkQQRC2epXzIm1/
 wjA0qoqoLWqyw1KgIcvP+ixvH1LT57b8K8NzJxnS4lsx62NzHiN+ZahkSmM9JNIY
 WEjqOC1C3NyjwyKcroTuaWLuvjxa0R6Rp5mWabEGHXbhQjDJmWiPgacsmYS1ywFz
 e5bzwpklcYqq/3x0JaYIhEt41zZ9HkN4X0TZzTsjDOotdxq8v3A81At39YycRRUZ
 l6cFvxbQZbCXBAHdIKVzQAAy3t19zK8xsj1mgyffseFGXXMrJucw+IHBL3ExxmSA
 WVZW9GRxStFvqzEBu0TxNFjH+VBBi4WGWotmQq4gRH1+gSQIbttwXYXZkt+B8nAT
 u9M/CKFeFqGzqF6wZWMjPo8l1sOo9lzdCwFjU78Tjz2tGsL1tuA1Uia8rCxE7Hnw
 josNULOdpiRhjrz9G0ycOyMtxu6GJ/sgoFeQiuKQ6MWsDI1xfdg/kM0EkWMkfXK2
 Lhc0okwHz5o=
 =bK3k
 -----END PGP SIGNATURE-----

Merge tag 'sched-urgent-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:

 - Fix __sched_setscheduler() class change race causing
   lost reschedules, exposed by recent RCU changes (K Prateek Nayak)

 - Fix s64 multiplication overflow in place_entity()'s vlag
   scaling code that can corrupt an entity's placement (Hui Su)

* tag 'sched-urgent-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/fair: Avoid overflow in place_entity()
  sched/core: Call wakeup_preempt() for queued tasks during class change
2026-10-18 07:35:30 -10:00
Linus Torvalds
8573787061 Perf events fixes:
- Fix x86 Intel uncore driver bug on Diamond Rapids CPUs
    that erroneously always-cleared the invert bit (Guixiong Wei)
 
  - Fix accounting bug in the perf mlock 'gift' code causing
    unrelated RLIMIT_MEMLOCK functionality to fail (Lorenzo Stoakes)
 
  - Fix perf_pmu_migrate_context() bug leaving events behind during
    CPU hot-unplug (Haris Okanovic)
 
  - Update cgroup time when rotating multiplexed events, to fix
    time_running & scaled counts accounting bug (Antoine Huret)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmrUjygRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1jyHg/9EZ9g8CN+qf0pOiLM3yOZbyoe88VMZ2ZH
 QBYGc1JgBVrrjT6JQYjuNQLakv9BJmbgQ1S/xtpaD93CtzJDzK/Jsg4SwuTINlE7
 wB+P8lpoTMhE1tfP7rwOaGdZD9qmkJIwALaDmTFayk5z87MzEbSmlLzRRC2TlB8g
 R3hF4KOtYtBwQKCrPIXiHi/LbHmx0c0zP4J9M/MbRvNLM8iZ47mF5PL++mpLyuTS
 z+YhUu21cp5SAotOZNsgD1VrVOcPy0vpIdJVYSSC9+OWfvuENoqkcciyoSXWNkT0
 O7RbMtBwfS7k2+wA2JgQ8ETcGVB0+G45NWXwHBmLHuU5XK5/Whbzn5cUKhvIdS0J
 xnr1MCWm/R+cC6i/wgfH1ysd8VACI/51Lng88ckXaVmkUajj6RZPo+VB2FRG4pvq
 FMC/Ap/fSjk2SdAjKHRMp87g19aOsoz+aWb6nGZPApMj0EGcxpPAZAcMSi+HUNyI
 N5MmAOiD5imMPWB6UX3OCeDgjwUD2Hnbn3NkZeK2Glm7dUUr1MZTEgQ1QlnBv+Ou
 vYMkVVEVEq9NJVA2ShnBF5+wRwUpLzI0+9w8L7ZUQPkiYL9tXAB988qYaQ5k08SZ
 iUo9EVj48QFqR4ILNY4iAyp9AuT7LuKMF0cnO+O8rEGR8gxHBOBYLxVzR/xB12lq
 48D1b2q3EiQ=
 =AxtL
 -----END PGP SIGNATURE-----

Merge tag 'perf-urgent-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf events fixes from Ingo Molnar:

 - Fix x86 Intel uncore driver bug on Diamond Rapids CPUs
   that erroneously always-cleared the invert bit (Guixiong Wei)

 - Fix accounting bug in the perf mlock 'gift' code causing
   unrelated RLIMIT_MEMLOCK functionality to fail (Lorenzo Stoakes)

 - Fix perf_pmu_migrate_context() bug leaving events behind during
   CPU hot-unplug (Haris Okanovic)

 - Update cgroup time when rotating multiplexed events, to fix
   time_running & scaled counts accounting bug (Antoine Huret)

* tag 'perf-urgent-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf: Update cgroup time when rotating multiplexed events
  perf: Fix perf_pmu_migrate_context() leaving events behind
  perf: Track the perf mlock gift separately
  perf/x86/intel/uncore: Fix DMR CXL CM invert filter
2026-10-18 07:20:03 -10:00
Linus Torvalds
cf20e7f96a Locking fixes:
- Fix FUT_OFF_MMSHARED futex hashing bug that can cause
    missed wakeups or spurious wakeups on futex-waiting
    tasks (Jann Horn)
 
  - Fix lockdep context tracking bug in the deferred hrtimer
    rearming entry code, which causes a lockdep chain leak
    that will eventually turn lockdep off (Mikhail Gavrilov)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmrUjUgRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1gmPg//W4D6TwoPAhod8ExaSApVeP9vrqUnMkEg
 hf5GsvwT+0wW8cD8xaBnUVA2ylcLDurmu+eXedurOdc3VcRh/BSvJlBpPXMLA5pc
 L+iiGI8sMK6koNQrDXtFcHJbcdm5CSmNVc7sv0Vodi+7Q4EjZWL1SLI34F/5EbMd
 mvgJ1NDVVr/2L1gc1ojsPo6CUWnFTaq8sp48kYDrmpllo8epECQptJ248wfP2Grv
 1v43UYjprCjCY/KOvWz6O5wsXL+25vGk5JX2mY9BemmWJEoq7QOlBceJGpZiFmCf
 hO2b1a9aI7pKC7lBRBdeQF/GZHF5AF1E7NPmwR7nSSSGfG6z1rVeoq6e4/lewgui
 irvPDY2EDz4F5eQxDxZXTXzS7oKddEha4pB2L50/q9leFXdR1JG5Xh5D5p2lK5K0
 pUvo0ODt4TEVriX00sH8Q+2SBOyXhAGXfM2lwS0J5LMY9J+yexqn9MldM8ulg6Dm
 BoHYw5FXMuJrcUeNA4RM410bN4YGwKRNSzV8JlngQsfMX3EH0m8aorDYJ8TlLd91
 Tv3CfK0pIgNe0r2Tvx5xlNHjbypWk6a7GZBrWbQIeRvS1y60xFyus2kqd6OuF4W/
 iELs6ZM732881GXtRIQFQz9GbijA5FfSSpL3iPyKO71e/OsOLZGezQi7LXqZ1ZgF
 dk7g5R52Vb4=
 =V72L
 -----END PGP SIGNATURE-----

Merge tag 'locking-urgent-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fixes from Ingo Molnar:

 - Fix FUT_OFF_MMSHARED futex hashing bug that can cause
   missed wakeups or spurious wakeups on futex-waiting
   tasks (Jann Horn)

 - Fix lockdep context tracking bug in the deferred hrtimer
   rearming entry code, which causes a lockdep chain leak
   that will eventually turn lockdep off (Mikhail Gavrilov)

* tag 'locking-urgent-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  entry: Account the deferred hrtimer rearm as hardirq context for lockdep
  futex: Fix mm reuse handling for FUT_OFF_MMSHARED
2026-10-18 07:03:51 -10:00
Linus Torvalds
9d586910e3 printk hotfixes for 7.3
-----BEGIN PGP SIGNATURE-----
 
 iQJPBAABCAA5FiEESH4wyp42V4tXvYsjUqAMR0iAlPIFAmrSRhIbFIAAAAAABAAO
 bWFudTIsMi41KzEuMTIsMiwyAAoJEFKgDEdIgJTyms0P/jeEH1xJq001K8uAfPeH
 +wXdGRlKNuN+0ZRxR+RqjF0KRhgdjG0CBGUZu4ZdhKwaPlTy0ooeZSxohpOeBc/E
 tEzblYRX7bueoOxHd/5Do2O22qPNxgWvAF1hGChHL/CasPpYjQYE2y5JH9yKsTum
 R7MpkEbWcn4MR5Dcnd4Kc267bJ1+5xSSppXgfaBPUFhdSR0LsNJ4bB4q59KUDBRy
 Kx4HS+bBVW7GP6+VwrZ0GdtPr/ztk5BRqVeZt1oETvxQKN7/BV7KWXDRIYjzjqcF
 f4EeUKgUCWFxa0VG7J+EzghfUu7qJjld5qQKeSMra49xpERgN2KgA3CudZKAvyDe
 +YHp76U51XD37PXRnNBCy+B0N1o4zzmw06p0sRD2Ka/XVHoWSptRDPV/YLYaihrW
 lhZkPcNai7U/vJKF8pExbAsfYIY38ai3ZecLCQr9NRdtuZceOl7JpdadW5mDPI0Y
 1JJSuC4lt/fUDkcCquruZANLoe8CtE9ueCMGkUQv7yxa77tySoRjZ7GgsZczyyFd
 orrUhtiSPddepjRFRBf5Sz9msUiKXMFKCvj8v2gtH7ID1NooLh1auHM5bqKrgnag
 Ohp0HV+oXQ+vo5Gg0rksIxla5JnTbApICp41ksDiKVWeLXchMyL8NGzeo1eZ6wyv
 2hbh85lj2TkmSkJOfd6vkYxl
 =nY7x
 -----END PGP SIGNATURE-----

Merge tag 'printk-for-7.3-hotfix' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux

Pull printk fixes from Petr Mladek:

 - Switch NBCON consoles to the emergency mode in emergency_restart() to
   see messages even in this shutdown code path

 - Postpone the start of printk kthreads after smp_init(). It prevents
   boot stalls on some HW

 - Typo fix in a previous hot-fix patch

* tag 'printk-for-7.3-hotfix' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
  printk: Postpone kthread startup
  printk: fix kernel-doc name for nbcon_write_context_is_braille
  nbcon/reboot: Switch NBCON consoles into the emergency mode in emergency_restart()
2026-10-16 14:37:20 -10:00
Linus Torvalds
e2c278bc37 tracing fixes for v7.3:
- Fix NULL dereference when copying histogram field variable
 
   If event_hist_trigger_parse() creates an action that uses one of pseudo
   fields for its keys, the hist_data field element will have a NULL for its
   field member. When looking to match that key, the lookup uses
   key_field->field->name which will dereference a NULL pointer.
   Instead use the helper function that handles such cases: expr_field_str().
 
 - Take the trace_types_lock when dropping the buffer_meta reference
 
   The tracing_buffer_meta_open() error return drops the trace_array
   reference with __trace_array_put() instead of trace_array_put() where the
   former doesn't take the lock and the latter does.
 
 - Fix NULL pointer dereference when reading per_cpu/cpuN/buffer_meta
 
   These files are created for every possible CPU. But it only contains data
   for CPUs that have come online. If one is read for a CPU that hasn't come
   online yet, it triggers a NULL pointer dereference.
 
   Have reading of CPUs that have not come on line yet return -ENODEV.
 
 - Fix an out-of-bounds shift in the log2 histogram modifier
 
   Histograms can take a log2 modifier to have the buckets defined by log2
   increments. If a shift is greater than ULONG_MAX or above 2^63, the key
   falls into a lower order bucket.
 
   Use order_base_2() instead of "ilog2(n - 1) + 1" to have all overflowed
   keys go into the top bucket.
 
 - Fix the persistent ring buffer rb_meta_subbuf_idx() accounting
 
   The algorithm for finding the index of a sub-buffer in a persistent ring
   buffer buffer did not take into account the meta data at the beginning of
   the buffer causing the wrong index to be returned.
 
   As rb_subbufs_from_meta() does the proper accounting to find the first
   sub-buffer, use that function instead of repeating the logic (incorrectly)
   and make the calculations based off of that.
 
 - Fix the symbol name checks for the remote buffer code
 
   The remote ring buffer has a build time check to make sure its not using
   any code that will not be in the hypervisor. For various architectures,
   there has been false positive reports from this checker.
 
   Fix them.
 
 - Fix false warning in ring_buffer_map_get_reader()
 
   There is a WARN_ON() after rb_get_reader_page() if no reader is returned.
   But there are legitimate cases where this can happen. Remove the WARN_ON()
   and also a check that covers one of the legitimate cases that tries to
   exit out early. There's no need for the check if it just simply allows the
   return of NULL from rb_get_reader_page().
 
 - Fix the ignored return value from resize_buffer_duplicate_size()
 
   Some clean up of the code in tracing_snapshot_write() removed checking the
   return value of resize_buffer_duplicate_size() and if that failed it would
   not be detected.
 
 - Fix the histogram timestamps for buffered events
 
   The histogram timestamps are taken from the events that are recorded.
   It currently reads ring_buffer_event_time_stamp() but if the event is
   buffered it does not read it properly. Use tracing_event_time_stamp()
   which handles both buffered and normal events.
 
 - Do not initialize tracefs if tracing is disabled at boot
 
   If tracing fails to allocate or some other error is detected,
   tracing_disabled is set. Do not initialize tracefs in this case as it may
   expect data to be initialized but is not.
 
 - Free eventfs inode after an RCU grace period
 
   Currently eventfs_inodes are freed after a SRCU grace period as the
   iterations in the code use SRCU. There are locations that the inode may
   still be accessed from the VFS that uses RCU which does not have the same
   synchronization as SRCU. Add an RCU wait before free eventfs inodes.
 
 - Do not fail persistent and remote buffers under memory pressure
 
   As persistent and remote buffers have their own pre-allocated memory,
   there's no reason to check how much memory is available before created
   them. By checking the memory pressure, these buffers may fail to be
   created even though their memory is already present.
 
 - Account for subbuffer size when checking how much memory is available
 
   Before allocating a ring buffer, the size is checked against the current
   memory pressure of the system. But it assumes every sub-buffer is of page
   size. This is no longer the case. Use the actual sub-buffer size when
   calculating how much memory will be used.
 
 - Reject non-stack fields for synthetic stacktrace fields
 
   Stack traces are special fields and the checks currently do not do enough
   to make sure that the fields being processed as stack traces are indeed
   stack traces. Update the logic to properly detect what is or is not a
   stack trace.
 
 - Fix a crash in print_graph_function_event()
 
   When a tracer does not define static or default flags the
   tr->current_trace_flags is set to NULL. If the ring buffer is
   not cleared when switching tracers, the previous tracers events
   could be read. The function_graph entries will dereference the
   tr->current_trace_flags and cause a crash.
 
   Set the tr->current_trace_flags to a empty set of flags to prevent
   it from being NULL.
 
 - Separate tracing filter predicate count from allocation
 
   The amount allocated for the predicate program is the number of predicates
   defined plus two for adding "true" and "false" at the end. The nr_preds is
   incremented by two to accommodate the booleans but is then used as the
   limit check for number of predicates. This is incorrect as it is now two
   higher than what is expected.
 
   Use a separate variable for the size of the predicate array.
 
 - Fix the filter operator stack check
 
   The operator stack increments the pointer and then writes the content onto
   the stack. The check for overflow compared the current pointer to see if
   it was greater than the stack size before doing so. This is an off by 2
   error as the write will be at the size - 1 and the compare is done before
   the increment. Adjust the check accordingly.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCatItoRQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qmfsAP9XviDyrl49/PBpuanB2qQzlMGqYQlb
 CwISmzgWoO1jKQEArNiSpKsIdPLfSJSLfIHAGxAZfmT42SugA4M5jqhW3Qc=
 =7KiP
 -----END PGP SIGNATURE-----

Merge tag 'trace-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

 - Fix NULL dereference when copying histogram field variable

   If event_hist_trigger_parse() creates an action that uses one of
   pseudo fields for its keys, the hist_data field element will have a
   NULL for its field member. When looking to match that key, the lookup
   uses key_field->field->name which will dereference a NULL pointer.
   Instead use the helper function that handles such cases:
   expr_field_str().

 - Take the trace_types_lock when dropping the buffer_meta reference

   The tracing_buffer_meta_open() error return drops the trace_array
   reference with __trace_array_put() instead of trace_array_put() where
   the former doesn't take the lock and the latter does.

 - Fix NULL pointer dereference when reading per_cpu/cpuN/buffer_meta

   These files are created for every possible CPU. But it only contains
   data for CPUs that have come online. If one is read for a CPU that
   hasn't come online yet, it triggers a NULL pointer dereference.

   Have reading of CPUs that have not come on line yet return -ENODEV.

 - Fix an out-of-bounds shift in the log2 histogram modifier

   Histograms can take a log2 modifier to have the buckets defined by
   log2 increments. If a shift is greater than ULONG_MAX or above 2^63,
   the key falls into a lower order bucket.

   Use order_base_2() instead of "ilog2(n - 1) + 1" to have all
   overflowed keys go into the top bucket.

 - Fix the persistent ring buffer rb_meta_subbuf_idx() accounting

   The algorithm for finding the index of a sub-buffer in a persistent
   ring buffer buffer did not take into account the meta data at the
   beginning of the buffer causing the wrong index to be returned.

   As rb_subbufs_from_meta() does the proper accounting to find the
   first sub-buffer, use that function instead of repeating the logic
   (incorrectly) and make the calculations based off of that.

 - Fix the symbol name checks for the remote buffer code

   The remote ring buffer has a build time check to make sure its not
   using any code that will not be in the hypervisor. For various
   architectures, there has been false positive reports from this
   checker.

   Fix them.

 - Fix false warning in ring_buffer_map_get_reader()

   There is a WARN_ON() after rb_get_reader_page() if no reader is
   returned. But there are legitimate cases where this can happen.
   Remove the WARN_ON() and also a check that covers one of the
   legitimate cases that tries to exit out early. There's no need for
   the check if it just simply allows the return of NULL from
   rb_get_reader_page().

 - Fix the ignored return value from resize_buffer_duplicate_size()

   Some clean up of the code in tracing_snapshot_write() removed
   checking the return value of resize_buffer_duplicate_size() and if
   that failed it would not be detected.

 - Fix the histogram timestamps for buffered events

   The histogram timestamps are taken from the events that are recorded.
   It currently reads ring_buffer_event_time_stamp() but if the event is
   buffered it does not read it properly. Use tracing_event_time_stamp()
   which handles both buffered and normal events.

 - Do not initialize tracefs if tracing is disabled at boot

   If tracing fails to allocate or some other error is detected,
   tracing_disabled is set. Do not initialize tracefs in this case as it
   may expect data to be initialized but is not.

 - Free eventfs inode after an RCU grace period

   Currently eventfs_inodes are freed after a SRCU grace period as the
   iterations in the code use SRCU. There are locations that the inode
   may still be accessed from the VFS that uses RCU which does not have
   the same synchronization as SRCU. Add an RCU wait before free eventfs
   inodes.

 - Do not fail persistent and remote buffers under memory pressure

   As persistent and remote buffers have their own pre-allocated memory,
   there's no reason to check how much memory is available before
   created them. By checking the memory pressure, these buffers may fail
   to be created even though their memory is already present.

 - Account for subbuffer size when checking how much memory is available

   Before allocating a ring buffer, the size is checked against the
   current memory pressure of the system. But it assumes every
   sub-buffer is of page size. This is no longer the case. Use the
   actual sub-buffer size when calculating how much memory will be used.

 - Reject non-stack fields for synthetic stacktrace fields

   Stack traces are special fields and the checks currently do not do
   enough to make sure that the fields being processed as stack traces
   are indeed stack traces. Update the logic to properly detect what is
   or is not a stack trace.

 - Fix a crash in print_graph_function_event()

   When a tracer does not define static or default flags the
   tr->current_trace_flags is set to NULL. If the ring buffer is not
   cleared when switching tracers, the previous tracers events could be
   read. The function_graph entries will dereference the
   tr->current_trace_flags and cause a crash.

   Set the tr->current_trace_flags to a empty set of flags to prevent it
   from being NULL.

 - Separate tracing filter predicate count from allocation

   The amount allocated for the predicate program is the number of
   predicates defined plus two for adding "true" and "false" at the end.
   The nr_preds is incremented by two to accommodate the booleans but is
   then used as the limit check for number of predicates. This is
   incorrect as it is now two higher than what is expected.

   Use a separate variable for the size of the predicate array.

 - Fix the filter operator stack check

   The operator stack increments the pointer and then writes the content
   onto the stack. The check for overflow compared the current pointer
   to see if it was greater than the stack size before doing so. This is
   an off by 2 error as the write will be at the size - 1 and the
   compare is done before the increment. Adjust the check accordingly.

* tag 'trace-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing: Check operator stack capacity before pushing
  tracing: Keep the predicate limit separate from program capacity
  tracing: Fix crash in print_graph_function_event()
  tracing/histograms: Reject non-stacktrace fields for synthetic stacktrace fields
  ring-buffer: Use subbuf_order in available memory estimation
  ring-buffer: Skip si_mem_available() for persistent and remote buffers
  eventfs: Free the eventfs_inode after an rcu grace period too
  tracing: Do not initialize tracefs work if tracing is disabled
  tracing: Fix hist trigger timestamps for buffered events
  tracing: Fix ignored return value of resize_buffer_duplicate_size()
  ring-buffer: Fix false warning in ring_buffer_map_get_reader()
  tracing: Fix simple_ring_buffer undef check on sparc64
  tracing: Fix simple_ring_buffer undef check on parisc
  tracing: Fix empty symbol names in simple_ring_buffer undef check
  ring-buffer: Fix the sub-buffer array base in rb_meta_subbuf_idx()
  tracing: Fix the shift out of bounds in the log2 histogram modifier
  ring-buffer: Do not show buffer_meta for CPUs without a buffer
  tracing: Take trace_types_lock when dropping the buffer_meta reference
  tracing: Fix NULL dereference when copying keys for a field variable
2026-10-16 14:27:22 -10:00
Linus Torvalds
2d2fe9fd50 Probes fixes for v7.3-rc7:
- tracing: probes: error if BTF is required but unavailable
   Fix to return an error instead of NULL if BTF is not available when
   user specify '$args*' meta fetch argument for probe events.
 -----BEGIN PGP SIGNATURE-----
 
 iQFPBAABCgA5FiEEh7BulGwFlgAOi5DV2/sHvwUrPxsFAmrSAywbHG1hc2FtaS5o
 aXJhbWF0c3VAZ21haWwuY29tAAoJENv7B78FKz8bY14IAIQNGUIk12JDJMKWAhZp
 Zv9jt7ER+3ei2v9qnhnykEvzbMA9PiuPu/6I8u1z+vTkJg7n7YK27DWWZ1o14E1m
 CRMgo/c+s5H+vWaBwCuxxwYBEWBFNGzB2LFBrb8L6n4cMq07AqSfIRmbz83fZHNl
 N8nxqK2aENVmnM3wvSM210TuZnYwihPQncRgSAsco6Y260G+LZbPdfDZXYbfWMTD
 pxkSbjdVGueiowz0zszkDyFMqIR5mtLW1hRMn8qMZaEdeZAPDeruo69hXSRyd2ny
 X379NoSSNjog2efWmXEzb3OYo5PuGVU1If5eGEBraDRgBiK18nB4a13HVkvfYWWW
 AM8=
 =vDMe
 -----END PGP SIGNATURE-----

Merge tag 'probes-fixes-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull probes fix from Masami Hiramatsu:

 - error out if BTF is required but unavailable

   Fix to return an error instead of NULL if BTF is not available when
   user specify '$args*' meta fetch argument for probe events.

* tag 'probes-fixes-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing: probes: error if BTF is required but unavailable
2026-10-16 14:25:25 -10:00
Petr Mladek
54e1e89a97 Merge branch 'for-7.3-hotfix' into for-linus 2026-10-16 17:38:25 +02:00
John Ogness
5f339c46f1 printk: Postpone kthread startup
There have been various bug reports related to SMP systems hanging
on boot. The reports vary but seem to have some overlap with regard
to missed IPI's during SMP setup. The reports also show that
reverting NBCON console usage allows the bugs to disappear.

The NBCON kthreads for console printing are started very early
during boot using early_initcall(). Since these kthreads are
asynchronously enabling/disabling interrupts during early boot, they
may be interfering with early SMP setup on some hardware platforms.

Starting the console printing kthreads later has shown to avoid the
hanging on systems that could previously reproduce the issue.

Postpone kthread starting until after all arch initcalls have
completed.

Reported-by: Derek Barbosa <debarbos@redhat.com>
Closes: https://lore.kernel.org/linux-rt-users/arPmYPbFLf2EldIl@debarbos-thinkpadt14gen5.rmtusma.csb
Fixes: 76f258bf3f ("printk: nbcon: Introduce printer kthreads")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Tested-by: Derek Barbosa <debarbos@redhat.com>
Link: https://patch.msgid.link/20261016085441.857695-1-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-10-16 17:07:29 +02:00
Linus Torvalds
1dbb742205 vfs-7.3-rc8.fixes
Please consider pulling these changes from the signed vfs-7.3-rc8.fixes tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlQAKCRCRxhvAZXjc
 ooBKAQCaO0P/WCAUk+nHRuqKMT5Wjpcb+RKbZEDYxMt+JobeOwEAhx4ThOT8eOwX
 D2x/HjeOJ66fkbtFP1dXJzKaySf/PAs=
 =g2mr
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.3-rc8.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs fixes from Christian Brauner:

 - Fix a range of use-after-frees during rcu pathwalk caused by non-rcu
   frees.

   Whatever ->permission(), ->d_revalidate(), ->get_link(), ->d_hash()
   and ->d_compare() read in rcu mode has to be freed after a grace
   period. umount(2) hides most of it because namespace_unlock() waits
   for one, but a chdir() out of a lazily unmounted directory or the
   close() of the last file on it drops the last reference without.

    * ext4_get_link() reads the sbi and the extent status counters for a
      symlink stored in a data block. Both are freed after a grace
      period now.

    * The unicode map of casefolded ext4, f2fs and tmpfs was freed under
      generic_ci_d_hash() and generic_ci_d_compare().

    * ntfs3 with nocase freed its sbi and mount options under its dentry
      hash and compare. A remount freed the old options right away too.

    * eventfs freed an eventfs_inode after an SRCU grace period only
      while tracefs_d_revalidate() reads it under rcu_read_lock().

    * afs and 9p are only saved by the grace period their private bdi
      gets in bdi_unregister(). They stop depending on it.

    * create_ipc_ns() leaked the mqueue mount and its superblock on a
      late failure. A long-term mount needs kern_unmount().

 - Don't let idle threads pin the initramfs.

   The idle threads of the secondary cpus are forked from PID 1 with a
   private copy of its fs_struct, aren't on the task list so
   pivot_root() never moves them and never exit. So the initramfs stayed
   pinned forever on every machine with more than one cpu, 70 to 150 MB
   in the reports. They share init_fs now like init_task does.

 - A mount that copy_tree() leaves out can't take over a lock.

   copy_tree() drops mounts of mount namespace files from the copies it
   makes for unshare(CLONE_NEWNS) and propagation without looking at
   MNT_LOCKED. So root in a user namespace could bind a child's
   /proc/<pid>/ns/mnt beneath a locked cover, let it take the lock over,
   unshare(CLONE_NEWNS) and read the file. copy_tree() refuses with
   EPERM now and the move beneath a locked mount is refused up front.

 - Revert "namei: don't reveal overmounted entries in refwalk" from the
   rc7 fixes. The bug class is bigger than that patch.

 - namei: lookup_fast_for_open() checked ->d_inode while
   traverse_mounts() checks the type in d_flags, which is set second, so
   a refwalk racing the instantiation could fail an O_CREAT open with
   ENOENT. Use d_is_negative() in both places.

 - Drop the smp_mb()s in mntput_no_expire_slowpath() and do_umount()
   that mnt_get_count()'s own barrier made redundant.

 - fsnotify: a mark added while fsnotify_destroy_marks() walks the
   connector could be missed and the connector detached, so an fdinfo
   read called igrab(NULL). New marks are refused during teardown.

 - pipe: a failed second fasync enable on an O_RDWR FIFO removed the
   existing reader entry and cleared FASYNC while the writer entry
   stayed, a use-after-free in send_sigio() later.

 - watch_queue: post_one_notification() could see nr_notes before the
   note pool behind it and dereference a NULL array. An unprivileged
   user can trigger that with a key watch. Publish nr_notes last.

 - pid_namespace: zap_pid_ns_processes() waits without bound for a
   tracer outside the namespace to reap its zombies and neither wait was
   freezable, so every suspend attempt failed.

 - exit: is_child_subreaper and has_child_subreaper shared a word with
   other bitfields written without a common lock, so racing prctl()s
   lost a bit. They are separate bools now.

 - autofs: a notification write that failed on a pipe the daemon had
   already replaced put the superblock into catatonic mode again and
   closed the replacement. Only do that for the current pipe.

 - ovl: reject a lowerdir ending with an unescaped backslash with EINVAL
   instead of a confusing ENOENT later.

 - ocfs2/dlm: take dlm_reco_state_lock when the debugfs state file walks
   the recovery participant list.

 - samples/pidfd: fix the userprogs typo that kept pidfd-metadata from
   being built.

* tag 'vfs-7.3-rc8.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (24 commits)
  Revert "namei: don't reveal overmounted entries in refwalk"
  selftests/filesystems: test that a mntns file can't take over a lock
  fs: let idle threads share init_fs
  namespace: a mount that copy_tree() leaves out can't take over a lock
  namei: test for a negative dentry the way traverse_mounts() does
  fs: pass flags to copy_fs()
  ovl: reject lowerdir ending with unescaped backslash
  fsnotify: prevent mark additions during connector teardown
  pid_namespace: make zap_pid_ns_processes() freezable
  fs: drop the smp_mb()s that mnt_get_count() made redundant
  autofs: ignore notification errors from a replaced pipe
  ntfs3: free replaced mount options after a grace period
  ntfs3: free the sbi after a grace period
  unicode: free the map after a grace period
  ipc: drop the mqueue mount with kern_unmount() on setup failure
  eventfs: free the eventfs_inode after an rcu grace period too
  9p: free the session after a grace period
  watch_queue: Fix note pool publication race in watch_queue_set_size()
  afs: free the super info after a grace period
  pipe: preserve existing fasync readers on writer setup failure
  ...
2026-10-16 07:53:16 -07:00
Christian Loehle
b99b7f60c5 sched: Replace nr_iowait_cpu() with a bool accessor
The menu governor was the last consumer of the per-CPU I/O-wait count
that needed its magnitude, apart from nr_iowait() summing it globally.
Commit 38f83090f5 ("cpuidle: menu: Remove iowait influence") removed
that use. All remaining per-CPU consumers only test for zero/nonzero.

Replace nr_iowait_cpu() with bool cpu_has_iowait() and update the generic
and s390 idle accounting callers. Have nr_iowait() read the counters
directly so that the global total and existing accounting are preserved.
Replace the stale menu comment with a description of the predicate.
Also convert the remaining open-coded idle accounting checks to use the
predicate, as suggested by Prateek.

The conversion was done with coccinelle:

@ predicate depends on patch @
expression cpu;
@@

- nr_iowait_cpu(cpu) > 0
+ cpu_has_iowait(cpu)

@ callers depends on patch @
expression cpu;
@@

- nr_iowait_cpu(cpu)
+ cpu_has_iowait(cpu)

Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://patch.msgid.link/20261016073341.575472-1-christian.loehle@arm.com
2026-10-16 09:49:04 +02:00
Kayra Cizmeci
0a94d0ea8d Revert "sched/fair: Remove dead code on enqueue_task_fair()"
This reverts commit 819224e506.

The cfs_rq->curr == se case can actually happen with CFS_BANDWIDTH,
so the removed code is needed. Document this.

Fixes: 819224e506 ("sched/fair: Remove dead code on enqueue_task_fair()")
Reported-by: Christian Loehle <christian.loehle@arm.com>
Signed-off-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/lkml/fd3f9d83-cb5b-496b-b7c1-b40f31cf795e@arm.com/
Link: https://patch.msgid.link/20261015082919.4344-1-kayracizmeci@gmail.com
2026-10-16 09:49:04 +02:00
Jemmy Wong
fcceb7da94 sched/cache: Avoid publishing partial LLC utilization
update_sg_lb_stats() sums utilization over the CPUs in both
sched_group_span(group) and env->cpus, but takes capacity from
group->sgc->capacity for the whole group. record_sg_llc_stats()
publishes both.

Rejecting an all-affinity-pinned source runqueue removes that CPU from
env->cpus and retries group selection. The retry can publish the
partial utilization with the full capacity.

can_migrate_llc() then treats a busy preferred LLC as having spare
capacity. More tasks can aggregate into it, migrations out can be
blocked, and two busy LLCs may not fall back to generic balancing.
This increases CPU contention and task latency. Found by inspection.

Skip publication on affinity retries using LBF_ALL_PINNED, retaining
the first-pass snapshots and avoiding repeated cpumask checks. On the
first pass, publish either shared LLC statistic only when env->cpus
covers the whole group. Load balancing still uses the affinity-filtered
statistics.

The same window exists during CPU hotplug. env->cpus drops a CPU at
set_cpu_active(false), but the group span and sgc->capacity still
include it until cpuset_cpu_inactive() rebuilds the domains. Keeping
the previous snapshot avoids the mismatched publish. After the rebuild,
the next periodic balance records both statistics again.

Fixes: f025ef2753 ("sched/cache: Record per LLC utilization to guide cache aware scheduling decisions")
Suggested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Suggested-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Jemmy Wong <jemmywong512@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20261013084338.55100-1-jemmywong512@gmail.com
2026-10-16 09:49:04 +02:00
Stian Halseth
96a494c9cf sched/cputime: Don't account idle time twice after dyntick-idle
On idle exit the dyntick-idle accounting accounts the time up to now,
then the tick is restarted on its old period. The first tick accounts a
whole TICK_NSEC to whatever runs, although the part of that period
before the idle exit has just been accounted as idle time, or with
IRQ_TIME_ACCOUNTING as IRQ time. That is up to a full tick per idle
exit, and /proc/stat reports more idle time than wall time.

Record how much of the current tick period dyntick-idle has accounted,
and leave it out of the tick that ends the period.

Fixes: cf6444c3e1 ("tick/sched: Unify idle cputime accounting")
Signed-off-by: Stian Halseth <stian@itx.no>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/all/20261004142724.3896396-1-stian@itx.no/
Link: https://patch.msgid.link/20261007142950.547604-1-stian@itx.no
2026-10-16 09:49:03 +02:00
Shakeel Butt
6f88f6cbb0 sched/psi: Remove the RCU wait from trigger destruction
In the Meta fleet, we found PSI trigger destruction waiting for an RCU
grace period while holding kernfs node_mutex, blocking other users [1].
File close and node drain hold this mutex while calling the release
callback. Cgroup removal and disabling cgroup.pressure also hold
cgroup_mutex during the drain.

The wait was added by commit 0e94682b73 ("psi: introduce psi monitor")
to protect worker and trigger lookups. Commit 461daba06b
("psi: eliminate kthread_worker from psi trigger scheduling mechanism")
replaced the worker queue with a group timer. The scheduler now only
checks whether rtpoll_task is NULL; it uses neither the task nor the
trigger. Commit a06247c680 ("psi: Fix uaf issue when psi trigger is
destroyed while being polled") removed trigger replacement and polling's
RCU lookup.

Trigger lists are protected by mutexes. Proc poll/select entries are
removed before their file references are dropped. eventpoll_release()
removes epoll entries before the file release callback.
Commit aff037078e ("sched/psi: use kernfs polling functions for PSI
trigger polling") moved cgroup polling to a kernfs waitqueue whose
lifetime follows the file.

A late timer firing only wakes the group waitqueue. The system group is
static, and commit 5457025fa8 ("sched/psi: Shut down rtpoll_timer in
psi_cgroup_free()") shuts down the cgroup timer before freeing the group.
Cgroup reclamation already waits for scheduler readers.

Remove synchronize_rcu() from psi_trigger_destroy() and use
rcu_access_pointer() for the worker NULL check. Keep kthread_stop()
outside the trigger mutex.

Tested trigger churn, notifications and cgroup removal in an 8-CPU VM
with KASAN, lockdep, and full and lazy preemption. No warnings were found.

Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://github.com/bpftrace/user-tools/tree/master/runnablelockmonitor [1]
Link: https://patch.msgid.link/20261010191500.3895736-1-shakeel.butt@linux.dev
2026-10-16 09:49:03 +02:00
Antoine Huret
e4c7c401c6 perf: Update cgroup time when rotating multiplexed events
Since commit bd27568117 ("perf: Rewrite core context handling"),
perf_rotate_context() only updates the context time before scheduling
out the flexible events. It no longer updates the cgroup time, which
ctx_sched_out() used to do.

Cgroup events take their times from the per-cpu cgroup clock, so
between two cgroup switches the rotations see a frozen clock. The
events rotated out lose the running time they accumulated, and the next
update, usually a read, credits the whole interval to the events that
happen to be on the PMU at that moment.

As a result, the time_running of multiplexed cgroup events is wrong,
and so are their scaled counts, as long as no other cgroup runs on the
CPU, e.g. a busy job alone on its CPUs. Counting cycles over one second
of a busy loop in a cgroup gives from half to several times the max
frequency of the CPU.

Update the cgroup time before rotating the CPU context, as was done
before the rewrite.

Fixes: bd27568117 ("perf: Rewrite core context handling")
Closes: https://lore.kernel.org/r/PR3PR07MB69223331EED5BEBE150375B7849C2@PR3PR07MB6922.eurprd07.prod.outlook.com/
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Antoine Huret <antoine.huret@bull.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261015-perf-cgroup-rotation-time-v1-1-93e177dfee5d@bull.com
2026-10-16 09:49:01 +02:00
Haris Okanovic
e76b36b4be perf: Fix perf_pmu_migrate_context() leaving events behind
__perf_pmu_remove() walks the group leaders of a CPU and PMU with
perf_event_groups_for_cpu_pmu(), removing each one as it goes.
perf_remove_from_context() takes the leader out of the groups rbtree,
after which rb_next() on that node returns NULL, prematurely ending the
walk. Other groups stay behind in the source context.

On CPU hotplug, they are then torn down with the dying CPU. They keep
running until teardown, while the PMU's interrupt and migrated events
are on a new CPU, which drivers rely on never happening.

Walk ctx->event_list instead and pick out the PMU's events by their
pmu_ctx.

Fixes: bd27568117 ("perf: Rewrite core context handling")
Signed-off-by: Haris Okanovic <harisokn@amazon.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20261013185603.1347265-2-harisokn@amazon.com
2026-10-16 09:49:01 +02:00
Lorenzo Stoakes (ARM)
78436f3882 perf: Track the perf mlock gift separately
The locked_vm field in struct user_struct was originally introduced by
commit 789f90fcf6 ("perf_counter: per user mlock gift") to provide an
mlock-like budget for perf measured against mm->pinned_vm (since 2011).

perf grants each user a 'gift' of perf_event_mlock_kb * online CPUs of
buffer pages which is charged to user->locked_vm without any RLIMIT_MEMLOCK
check.

Only pages beyond the gift are checked against RLIMIT_MEMLOCK, per-mm, via
mm->pinned_vm, which makes it different from the standard mlock() check,
which is per-mm and made against RLIMIT_MEMLOCK.

However, since this was introduced, a number of other components have
utilised this field where a shared resource needed to be limited against
RLIMIT_MEMLOCK.

The other users are currently MSG_ZEROCOPY, io_uring, AF_XDP, iommufd,
s390 KVM zPCI and most recently, secretmem in commit 97d34aa65c
("mm/secretmem: properly account locked pages").

This field is shared between all of these, but because the gift is not
checked against RLIMIT_MEMLOCK, user->locked_vm alone can exceed it - 16
CPUs * 516 KiB is already more than the default 8 MiB - after which every
other user of the field fails unconditionally.

This was reported by a user who saw secretmem failing while running a
simultaneous perf record.

Resolve the issue by simply giving perf its own field separate from the
rest.

BPF used user->locked_vm up until commit 80ee81e040 ("bpf: Eliminate
rlimit-based memory accounting infra for bpf maps") which landed in 5.11.

Thus also eliminate the now-defunct ifdef for CONFIG_BPF_SYSCALL for
user->locked_vm.

This issue exists between all of the components which use user->locked_vm
and perf, however secretmem is the first user who has caused a report over
many years and has been backported, so target the fix at that.

Fixes: 97d34aa65c ("mm/secretmem: properly account locked pages")
Closes: https://lore.kernel.org/20261002175651.811343-1-ameer.hamza@truenas.com
Reported-by: Ameer Hamza <ameer.hamza@truenas.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261003-perf-locked-vm-fix-v1-1-d214dcaf0d76@kernel.org
2026-10-16 09:49:01 +02:00
Hui Su
2f93bcb3f9 sched/fair: Avoid overflow in place_entity()
place_entity() inflates an entity's virtual lag with

    lag * (load + weight) / load

Commit 4823725d9d ("sched/fair: Increase weight bits for avg_vruntime")
replaced the scaled-down weights used in this calculation with
avg_vruntime_weight(), removing the arithmetic headroom provided by
scale_load_down().

The multiplication can overflow s64 before the division even when the
final quotient is representable. A task's hierarchical effective weight
can be as small as 2 after avg_vruntime_weight() scaling under group
scheduling, while entity_lag() bounds |vlag| by

    calc_delta_fair(cfs_rq_max_slice(cfs_rq) + TICK_NSEC, se)

For example, with HZ=1000, NICE_0_LOAD=1048576, and the minimum scaled
hierarchical weight scale_load(2)=2048, this bound is 891289600. With 114
maximum-weight entities, the runqueue load is 10361604096. The
intermediate product is:

    891289600 * (10361604096 + 2)
        = 9235189971864780800
        > S64_MAX

The signed overflow corrupts the entity's placement.

Rewrite

    lag * (load + weight) / load

as

    lag + lag * weight / load

The two expressions are equivalent, but the latter avoids multiplying the
virtual lag by the total runqueue weight. entity_lag() bounds vlag against
the entity's effective weight, so the remaining lag * weight product stays
bounded. rescale_entity() preserves this scale across h_load changes and
already relies on the same product when rescaling vlag.

Keep the original zero-load warning semantics by multiplying lag by weight
after replacing the divisor with one.

Fixes: 4823725d9d ("sched/fair: Increase weight bits for avg_vruntime")
Signed-off-by: Hui Su <sh_def@163.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260928124754.1692077-1-sh_def@163.com
2026-10-16 09:49:00 +02:00
Taeyang Lee
c47a7b11bc tracing: Check operator stack capacity before pushing
predicate_parse() uses the first operator stack entry before processing
any opening parentheses. A push then increments top before writing.
The existing check still permits that write when top already points to
the last allocated entry, which can access beyond the operator stack.

Reject the push when top reaches the last allocated entry.

Cc: stable@vger.kernel.org
Fixes: 39f7c41c90 ("tracing/filters: Enable filtering a cpumask field by another cpumask")
Link: https://patch.msgid.link/atELO9L0I9kg5CpC@Taeyangs-MacBook-Pro.local
Signed-off-by: Taeyang Lee <0wn@theori.io>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-15 18:07:15 -04:00
Taeyang Lee
803aa6fc2d tracing: Keep the predicate limit separate from program capacity
predicate_parse() adds two to nr_preds to reserve the terminal TRUE
and FALSE entries. It also uses that increased value as the limit for
parsed predicates. If the initial count is smaller than the number
actually parsed, the program can fill the allocation and subsequent
accesses can go past its end.

Keep nr_preds as the predicate limit and use a separate value for the
allocation size. This leaves space for both terminal entries and a
zeroed entry when parsing stops at the limit.

Cc: stable@vger.kernel.org
Fixes: 39f7c41c90 ("tracing/filters: Enable filtering a cpumask field by another cpumask")
Link: https://patch.msgid.link/atELCd1XjKVhrkFL@Taeyangs-MacBook-Pro.local
Signed-off-by: Taeyang Lee <0wn@theori.io>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-15 18:07:06 -04:00
Hao Ge
3cc117514d tracing: Fix crash in print_graph_function_event()
tracing_set_tracer() assigns the flags of the newly selected tracer
with:

	tr->current_trace_flags = t->flags ? : t->tracer->flags;

If the new tracer defines neither static flags nor default flags, like
hwlat, irqsoff or wakeup, add_tracer() has no per instance flags copy
for it, and both operands are NULL, so tr->current_trace_flags ends up
being NULL as well.

The ring buffer is not cleared when switching tracers: it is reset
inside tracer_init(), after current_trace_flags was already assigned.
If the buffer still holds function_graph entries of the previous
tracer, printing one of them dereferences the NULL pointer. This was
hit by cat trace during an ftrace stress test:

  BUG: kernel NULL pointer dereference, address: 0000000000000000
  #PF: supervisor read access in kernel mode
  RIP: 0010:print_graph_function_event+0xe/0x20
  Call Trace:
   s_show+0x4d/0x110
   seq_read_iter+0x2d4/0x490
   seq_read+0x130/0x170
   vfs_read+0xb5/0x370
   ksys_read+0x6d/0xe0
   do_syscall_64+0xbc/0x450

The snapshot buffer is not reset at all, so this can be reproduced
without a race:

  echo function_graph > /sys/kernel/tracing/current_tracer
  echo 1 > /sys/kernel/tracing/snapshot
  echo hwlat > /sys/kernel/tracing/current_tracer
  cat /sys/kernel/tracing/snapshot

Rather than teaching every user of tr->current_trace_flags about this
corner case, make sure it is never NULL: when the newly selected
tracer has no flags at all, tracing_set_tracer() falls back to a
static empty no_tracer_flags. run_tracer_selftest() can hit the same
case, so the same fallback is added there too. The existing users
already handle opts == NULL, so these tracers keep behaving as before.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261015130658.221198-1-hao.ge@linux.dev
Fixes: e29aa918a9 ("tracing: Have function graph tracer define options per instance")
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Hao Ge <hao.ge@linux.dev>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-15 18:03:48 -04:00
Catalin Marinas
d0de3a7319 Merge branch 'for-next/fw-rmi' into for-next/core
* for-next/fw-rmi:
  : RMM v2.0 base RMI support
  firmware: arm_rmm: hotplug: Skip memory added to ZONE_MOVABLE
  firmware: arm_rmm: Add wrappers for Realm related RMI commands
  arm64: Block hibernate and kexec while RMM is active
  PM: hibernate: Add an arch hook for preventing hibernation
  firmware: arm_rmm: Ensure the RMM has GPT entries for memory
  firmware: arm_rmm: Activate the RMM
  firmware: arm_rmm: Add support for SRO
  firmware: arm_rmm: Configure the RMM with the host's page size
  firmware: arm_rmm: Check for RMI support at init
  firmware: arm_rmm: Add SMC definitions for calling the RMM
  arm64: mm: Handle Granule Protection Faults (GPFs)
2026-10-15 19:09:31 +01:00
Lee Jones
a244c24159 tracing/histograms: Reject non-stacktrace fields for synthetic stacktrace fields
In check_synth_field(), when a synthetic event field is a stacktrace
(field->is_stack) and the histogram field is not a "long[" stacktrace
array, validation falls through to the generic size and signedness
comparison.

Because parse_synth_field() sets a stacktrace field's type to
"__data_loc unsigned long[]", its size is sizeof(u64) and
synth_field_signed() marks it as signed.  Consequently, any 8-byte
signed scalar histogram field passes the fallback check, and its scalar
value is subsequently dereferenced as a kernel stacktrace pointer in
get_field_size() and trace_stack().

Furthermore, checking strstr(hist_field->type, "long[") is insufficient
because tracepoint fields defined with __bitmask() or __rel_bitmask()
also have type "__data_loc unsigned long[]" or "__rel_loc unsigned
long[]", whilst create_hist_field() treats them as 4-byte scalar values
without HIST_FIELD_FL_STACKTRACE.

Propagate HIST_FIELD_FL_STACKTRACE to variable references and field
variables (whilst excluding variable aliases from per-element
stacktrace capture), and reject any mismatch between
HIST_FIELD_FL_STACKTRACE and field->is_stack in check_synth_field().

Cc: stable@vger.kernel.org
Fixes: 00cf3d672a ("tracing: Allow synthetic events to pass around stacktraces")
Link: https://patch.msgid.link/20261013112449.1006088-1-lee@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-15 08:52:44 -04:00
Vincent Donnefort
13d530f2da ring-buffer: Use subbuf_order in available memory estimation
To avoid failing in the middle of an allocation of a ring-buffer,
__rb_allocate_pages() looks at the available memory estimation with
si_mem_available(). Use the subbuffer order with this estimation to fail
early if necessary for ring-buffers with an order > 0.

Link: https://patch.msgid.link/20261013102047.1488347-3-vdonnefort@google.com
Fixes: f9b94daa54 ("ring-buffer: Set new size of the ring buffer sub page")
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-15 08:52:26 -04:00
Martin Kaiser
66c658033d tracing: probes: error if BTF is required but unavailable
traceprobe_expand_meta_args expands probe arguments based on BTF info.

Return an error if we have arguments that need expanding but BTF is not
supported.

The params variable is now unused, it can be removed.

Link: https://lore.kernel.org/all/20261014083838.31020-1-martin@kaiser.cx/

Fixes: d157d76944 ("tracing/probes: Support BTF field access from $retval")
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
2026-10-15 10:09:36 +09:00
Linus Torvalds
9fee1f650a workqueue: Fixes for v7.3-rc7
- Fix a NULL dereference in the check for whether the current task is
   running a memory reclaim work item when called from a kworker outside work
   item execution.
 -----BEGIN PGP SIGNATURE-----
 
 iIQEABYKACwWIQTfIjM1kS57o3GsC/uxYfJx3gVYGQUCatAC5g4cdGpAa2VybmVs
 Lm9yZwAKCRCxYfJx3gVYGbrsAP9YS8OZT8k1JxG55H34VWKbUia0ojydA/uGGhPp
 Sx/QNAD/erdd7pJr7MRCRbSTkk5nHmz+yjvpBgv+FTVf+16UCgI=
 =3vxA
 -----END PGP SIGNATURE-----

Merge tag 'wq-for-7.3-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq

Pull workqueue fix from Tejun Heo:

 - Fix a NULL dereference in the check for whether the current task is
   running a memory reclaim work item when called from a kworker outside
   work item execution

* tag 'wq-for-7.3-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  workqueue: Fix NULL current_pwq deref in mem-reclaim helper
2026-10-14 16:11:57 -07:00
Vincent Donnefort
c9fc60c18b ring-buffer: Skip si_mem_available() for persistent and remote buffers
Persistent and remote buffer memory is pre-allocated by the time
__rb_allocate_pages() is called. Skip si_mem_available() to avoid
wrongly failing the allocation under memory pressure.

For the same reason, unset user_thread.

Link: https://patch.msgid.link/20261013102047.1488347-2-vdonnefort@google.com
Fixes: be68d63a13 ("ring-buffer: Add ring_buffer_alloc_range()")
Fixes: 2e67fabd8b ("ring-buffer: Introduce ring-buffer remotes")
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:40 -04:00
Amit Machhiwal
b3b9740083 tracing: Do not initialize tracefs work if tracing is disabled
If trace buffer allocation fails during early boot (e.g.  in
early_trace_init() -> allocate_trace_buffers()), tracing_disabled is
left set to 1 and the global trace array events list remains
uninitialized.

Later during boot, tracer_init_tracefs() (invoked via fs_initcall)
queues tracerfs_init_work asynchronously without checking if tracing was
disabled.  When tracer_init_tracefs_work_func() runs, it calls
event_trace_init() and init_tracer_tracefs(&global_trace, NULL)
unconditionally.  This leads to __find_event_file() dereferencing an
uninitialized tr->events list, causing an early boot NULL pointer
dereference Oops:

  BUG: Kernel NULL pointer dereference on read at 0x00000010
  Faulting instruction address: 0xc000000000485be0
  Oops: Kernel access of bad area, sig: 7 [#1]
  ...
  NIP [c000000000485be0] __find_event_file+0x70/0x3c0
  LR  [c000000000448874] init_tracer_tracefs+0x274/0xc80
  Call Trace:
   init_tracer_tracefs+0x274/0xc80
   tracer_init_tracefs_work_func+0x50/0x320
   process_one_work+0x1e8/0x5c0
   worker_thread+0x1dc/0x3d0
   kthread+0x194/0x1b0
   start_kernel_thread+0x14/0x18

Check tracing_disabled at the beginning of tracer_init_tracefs_work_func()
and return immediately if tracing is disabled or failed to initialize,
preventing the crash.

Cc: stable@vger.kernel.org
Fixes: 6621a70046 ("tracing: make tracer_init_tracefs initcall asynchronous")
Link: https://patch.msgid.link/20261009163557.88467-2-amachhiw@linux.ibm.com
Reported-by: Michal Suchánek <msuchanek@suse.de>
Closes: https://lore.kernel.org/all/arYskzbiaNzBR9MD@kunlun.suse.cz/
Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:40 -04:00
Tengda Wu
9414ca3b99 tracing: Fix hist trigger timestamps for buffered events
Syzkaller triggered a WARN_ON_ONCE(!nest) warning:

  WARNING: kernel/trace/ring_buffer.c:821 at ring_buffer_event_time_stamp
  Call trace:
    ring_buffer_event_time_stamp
    hist_field_timestamp
    hist_fn_call
    event_hist_trigger
    event_triggers_call
    __event_trigger_test_discard
    trace_event_buffer_commit
    do_trace_event_raw_event_sched_switch
    trace_event_raw_event_sched_switch

The warning is probabilistically reproducible and is related to syzkaller
executing the following commands:

  echo 'prev_pid == 999999' > events/sched/sched_switch/filter
  echo 'hist:keys=common_timestamp' > events/sched/sched_switch/trigger

The specific triggering process is as follows:

CPU 0                                           CPU 1
(context switching)                             (echo 'hist:keys=common_timestamp' > \
                                                        events/sched/sched_switch/trigger)
do_trace_event_raw_event_##call
  trace_event_buffer_lock_reserve
    if (!tr->no_filter_buffering_ref &&
        trace_file->flags & EVENT_FILE_FL_FILTERED)
        return entry;  // return directly
                                                event_hist_trigger_parse
                                                  hist_register_trigger
                                                    tracing_set_filter_buffering(file->tr, true);
                                                      tr->no_filter_buffering_ref++;
    __trace_buffer_lock_reserve
      rb_start_commit
        local_inc(&cpu_buffer->committing);  // skipped and not executed
  trace_event_buffer_commit
    __event_trigger_test_discard
      event_triggers_call
        event_hist_trigger
          hist_fn_call
            hist_field_timestamp
              ring_buffer_event_time_stamp
                nest = local_read(&cpu_buffer->committing);
                WARN_ON_ONCE(!nest)  // trigger warning

The root cause is that when an event file has a filter attached and the
hist trigger has not yet been attached, trace_event_buffer_lock_reserve()
writes the event into the per-CPU trace_buffered_event temp buffer instead
of reserving it in the ring buffer, so cpu_buffer->committing is not
incremented. When the event is later processed at commit time by a hist
trigger, hist_field_timestamp() -> ring_buffer_event_time_stamp() sees a
zero committing count, triggering WARN_ON_ONCE(!nest).

tracing_event_time_stamp() was added by commit d8279bfc5e ("tracing:
Add tracing_event_time_stamp() API") for exactly this case: if the event
is the per-CPU trace_buffered_event, it returns the current ring buffer
timestamp. But it never gained a caller. Use it in hist_field_timestamp(),
so that a hist trigger that races onto a buffered event records the
current time, which is only marginally later than when the event was
recorded, instead of warning and recording a bogus timestamp.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260929104015.1689921-1-wutengda@huaweicloud.com
Fixes: b94bc80df6 ("tracing: Use a no_filter_buffering_ref to stop using the filter buffer")
Signed-off-by: Tengda Wu <wutengda@huaweicloud.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:40 -04:00
Dmitry Kandybka
3110d09bb9 tracing: Fix ignored return value of resize_buffer_duplicate_size()
When tr->allocated_snapshot is true, resize_buffer_duplicate_size() is
called to update the snapshot buffer size. However, its return value was
not checked. In case of a failed resize this could lead next snapshot
being incomplete.

Add resize_buffer_duplicate_size() result check and return error if
resize fails.

Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260928152634.4354-1-d.kandybka@gmail.com
Fixes: 180e4e3909 ("tracing: Add snapshot refcount")
Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:40 -04:00
Krystian Kaniewski
89bab1dba8 ring-buffer: Fix false warning in ring_buffer_map_get_reader()
The mmap reader can warn when it catches up with a writer that is still
committing events. rb_get_reader_page() returns NULL in this case, but
ring_buffer_map_get_reader() treats that result as an error.

The initial rb_per_cpu_empty() check filters out an empty buffer, but it
does not guarantee that the next reader page has committed data. Writers
do not take reader_lock and can advance commit_page before publishing the
committed length on the new page. rb_get_reader_page() can swap to that
page, catch up with the writer and return NULL.

Handle NULL through the existing no-data exit without warning. Remove the
caller's reader_page == commit_page check as well, since the reader-page
helper already handles that case. The existing metadata update and return
path remain in place.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260924084946.20104-1-krystianmkaniewski@gmail.com
Fixes: 117c39200d ("ring-buffer: Introducing ring-buffer mapping functions")
Assisted-by: Gemini:gemini-3.8-flash syzbot
Reported-by: syzbot+de3d7f9bcc9212f3fae1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=de3d7f9bcc9212f3fae1
Link: https://syzkaller.appspot.com/ai_job?id=488adc18-a10e-42d2-a205-25327c38837f
Signed-off-by: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:39 -04:00
Vincent Donnefort
0fa993581a tracing: Fix simple_ring_buffer undef check on sparc64
simple_ring_buffer relies on headers that end up including
<asm/thread_info.h>. On sparc64, this emits the undefined symbol
current_thread_info_reg. Allow this symbol.

Link: https://patch.msgid.link/20260923074213.3077182-4-vdonnefort@google.com
Fixes: 1211907ac0 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/all/5574c9e6-9ed2-4ee6-a2b2-fb6ee81e83a1@roeck-us.net/
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:39 -04:00
Vincent Donnefort
ba875c4483 tracing: Fix simple_ring_buffer undef check on parisc
simple_ring_buffer uses local_set() and cmpxchg() on unsigned long. Add
them to undefsyms_base.c to extend the allowlist for the parisc
architecture.

Link: https://patch.msgid.link/20260923074213.3077182-3-vdonnefort@google.com
Fixes: 1211907ac0 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/all/5574c9e6-9ed2-4ee6-a2b2-fb6ee81e83a1@roeck-us.net/
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:39 -04:00
Vincent Donnefort
c902b6d709 tracing: Fix empty symbol names in simple_ring_buffer undef check
Sparc64 emits empty symmbol names. Skips them when establishing the
allowlist and when extracing undefined symbols.

Link: https://patch.msgid.link/20260923074213.3077182-2-vdonnefort@google.com
Fixes: 1211907ac0 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/all/5574c9e6-9ed2-4ee6-a2b2-fb6ee81e83a1@roeck-us.net/
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 19:03:39 -04:00
Linus Torvalds
db7afcbf9e sched_ext: Fixes for v7.3-rc7
- A task that skipped the BPF scheduler on its way back to its CPU's local
   queue could stall there until the watchdog fired, as the CPU had already
   decided to go idle.
 
 - Use-after-free of a destroyed user dispatch queue by a deferred re-enqueue
   request.
 
 - A task could be moved off a dispatch queue while the dispatching CPU was
   still running ops.dequeue() on it.
 
 - Bypass mode mishandled a sub-scheduler bypass overlapping an ancestor's,
   as across a system suspend. Descendants could leave bypass mid-teardown
   and tasks could be stranded on bypass queues.
 
 - The idle CPU selection helper could return a CPU outside the allowed CPUs
   of a pinned or migration-disabled task.
 -----BEGIN PGP SIGNATURE-----
 
 iIQEABYKACwWIQTfIjM1kS57o3GsC/uxYfJx3gVYGQUCatACow4cdGpAa2VybmVs
 Lm9yZwAKCRCxYfJx3gVYGdEvAP4tfwuDqRpiVDU/69SdALuWdObKorErLg/6uTxE
 53qODgEA4Vvao1ZtcxzF3Fd+umA13UgiJ8WBxX66XJDMaxXtiAo=
 =LtsB
 -----END PGP SIGNATURE-----

Merge tag 'sched_ext-for-7.3-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext

Pull sched_ext fixes from Tejun Heo:

 - A task that skipped the BPF scheduler on its way back to its CPU's
   local queue could stall there until the watchdog fired, as the CPU
   had already decided to go idle.

 - Use-after-free of a destroyed user dispatch queue by a deferred
   re-enqueue request.

 - A task could be moved off a dispatch queue while the dispatching CPU
   was still running ops.dequeue() on it.

 - Bypass mode mishandled a sub-scheduler bypass overlapping an
   ancestor's, as across a system suspend. Descendants could leave
   bypass mid-teardown and tasks could be stranded on bypass queues.

 - The idle CPU selection helper could return a CPU outside the allowed
   CPUs of a pinned or migration-disabled task.

* tag 'sched_ext-for-7.3-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext:
  sched_ext: Wait for SCX_OPSS_DISPATCHING before moving tasks off DSQs
  sched_ext: Rename scx_reenq_wait_dispatching() to scx_wait_dispatching()
  sched_ext: idle: Respect task affinity in restricted CPU selection
  sched_ext: Fix the bypass dispatch claim for schedulers bypassed by an ancestor
  sched_ext: Propagate every bypass depth change to the descendants
  sched_ext: Fix use-after-free of a destroyed user DSQ by a deferred reenqueue
  sched_ext: Fix stall when a task enqueued with SCX_ENQ_LAST lands back on its CPU's local DSQ
2026-10-14 15:58:16 -07:00
Donggeun Yoo
25132363c7 ring-buffer: Fix the sub-buffer array base in rb_meta_subbuf_idx()
On a persistent ring buffer, rb_meta_subbuf_idx() can return an index one
sub-buffer too high.  rb_setup_ids_meta_page() then fills subbuf_ids[]
shifted by one and leaves subbuf_ids[0] NULL, which __rb_map_vma()
dereferences when userspace maps trace_pipe_raw.  rb_update_meta_reader()
writes two such indices into meta->buffers[], which rb_cpu_meta_valid()
would reject on the next boot, discarding the previous boot's trace.

A CPU's sub-buffer array starts after its meta header and the nr_subbufs
integers that follow, aligned up to a sub-buffer.  rb_meta_subbuf_idx()
inverts that calculation but skips only the integers, not the header, so
its base is one sub-buffer low whenever the omitted header size crosses
the alignment boundary.

Invert the calculation with rb_subbufs_from_meta() rather than repeating
it.  rb_range_buffer() maps an index back to an address through the same
helper, so the two directions can no longer disagree.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260918071507.1019251-1-donggeunyoo.kernel@gmail.com
Fixes: b14d032973 ("ring-buffer: Add ring_buffer_meta data")
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 17:47:24 -04:00
Donggeun Yoo
647c2f97fc tracing: Fix the shift out of bounds in the log2 histogram modifier
The .log2 key modifier files a value under its base-2 order:

  # echo 'hist:keys=bytes_req.log2' > events/kmem/kmalloc/trigger

hist_field_log2() computes that as ilog2(roundup_pow_of_two(val)). The
out-of-line form of roundup_pow_of_two() is

	return 1UL << fls_long(n - 1);

which shifts by 64 on a 64-bit kernel both when n is 0, where n - 1
wraps to ULONG_MAX, and when n is above 2^63. Both are ordinary keys,
because the field fetch hands every value over as a u64: a syscall
argument of 0 reaches the first, and one above 2^63 reaches the second.

Keying sys_enter_lseek on offset.log2 and passing 0, 1, 2, 3, 1000,
2^63+1 and U64_MAX gives

  { offset: ~ 2^1  } hitcount:          1
  { offset: ~ 2^10 } hitcount:          1
  { offset: ~ 2^2  } hitcount:          1
  { offset: ~ 2^0  } hitcount:          4

Keys above 2^63 land in the lowest bucket. With CONFIG_UBSAN_SHIFT=y
the shift is also reported:

  UBSAN: shift-out-of-bounds in include/linux/log2.h:57:13
  shift exponent 64 is too large for 64-bit type 'long unsigned int'
   __ubsan_handle_shift_out_of_bounds.cold+0xdd/0x1cb
   hist_fn_call.cold+0x8b/0xd9
   event_hist_trigger+0x1cc/0x790
   ftrace_syscall_enter+0x197/0x360
   do_syscall_64+0x402/0x4b0

Use order_base_2(), which is ilog2(n - 1) + 1 for n > 1 and 0 below
that. It returns what the old expression returned on every input the
old one was defined for. Where it was not, 0 stays in bucket 0, which
is where x86_64 had been putting it, and the keys above 2^63 move into
bucket 64.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260916002735.808520-1-donggeunyoo.kernel@gmail.com
Fixes: 4b94f5b7b4 ("tracing: Add hist trigger 'log2' modifier")
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 17:47:24 -04:00
David Carlier
3f23cae09a ring-buffer: Do not show buffer_meta for CPUs without a buffer
The per_cpu/cpuN/buffer_meta files are created for every possible CPU,
but buffer->buffers[cpu] is only allocated once that CPU comes online.
Reading the file of a CPU that never came online dereferences a NULL
cpu_buffer in rbm_start().

Fail the open with -ENODEV when the CPU has no buffer, as the other
per CPU ring buffer interfaces do.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260914133506.4865-3-devnexen@gmail.com
Fixes: 950032ffce ("ring-buffer: Add output of ring buffer meta page")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260913134906.6E8A01F000FF@smtp.kernel.org/
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 17:47:24 -04:00
David Carlier
2afe7575fb tracing: Take trace_types_lock when dropping the buffer_meta reference
tracing_buffer_meta_open() drops the trace_array reference with
__trace_array_put() when ring_buffer_meta_seq_init() fails, without
holding trace_types_lock. Use trace_array_put() like every other open
error path.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260914133506.4865-2-devnexen@gmail.com
Fixes: 950032ffce ("ring-buffer: Add output of ring buffer meta page")
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-10-14 17:47:24 -04:00