Commit Graph

52722 Commits

Author SHA1 Message Date
Linus Torvalds
104a813376 VDSO updates:
- Consolidate the VDSO datastore further and provide support for
    mlock_all() and prefaulting.
 
  - Provide 32-bit legacy time related functionality only if
    CONFIG_COMPAT_32BIT_TIME is enabled. The config switch exists, but
    architecture code still exposes the legacy functionality even disabled.
 
    Clean this up by adding the missing guards and validating at build time
    that the VDSO is legacy free if disabled.
 
  - Consolidate the VDSO related config options in core and drivers, which
    removes some non-sensical dependencies and quite an amount of #ifdeffery.
 
  - Clean up the PAGE_SIZE definition maze
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqCxfkQHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoSQkEADEOmcrm3vwMbaElrAfQRp4MOQMnDpKPCDa
 0EwdkXKJyqfOGx1PNKbcWZe10qShpXqyz+q3MUbHiOVh7KxkaGj0GOA/+xD+Tgs5
 RAFXCq+CY4Ccjix7vlyOBLvGgomuznAtRDCFprVq5OTXyQfVvS++5SHzaU/0xXiY
 ZZEInrFP61BEJ8LJycpoN5431EBcUX7XpSkr9eHtuSOslOBzbTEtBbDp0AjDGse0
 5qM/oZDufZDQQr31kVQiL0dN9bBWwdGNtBwZBjsf6KioY9M00LO0E9twSCSrI39F
 kgD2N97RDjTewu/zEe0fvCDVypqel2mBvjfiYU4c8g6pprdJ4Hq1qMcDAtMBUDBZ
 9jR8B09eYZwHLdbM5PFjiMf9d6p25P7X+twFI9Hylcm1YZtM4OTnamDhQOQDp1Fd
 QdrFevXg1zvYVi1rrDYarcPfg/tGsetOTujMQ1m50/AJZOoEdcX9jZR/wfdW8ti6
 X9TIn3SDzhauXkmeR86tHxtOmHDirVfBWCCCEyVT2YzGIIje25cf266fCPdcGRYl
 kzhtycg8LqpTRMWjhlaf56NtD9qQlbvDY8L23tQLJUYhDp8xOxqyuRPRdpJVM0b3
 4vp/Z8Sgz8tpEHO2ARsXfuu2CzilTBH0B2KL3f+a8CwpzIEadjIfc+6EEYqwgOAn
 +/RhckFp/A==
 =jHl1
 -----END PGP SIGNATURE-----

Merge tag 'timers-vdso-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull VDSO updates from Thomas Gleixner:

 - Consolidate the VDSO datastore further and provide support for
   mlock_all() and prefaulting.

 - Provide 32-bit legacy time related functionality only if
   CONFIG_COMPAT_32BIT_TIME is enabled. The config switch exists,
   but architecture code still exposes the legacy functionality even
   disabled.

   Clean this up by adding the missing guards and validating at build
   time that the VDSO is legacy free if disabled.

 - Consolidate the VDSO related config options in core and drivers,
   which removes some non-sensical dependencies and quite an amount of
   #ifdeffery.

 - Clean up the PAGE_SIZE definition maze

* tag 'timers-vdso-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits)
  random: vDSO: Drop custom PAGE_SIZE definitions
  LoongArch: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
  clocksource/drivers/timer-riscv: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
  clocksource/drivers/arm_arch_timer: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
  clocksource/drivers/mips-gic-timer: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
  MIPS: csrc-r4k: Remove CONFIG_GENERIC_GETTIMEOFDAY ifdeffery
  vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
  kbuild: Support generated asm-headers in subdirectories
  vdso: Rename HAVE_GENERIC_VDSO to VDSO_DATASTORE
  vdso: Drop HAVE_GENERIC_VDSO from architecture kconfig files
  vdso: Automatically select HAVE_GENERIC_VDSO if necessary
  MIPS: vdso: Stop using CONFIG_HAVE_GENERIC_VDSO
  vdso: Remove the dependency on HAVE_GENERIC_VDSO from ARCH_HAS_VDSO_ARCH_DATA
  futex: Remove dependency on HAVE_GENERIC_VDSO from FUTEX_ROBUST_UNLOCK
  vdso/gettimeofday: Verify COMPAT_32BIT_TIME interactions
  sparc: vdso: Respect COMPAT_32BIT_TIME
  MIPS: VDSO: Respect COMPAT_32BIT_TIME
  powerpc/vdso: Respect COMPAT_32BIT_TIME
  ARM: VDSO: Respect COMPAT_32BIT_TIME
  arm64: vdso32: Respect COMPAT_32BIT_TIME
  ...
2026-08-18 16:56:25 -07:00
Linus Torvalds
3b4128b9f3 Timers and timekeeping core updates:
- Fix a subtly inconsistency in the timekeeping code, which fails to
     account for the monotonicity adjustment in ntp_error. For small changes
     of the clocksource multiplicator (+/-1) which are typically used by the
     NTP PLL this is hardly to observe. But for larger adjustments,
     e.g. caused by a direct frequency setting through adjtimex() the
     one-time uncompensated offset is significant.
 
     Cure this by adjusting ntp_error with the resulting offset so that the
     discrepancy is smoothed away over time
 
   - Make tick length calculations correct in NTP. The timekeeping core
     takes the quantisation of the clocksource into account when calculating
     the tick length to compensate for the deviation of the nominal
     NTP_INTERVAL_LENGTH. While timekeeping gets this right, NTP is not
     aware of that, which means it operates on the nominal value and not on
     the actual value which is determined by the clock source frequency. The
     rounding of a coarse clocksource like the ACPI PM timer results in a
     +127 PPM deviation.
 
     Cure this by exposing the deviation to the NTP code so that it can
     operate on the same data as the timekeeping core. This is purely kernel
     internal. User space still sees the nominal tick lenght via adjtimex().
 
   - The accuracy of the NTP adjustments is fairly approximate as the code
     assumes that the invocations are precisely in NTP interval frequency
     ticks and the final adjustment can over and under-run.
 
     Cure this by adjusting ntp_error by the intended skew on each tick to
     achieve the desired rate.
 
   - Handle the two competing skews of time offset and time adjustment
     correctly by calculating the conflict portion between the skews and
     adjusting both accordingly.
 
   - A set of updates and improvements for the selftests
 
   - The usual small fixes and improvements all over the place
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqCwxwQHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoaOwD/45XBW2s5/L+GSy52r/APrzYOqgjYQdn2UQ
 XI85iTjDqg9sfZQNFbr7toJ84gY/wQ0ZxykLMi+LlOSZVe5azSepoUHMg9XGk8S0
 4kI+GLznmnDLFypTezpzk3DUgNgu8rhOYvPsgwQEgx0DuzWHRZgNoNDk4AfJ8HP6
 8cRgPIJ7CpIbP7/p0Kc5IjW3ybo849wBirl7ZDxNRRao+Dkc56ArZvSfQgnQu5Kw
 D3Ei+AFcxpBQ2GEJT4Z/92yNf1x2AXjkhfijgO6hIFzPAR+c049fG5sgneo3GoLQ
 riduEPQHvoiJO3gVGzoICF2DAuVOwMHwIBlGtNEDd+FcMAvMU4V3lQi8lJV+9CpH
 SJwa5R6KJHg2aTuoPup8lmfJN7BqmthrkZwcYVrv2Ikt5yWGYuoW0/e00So9IfUO
 R7UG/VlruckK+T0GCuKBAAfm/+zm6Sbir+4liPDZwDz4dW2lkvkZnAb6xHPCev8S
 ioYL/Jqr3GmIMgK7UelUkQ/gy5YCek89JAszdlD+blLAjUMcDeYsZaAN9rSdjzSu
 dbEA4Hze6Q8HpIW35bHkytyyjNNhvL6xobjKBNRuOPUHTFMe+s5itMApRlhsu32J
 6EL/D1TuwkiHlqaSek7ZqUAiitZoNWxa1NyreM9EuZ7qWPjUWOzlsDXkP2v298+t
 p27xt+/8sA==
 =prJt
 -----END PGP SIGNATURE-----

Merge tag 'timers-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer and timekeeping core updates from Thomas Gleixner:

 - Fix a subtly inconsistency in the timekeeping code, which fails to
   account for the monotonicity adjustment in ntp_error.

   For small changes of the clocksource multiplicator (+/-1) which are
   typically used by the NTP PLL this is hard to observe. But for larger
   adjustments, e.g. caused by a direct frequency setting through
   adjtimex() the one-time uncompensated offset is significant.

   Cure this by adjusting ntp_error with the resulting offset so that
   the discrepancy is smoothed away over time

 - Make tick length calculations correct in NTP.

   The timekeeping core takes the quantisation of the clocksource into
   account when calculating the tick length to compensate for the
   deviation of the nominal NTP_INTERVAL_LENGTH.

   While timekeeping gets this right, NTP is not aware of that, which
   means it operates on the nominal value and not on the actual value
   which is determined by the clock source frequency. The rounding of a
   coarse clocksource like the ACPI PM timer results in a +127 PPM
   deviation.

   Cure this by exposing the deviation to the NTP code so that it can
   operate on the same data as the timekeeping core. This is purely
   kernel internal. User space still sees the nominal tick lenght via
   adjtimex().

 - The accuracy of the NTP adjustments is fairly approximate as the code
   assumes that the invocations are precisely in NTP interval frequency
   ticks and the final adjustment can over and under-run.

   Cure this by adjusting ntp_error by the intended skew on each tick to
   achieve the desired rate.

 - Handle the two competing skews of time offset and time adjustment
   correctly by calculating the conflict portion between the skews and
   adjusting both accordingly.

 - A set of updates and improvements for the selftests

 - The usual small fixes and improvements all over the place

* tag 'timers-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (58 commits)
  selftests: timers: nsleep-lat: Check all calls to clock_nanosleep() and clock_gettime()
  selftests: timers: nsleep-lat: Reuse kselftest error numbers
  selftests: timers: nsleep-lat: Explicitly list the tested clocks
  selftests: timers: nsleep-lat: Use NSEC_PER_MSEC define for unreasonable latency
  selftests: timers: nanosleep: Report each test separately
  selftests: timers: nanosleep: Explicitly handle timer_delete() failure
  selftests: timers: nanosleep: Move all single clock tests out of the loop in main()
  selftests: timers: nanosleep: Reuse kselftest error numbers
  selftests: timers: nanosleep: Explicitly list the tested clocks
  selftests: timers: nanosleep: Drop output alignment
  selftests: timers: Use clock_name() and constants from clock-helpers.h
  selftests: Add clock-helpers.h
  timer_list: Use ktime_t over nanoseconds
  timer_list: Use standard 'long long' format placeholders
  hrtimer: Add a lockdep assertion to hrtimer_update_base()
  timekeeping: Use u32 for clock_was_set_seq
  timekeeping: Rename clockid_aux_valid() to clockid_is_aux_clock()
  hrtimer: Account nr_retries on recovered interrupt retries
  timers/itimer: Zero-init old itimerval before copy to userspace
  nohz: Replace dead select with choice default
  ...
2026-08-18 16:23:56 -07:00
Linus Torvalds
0dd1a54f44 SMP core updates:
- Reduce the preemption disabled sections in smp_call_function*().
 
     The various smp call functions keep preemption disabled accross the
     full operation which includes the wait for completion. Especially the
     latter can take some time when one of the target CPUs is not
     immediately responding to the IPI, which can result in large latency
     spikes.
 
     To improve this provide a per task CPU mask to track the CPUs to wait
     for. That makes the information required for the wait task local and
     therefore allows to reenable preemption before the wait. While this
     comes with moderate extra memory cost this reduces SMP function call
     induced latency measured in a fleet for high priority tasks from ~17ms
     to ~1.5ms (~90%).
 
   - Reduce the overhead of the CSD debug code by replacing the heavy memory
     barriers with smp_store_release()/acquire().
 
   - Remove obsolute unused hotplug states
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqC7pcQHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoTL1D/9dgn7nuKCC4iwnihq2gZnM39780kNgsRCB
 9lAGAEEr1u2iciYIA+oXMqVLBGqrOkpCNMcChUqnyrH5H0coOgDFICTWTM4qLZxi
 ujPRcbwRDFqoHrd7PcHb7z6z9OIyiUQBRbQAJjk6+QnfA6IDbqcYB9RI2FrEexfG
 Wojl2VX1vITd4q55bhSdbUHHYm+QOP5cpBfUSkS1QjkH577kCJ0kkLhYg/8fuakr
 w1RaqU35I0W6z0AOh709vLxvchb60rMMX5/UkDHrRJx11gceimpQ+MTaz3PvZZmK
 djzCip9mLcZryP5bgdfJTVTGtEaQj0ggnDMmi2MiAuJhcvqokjaZpYfH/+wiNDuh
 vaNK+oZx9E3A3AKXs7MeXm9vqSh+nEHN4UcXosdT+gZqGrHTh4Mj4MT0gDwDzXXY
 A8WB3K95PJkucaqtXU+6bZZeVj7Pzc8tXySr7GUlxRipW/6ZJsz99s+mIG4zvMjo
 Y11pJIH7PLhnuAffMdgpmuQfiq6DKaGCjvWertB4TZPm+l/aBMvoA1QZbfNrUUPp
 Gf/IMHqcb3fmurgChn1bSlm9HDktjPzlmLWhHaVDJFrYZLYmbIzXzUNQCrBAuPQW
 Ui8BBOE2c5sn8bO411rxFOK3JETH/BBCNxmY4YQZAlU0na2/rVJ7ofKhT3zKMijd
 3M6BaQAxsw==
 =0b4v
 -----END PGP SIGNATURE-----

Merge tag 'smp-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull SMP core updates from Thomas Gleixner:

 - Reduce the preemption disabled sections in smp_call_function*().

   The various smp call functions keep preemption disabled accross the
   full operation which includes the wait for completion. Especially the
   latter can take some time when one of the target CPUs is not
   immediately responding to the IPI, which can result in large latency
   spikes.

   To improve this provide a per task CPU mask to track the CPUs to wait
   for. That makes the information required for the wait task local and
   therefore allows to reenable preemption before the wait.

   While this comes with moderate extra memory cost this reduces SMP
   function call induced latency measured in a fleet for high priority
   tasks from ~17ms to ~1.5ms (~90%).

 - Reduce the overhead of the CSD debug code by replacing the heavy
   memory barriers with smp_store_release()/acquire()

 - Remove obsolute unused hotplug states

* tag 'smp-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  scftorture: Remove preempt_disable() in scftorture_invoke_one()
  smp: Remove preempt_disable() from on_each_cpu_cond_mask()
  smp: Remove preempt_disable() from smp_call_function()
  smp: Enable preemption early in smp_call_function_many_cond()
  smp: Alloc percpu csd data in smpcfd_prepare_cpu() only once
  smp: Use task-local IPI cpumask in smp_call_function_many_cond()
  smp: Refactor remote CPU selection in smp_call_function_any()
  smp: Enable preemption early in smp_call_function_single()
  smp: Disable preemption explicitly in __csd_lock_wait()
  cpu/hotplug: Remove CPUHP_AP_ARM_CORESIGHT_CTI_STARTING
  smp: Use release stores for csd_lock_record() state
2026-08-18 15:29:53 -07:00
Linus Torvalds
b844715e8a Futex updates:
- A set of improvements to various futex self tests
 
     - Conversion to the selftest harness
 
     - Provide and use thread creation and synchronization helpers to reduce
       the dependency on delays, which tend to fail on loaded test systems
 
     - New tests for validating owner exit scenarios for robust and PI futexes
 
     - Runtime detect supported features and skip the tests if the kernel
       has no support
 
     - A few minor fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqC2iUQHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoTPBD/4sMc+o2TiWn4bf7vcoln3XlVA8oWkiJCIB
 UUIW1n77CTK9jF50/xb77uvDvSHYr7Zx/Gm1QOvz/xdMvbgqUtPCExBoQXEz/1VV
 y+s7x3K4pwI7BLzEPNsvC2kN0+cVisMXdCi5C5ot7xo3AilfcxxSIwauGyEdQuqZ
 ArvVJjaBCXjRE1EtaVTeiGSINeR4kWPohOkH7dou/OISSd+EcA1kOsTrWlgVa2AA
 o7Vy4u5VsYK7m+UVZUYmwf7+pU91iDj0FZ9fMYYskOw5F+Xax4seNO4bozre80LJ
 3LE2aB8Rg5qGYCTL3D54O1c/2wczJueqGPHy+bF9SOOdlzo0N4Ro8wYUa3MmQuY5
 8+JyfFOsFcqflCYFK/ketzu3JrlZdu8DV9pJ67+RIKpHIXG5VRZHBDDrkL60PF7x
 TQoaZ57sOP7e5GJ+ByxxkltPuXGsIILcPytZoTtm6NwQIh2eSOtPSEPh9VprSChn
 vhY50WJuZ6L//Z7YQfXPQ9B7Xe+39OIWgY1GnUKF09BNVx6V4/As7Nc8llH+7cR7
 eyiVqs0uRDlnpe5zQkAj0hdYR9WK/XVAQ26rsHZDJnSnoalJbl2AjdH1FIg8xm7n
 0PPKqr3hZC4lilpwoBXXPQLIOBKNAUXZpVWxEopGSFIZ5tdrcnNcxgYFMuKiN5cQ
 glxSVQVl0g==
 =6VmJ
 -----END PGP SIGNATURE-----

Merge tag 'locking-futex-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull futex updates from Thomas Gleixner:

 - Improvements to various futex self tests:

    - Conversion to the selftest harness

    - Provide and use thread creation and synchronization helpers to
      reduce the dependency on delays, which tend to fail on loaded test
      systems

    - New tests for validating owner exit scenarios for robust and PI
      futexes

    - Runtime detect supported features and skip the tests if the kernel
      has no support

 - A few minor fixes

* tag 'locking-futex-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  selftests/futex: Give circular-list nodes static storage
  selftests/futex: Use thread synchronization helpers instead of usleep()
  selftests/futex: Provide thread creation and synchronization helpers
  selftests/futex: Dynamically skip unsupported tests
  selftests/futex: Add FUTEX_LOCK_PI owner-exiting coverage
  selftests/futex: Migrate robust_list to harness
  selftests/futex: Migrate futex_priv_hash to harness
  selftests/futex: Migrate futex_numa_mpol to harness
  selftests/futex: Migrate futex_requeue_pi_signal_restart to harness
  selftests/futex: Migrate futex_requeue_pi_mismatched_ops to harness
  selftests/futex: Migrate futex_requeue_pi to harness
  selftests/futex: Migrate futex_requeue to harness
  selftests/futex: Migrate futex_wait_uninitialized_heap to harness
  selftests/futex: Migrate futex_wait_private_mapped_file to harness
  selftests/futex: Migrate futex_wait to harness
  selftests/futex: Correct validation logic in waitv
  selftests/futex: Migrate functional tests to harness
  selftests/futex: Remove static keyword from 'head'
  futex: Remove unnecessary NULL check before kvfree()
  selftests/rseq: Replace glibc-specific __GNUC_PREREQ with portable check
2026-08-18 15:26:35 -07:00
Linus Torvalds
762fffa407 Generic interrupt subsystem updates:
- Remove pointless NULL checks of the kstats_irqs field. That's a
    historical left over and not longer required.
 
  - Add Radu Rendec as reviewer. Radu thankfully stepped up to help
    reviewing the interrupt core and the related drivers code.
 
  - The usual small improvements and fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqCtM8QHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoV4SD/465axAMEli+6LbBcxWVmX1SCUasn+VM/2g
 VUUPONEDuf/Ucig+OC1QlvfZ/5d9pLiIwh3TakWPbkFtZpyfi60KiEQw5OW67TYB
 5TYgJI8BquIAQGzjUCKIzZmEvQhbuJzRjz07CIZnCtQBK3b/ftSDCwm6ynhhYRQC
 5yX/ay84pHPCyWVupkXV8jwjFm6v28U17j8TVd2VwEIOrEBa8dbOxOqUlRzrjbwE
 2dmo7r3BPSpyI/VpYiOW3wEXYq03+sR3MTNXQ9VWqLVcaUJUdDnbTnXqMbaXpGcO
 oV4vnuPv2Ah2TkB8xF9KTcyCKJbS2BKb5BtUXEJBQ/kPnB1wD712N2oZNuaN3omF
 SM4QoWojDpNPrPYWG99T4sNbemxfiyhIJzPSE/SgE6g0cWxh3d3wh5VfOnkp4ige
 gZKHVz7EcpjcyVz4xgYhaZk+7FmzAb6FMi4UhLZ9KHbAhdH87LSDDxvcUua2X3Js
 v1RdV3pkH1M3tBcLfO0D1neGL4VCL9zs8Ldf0jJBvcOy8kmjcs4uCll54hEbCQwI
 N7Qt7JF/r1LwxJRMC4OzsXp2upCbT5gaCOeG2HJuQUSy//0RL72NzjQe4cJSw5ya
 5Xnv5d/6L+hnwkOo7LPp9JYORXZ673D/vQgBg9Nf64Iz0i9SWnNB/fsmiSoTjw/c
 ZmqKGgEyHA==
 =6wX8
 -----END PGP SIGNATURE-----

Merge tag 'irq-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull generic interrupt subsystem updates from Thomas Gleixner:

 - Remove pointless NULL checks of the kstats_irqs field. That's a
   historical left over and not longer required.

 - Add Radu Rendec as reviewer. Radu thankfully stepped up to help
   reviewing the interrupt core and the related drivers code.

 - The usual small improvements and fixes

* tag 'irq-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  MAINTAINERS: Add Radu Rendec as reviewer for the interrupt subsystem
  genirq/msi: Move misplaced EXPORT_SYMBOL_GPL for msi_domain_free_irqs_all()
  parisc: Remove unnecessary NULL check of the kstat_irqs field
  genirq: Remove unnecessary NULL check of the kstat_irqs field
  irqdomain: Remove unnedded NULL check in __irq_domain_[de]activate_irq()
  genirq/manage: Use irqd_get_parent_data() helper in __irq_get_irqchip_state()
  irqdomain: Plug leak in irq_domain_alloc_irqs_locked() error path
2026-08-18 15:19:50 -07:00
Linus Torvalds
3424d8c18a Generic entry code updates:
- Make syscall user dispatching configurable
 
     Not all architectures can makes use of syscall user dispatching. Allow
     them to disable the feature completely.
 
   - Consolidate stack randomization for the generic entry code and the
     architectures using it.
 
     Stack randomization on syscall entry was sprinkled throughout the
     architecture specific low level entry code and in some cases at the
     wrong points, e.g. before establishing state, which violates the
     non-instrumentable constraints of that code.
 
     Clean this up by integrating stack randomization into the generic entry
     code helpers so that it is invoked at the earliest possible point right
     after establishing state and converting all generic entry code using
     architecture over.
 
   - Clean up the syscall number handling in the generic entry code. It
     works correctly for architectures which have a separate return value
     storage in pt_regs, but fails to distinguish the case where user space
     handed in -1 as syscall number from the case where the entry code
     rejects it by returning -1 to the callers. Aside of that the return
     value functionality of those interfaces is not really intuitive.
 
     Fix this by separating the decision to reject a syscall (user dispatch,
     ptrace, seccomp ...) from the potential modification of the syscall
     number through these mechanisms.
 
     This solves most of the problems for architectures which do not have a
     separate return value storage in pt_regs except for the case where a
     tracepoint has a BPF script or a probe attached which overwrite both
     the syscall number and the return value. But that's a problem which
     cannot be solved in the generic code, that only can be addressed by
     separating the storage model in the affected architectures.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqCs10QHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoaf6D/0ZBG1Yb0/C/6lrI185qPu38aGOROuAcxP+
 RV1O1x6C83w2hCLBH8LeswY2x4/iGbdftne/hfmvu8eNCE5MzBfYvXhLL4If75Tc
 IJ6C8uummnDmrT1TFuWHryTAfjyF28gt0+GGq0Zy5Hyz9b4CTJqOMx5u6KV4cZuJ
 odoNQpE/GlWo40wCSTYP/Tt5xONrogk2pMQtFyV8JEoaXkdYSj/V815yojEmofYU
 fmgPPO5/vOnZzE4b29gZyndXnU1Boah7r1l5fg7c9za376yCEEzh/ApPhovHyY0A
 t8zjnrtooZ27IUKbcsyycrAM14asfcmViDNDgaCj8ttBioQaCnxO1BpKWjVxEZhE
 AbM6q3Q66ER4Df6GNhZjPqT5Lr7E7+vLLarhXLWztsGQklIx4AFbrsa73hA20UC9
 1PSeMd45JSxH3yA8vMauXAGHFK1tD1V8Lgofu69+2Z3jtKB+aU0fqWeL1jesSEM0
 oCGhUb3hIC1pz3KVA0MGmNTm0yyQJYTGZL7wADYNV5NbxJVqXgo37qa/0n94Gf/4
 TG3OwY4Sb/H/sve7v/eY4IvxVh+xs3dLZP8ZoqMlPCp9JIxc6iNoe6VHqPI7PFnM
 fXwDtsy+bRF/SKnB/32qxnR7UJqmdNH3XIjd+lXWliKt6UYoC79/MEKN5DmJcO9P
 CykZUWa72A==
 =XUd9
 -----END PGP SIGNATURE-----

Merge tag 'core-entry-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull generic entry code updates from Thomas Gleixner:

 - Make syscall user dispatching configurable

   Not all architectures can makes use of syscall user dispatching.
   Allow them to disable the feature completely.

 - Consolidate stack randomization for the generic entry code and the
   architectures using it.

   Stack randomization on syscall entry was sprinkled throughout the
   architecture specific low level entry code and in some cases at the
   wrong points, e.g. before establishing state, which violates the
   non-instrumentable constraints of that code.

   Clean this up by integrating stack randomization into the generic
   entry code helpers so that it is invoked at the earliest possible
   point right after establishing state and converting all generic entry
   code using architecture over.

 - Clean up the syscall number handling in the generic entry code. It
   works correctly for architectures which have a separate return value
   storage in pt_regs, but fails to distinguish the case where user
   space handed in -1 as syscall number from the case where the entry
   code rejects it by returning -1 to the callers. Aside of that the
   return value functionality of those interfaces is not really
   intuitive.

   Fix this by separating the decision to reject a syscall (user
   dispatch, ptrace, seccomp ...) from the potential modification of the
   syscall number through these mechanisms.

   This solves most of the problems for architectures which do not have
   a separate return value storage in pt_regs except for the case where
   a tracepoint has a BPF script or a probe attached which overwrite
   both the syscall number and the return value. But that's a problem
   which cannot be solved in the generic code, that only can be
   addressed by separating the storage model in the affected
   architectures.

* tag 'core-entry-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  entry, treewide: Make syscall_enter_from_user_mode[_work]() indicate syscall execution
  entry: Make return type of syscall_trace_enter() bool
  entry: Rework trace_syscall_enter()
  entry: Rework syscall_audit_enter()
  syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
  entry: Fix seccomp bypass after ptrace with TSYNC
  x86/entry: Simplify the syscall number logic
  x86/entry: Get rid of the sys_ni_syscall() indirection
  x86/entry: Make syscall functions static
  ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry()
  seccomp, treewide: Rename and convert __secure_computing() to return boolean
  entry: Use syscall number instead of rereading it
  entry: Remove syscall_enter_from_user_mode()
  x86/syscall: Use [syscall_]enter_from_user_mode_randomize_stack()
  s390/syscall: Use enter_from_user_mode_randomize_stack()
  riscv/syscall: Use syscall_enter_from_user_mode_randomize_stack()
  powerpc/syscall: Use syscall_enter_from_user_mode_randomize_stack()
  loongarch/syscall: Use syscall_enter_from_user_mode_randomize_stack()
  entry: Provide [syscall_]enter_from_user_mode_randomize_stack()
  randomize_kstack: Provide add_random_kstack_offset_irqsoff()
  ...
2026-08-18 15:00:56 -07:00
Linus Torvalds
e2457a664e Scheduler updates for v7.3:
Load-balancing updates:
 
  - Series to 'flatten the pick': improve cgroup scheduling, which has
    always been problematic and painful, which has caused various
    scheduling misbehavior such as the mishandling of reniced tasks et al.
    Add various cgroup weight distribution methods via cgroup_mode:
    'up', 'max', 'concur' and 'tasks' - with the default being 'concur'
    which is the most precise yet also most expensive version.
    Finally, change cgroup scheduling to a single runqueue.
    (Peter Zijlstra)
 
  - Series to improve the scheduling latency of short slice tasks
    (Vincent Guittot)
 
  - Series to fix cluster scheduling in the presence of asymmetric capacity
    (Ricardo Neri)
 
  - Prefer fully idle cores for NOHZ balancing (Andrea Righi)
 
  - Don't trigger active load-balancing if src_rq->curr is not on_rq
    (Xin Zhao)
 
 PSI updates:
 
  - Skip irqtime accounting when no new irq time has elapsed
    (Usama Arif)
 
 Scheduler debugging updates:
 
  - Remove unused schedstats (Shrikanth Hegde)
 
  - Defer freeing of cpumask memblock memory to initcall
    (Waiman Long)
 
 Misc fixes and updates by Yu C Chen, K Prateek Nayak, Peter Zijlstra,
 Vincent Guittot, Xin Zhao, Yury Norov, Zhan Xusheng.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqC3WARHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1hawRAAuVAreXtsp7Ok6aRHmiOMR+Va2EsHIL4B
 3MY5do2oUfiJSCDtIn3BXqjM3djOXdbQLQwm6r9/NkyJ6hsOsRgZaP1L/w07FiY0
 33ilIhZIH9QZ2RzvEjZcFXVwnWH6zP8Ag/gTsch3g8TIX2JJcZBzcJjQM8ZIdcBL
 oxwWNe9z3Mh0/x2N+N/s1xstaZf95bWQKeBVBGjiOAakGRWMEaQmMtOUujJNmx/p
 YFtNcJL6pLGfD+ASOtLxYWts4z1JyDmwvje8SZmRsgjZdhoxRlnEIgU6jrNjmPqu
 NfR5w6R193Pa+FapawYi0ttuawapHvvSDDUxjl+eIccPMw0mBdjzn1XuNIt6pclC
 Q4VDUQEDBYvbeznNfLuvvsLVBq/QIjim391lg9DuAGreuRx00Ij0hXOCPk6TM4H8
 tfUZ8N25vIAbYrFajSDyOYdgAa2Z2VnM1Q1ko29LPb3WFfZsEqgIg7+ukoXCZ5n8
 67pUrOYLuSlLXJGlJY9WDz1nbeUh3e0f2390fif3VBcQ7roPEmoL8CYZhh8Vd2rq
 ug8kOpL/91/PDgSPbxRRIEYhe9X1kzWZxqpjvO93tZ+GhXUxtLFG4PjnbQhINy1A
 BMNlxcq4ktVHk9gwLaG9wcySjINnN/wK91o3dQ9YjwTuCAxFi/AqUVjY+OOmguAh
 TO0mkEq99M0=
 =HTPk
 -----END PGP SIGNATURE-----

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

Pull scheduler updates from Ingo Molnar:
 "Load-balancing updates:

   - 'flatten the pick': improve cgroup scheduling, which has always
     been problematic and painful, which has caused various scheduling
     misbehavior such as the mishandling of reniced tasks et al.

     Add various cgroup weight distribution methods via cgroup_mode:
     'up', 'max', 'concur' and 'tasks' - with the default being 'concur'
     which is the most precise yet also most expensive version.

     Finally, change cgroup scheduling to a single runqueue (Peter
     Zijlstra)

   - Series to improve the scheduling latency of short slice tasks
     (Vincent Guittot)

   - Series to fix cluster scheduling in the presence of asymmetric
     capacity (Ricardo Neri)

   - Prefer fully idle cores for NOHZ balancing (Andrea Righi)

   - Don't trigger active load-balancing if src_rq->curr is not on_rq
     (Xin Zhao)

  PSI updates:

   - Skip irqtime accounting when no new irq time has elapsed (Usama
     Arif)

  Scheduler debugging updates:

   - Remove unused schedstats (Shrikanth Hegde)

   - Defer freeing of cpumask memblock memory to initcall (Waiman Long)

  Misc fixes and updates by Yu C Chen, K Prateek Nayak, Peter Zijlstra,
  Vincent Guittot, Xin Zhao, Yury Norov, Zhan Xusheng"

* tag 'sched-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
  sched/fair: Fix flat hierarchy
  sched/isolation: Defer freeing of cpumask memblock memory to initcall
  sched/topology: Restore SD_PREFER_SIBLING in domains with asymmetric capacity
  sched/fair: Allow load balancing between CPUs of identical capacity
  sched/fair: Skip misfit load accounting when the destination CPU cannot help
  sched/fair: Check CPU capacity before comparing group types during load balance
  sched/fair: Also gate overloaded status update for SD_ASYM_CPUCAPACITY
  sched/fair: Do not skip CPUs of similar capacity with busy SMT siblings
  sched/fair: Prefer fully idle cores for NOHZ balancing
  stop_machine: Make stop_one_cpu_nowait() return void
  sched/eevdf: Delayed dequeue task can't preempt
  sched/fair: Fix stale comments referring to removed CFS concepts
  sched/debug: Remove unused schedstats
  sched/psi: skip irqtime accounting when no new irq time has elapsed
  sched/fair: Reflow sched_balance_rq()
  sched/fair: Simplify balance_interval reset logic in sched_balance_rq()
  sched/fair: Don't trigger active lb if src_rq->curr is not on_rq
  sched/eevdf: Speedup short slice task scheduling
  sched/eevdf: Always update slice protection
  sched/eevdf: Cancel slice protection if short slice task is eligible
  ...
2026-08-18 13:39:48 -07:00
Linus Torvalds
dfa35434d7 Locking updates for v7.3:
Futexes:
 
  - Use runtime constants for futex_hash computation
    (K Prateek Nayak, Peter Zijlstra)
 
  - Optimise the size check get_futex_key() (Sebastian Andrzej Siewior)
 
  - Avoid private hash use-after-free on final put (Felix Hoffmann)
 
  - Tell kmemleak we're not leaking __futex_queues (Peter Zijlstra)
 
 Rust integration updates:
 
  - Implement refcounted interrupt disable and SpinLockIrq for Rust
    (Boqun Feng, Heiko Carstens, Joel Fernandes, Lyude Paul)
 
  - Rust sync: add helpers for mb, dma_mb and friends;
    add generic memory barriers and use LKMM atomics
    instead of Rust atomics in the revocable code (Gary Guo)
 
  - Add abstraction and integrate synchronize_rcu() (Philipp Stanner)
 
 Lock debugging:
 
  - Add qspinlock contended_release tracepoint
    (Dmitry Ilvokhin, Peter Zijlstra)
 
  - Enable the printing of held locks of remote running tasks and print
    task CPU (Ingo Molnar)
 
  - percpu-rwsem: Annotate intentional data race in readers_active_check()
    (Sun Shaojie)
 
 Misc fixes and updates by Boqun Feng, Peter Zijlstra, Fangrui Song,
 Naveen Kumar Chaudhary and Thomas Huth.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqC2KMRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1gNwg//awvTQONfhPanAyTgl7CLDSlMSHdqmlyh
 Ue0/Q8Ef1Cy4jwXY2FE2A0b1VcM6cGpDPoryVdg/wMdUXRNwinzAEXmxIkRy9kve
 4LybrZwDShgLxJ7pJ6KKhgjgDiat8EdYmOwCBEE3LnP7AYhkAb8BFetA3YZJvzPa
 KfA2BRYCgvBTid6yOAuXWm55Ev92AczOBamBzTxCadcaDGtNGXtQO6LfnqiQDOav
 X5tVoANBeaQtSs1+LxE41WdNOiRoBuy0IFFvXtZRal6PZYuGGmZ5tbQvscD099em
 haVwQyzDHQrqzglv71M0KRTXvYzdGveMRg/Au1SQnuLO3V6Vd5rMQ1g7I2M9Ln0f
 Pg+tlRvQ77mLoqcgrtl0W/u0fRR4eDkiJ1pmG+98oniPwau23RdbFhC0vKFz3ikF
 WHMgk3/9TcULylgF1Tj6QLmNrBY3Vx8LBdsFjhflEw7bG4cW42D91npmXIiEDE6K
 tJc9CcaVdyE75o59z2Dtjj+qQVBlNPlfKQFXFL7p3jU/gFw2SzYuqon66X3kGmr0
 mKJ9UNJdkLdiCjxS/QiMcDeYhwJksJqxFBkH50z3Kzmo84JsSpUFkoa6GM4aSiGn
 HEwgC0Q7oOXVNIKUBYk5QaRW0HSk55hbsX2TWkvpeBYkE1zXshVZCCmgpaTSJgb5
 oFmiwrGfUjo=
 =slqC
 -----END PGP SIGNATURE-----

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

Pull locking updates from Ingo Molnar:
 "Futexes:

   - Use runtime constants for futex_hash computation (K Prateek Nayak,
     Peter Zijlstra)

   - Optimise the size check get_futex_key() (Sebastian Andrzej Siewior)

   - Avoid private hash use-after-free on final put (Felix Hoffmann)

   - Tell kmemleak we're not leaking __futex_queues (Peter Zijlstra)

  Rust integration updates:

   - Implement refcounted interrupt disable and SpinLockIrq for Rust
     (Boqun Feng, Heiko Carstens, Joel Fernandes, Lyude Paul)

   - Rust sync: add helpers for mb, dma_mb and friends; add generic
     memory barriers and use LKMM atomics instead of Rust atomics in the
     revocable code (Gary Guo)

   - Add abstraction and integrate synchronize_rcu() (Philipp Stanner)

  Lock debugging:

   - Add qspinlock contended_release tracepoint (Dmitry Ilvokhin, Peter
     Zijlstra)

   - Enable the printing of held locks of remote running tasks and print
     task CPU (Ingo Molnar)

   - percpu-rwsem: Annotate intentional data race in readers_active_check()
     (Sun Shaojie)

  Misc fixes and updates by Boqun Feng, Peter Zijlstra, Fangrui Song,
  Naveen Kumar Chaudhary and Thomas Huth"

* tag 'locking-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (44 commits)
  rust: sync: Introduce SpinLockIrq::lock_with() and friends
  rust: sync: Add SpinLockIrq
  rust: sync: Use super::* in spinlock.rs
  rust: helper: Add spin_{un,}lock_irq_{enable,disable}() helpers
  rust: Introduce interrupt module
  s390/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS
  arm64: sched/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS
  preempt: Introduce HAS_SEPARATE_PREEMPT_RESCHED_BITS
  sched: Avoid signed comparison of preempt_count() in __cant_migrate()
  sched: Remove the unused preempt_offset parameter of __cant_sleep()
  locking: Switch to _irq_{disable,enable}() variants in cleanup guards
  irq: Add KUnit test for refcounted interrupt enable/disable
  irq,spin_lock: Add counted interrupt disabling/enabling
  openrisc: Include <linux/cpumask.h> in smp.h
  preempt: Introduce __preempt_count_{sub,add}_return()
  preempt: Introduce HARDIRQ_DISABLE_BITS
  preempt: Track NMI nesting to separate per-CPU counter
  futex: Tell kmemleak we're not leaking __futex_queues
  x86/paravirt: Trace contended_release on unlock
  tracing/lock: Use TRACE_EVENT_FN() for contended_release
  ...
2026-08-18 13:07:17 -07:00
Linus Torvalds
8915457146 Performance events updates for v7.3:
uprobes updates:
 
  - Patch series to fix a category of bugs with optimized uprobes that
    can clobber the redzone area with call instruction storing return
    address on stack where user code may keep temporary data without
    adjusting RSP. Fix this by moving the optimized uprobes on top of
    10-bytes NOP instruction, so we can squeeze another instruction to
    escape the redzone area before doing the call.
    (Jiri Olsa, Andrii Nakryiko)
 
  - Switch uretprobes_srcu to SRCU-fast-updown, to improve performance
    (Puranjay Mohan)
 
 Intel CPU PMU driver updates:
 
  - Optimize ACR handling in match_prev_assignment() (Dapeng Mi)
  - Patch series to fix various PMU driver bugs and data leaks (Dapeng Mi)
  - Fix Intel PT stop/start with no update (Adrian Hunter)
 
 Intel uncore PMU driver updates:
 
  - Series to fix various uncore PMU setup robustness bugs (Zide Chen)
 
 AMD uncore PMU driver updates:
 
  - Add group validation (Sandipan Das)
 
 Misc fixes and updates by Dapeng Mi, Randy Dunlap and Zide Chen.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqC1G0RHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1gMehAAh/p3A42YKWgcEjnlmCTJ+RTGTrLbL/OB
 Q2uj4H9D32lBV8+ZyBjt3iVT5u8Z3pliUMAq4yaLua6SiWO4gbb/XLp7K9tnHSj9
 J/9zvOdxC74ZmnuKYzcjmSAFzYL0VmfHoHUMXNKEqjP/cfZnlp7Zhs7n0s+aEt9h
 IzkgzUt3maY7xjXnBXiHHmIvOrGt5i2avXFJxUeE6YPnRjUK6+8b8jzJTsvL7GrM
 lVTG7D0ptRELVKpgvbHWAK4738Oxls0tB6KmEHO+lMwM5i2OFy/Xs3PxX7Z6ruII
 3+RUAk9K8MNpxG+eIUzBs+Qu3a3cS/bAMS4LiD+oKSg0OxAbnvRey1l0uQOZLevb
 UUG3mNMpOJ0rfQIBMT0FhJZ7Rk6V0XRCfjyXnrZhfjCa879g+GPxrHoSAVjMa0PG
 S1y51mj5QNeXwMi7U9Pwl88GF2TLsxj1kNlpgMrFfZywjXD5wp2Oqd6s+fVuFk/X
 5FuUcY7evchxXjlfrYM84gtBBklVeOmd4yrqAGmhM5LUoFBCTt6HPzzn8U9Z8BIm
 qZvtSsZ4/FGQPNrAbGXXQ1tWxxP+g0HeRYmyxoj2n6Xpope8vDdWzs/cA1NeG9Dl
 4sbwkiOmWUCBniR05oTTCFtSejnr3UIq/H/ulUJRSRHocGaveFVhuUJYqQRsfUSX
 d223r/dlwj0=
 =V8n9
 -----END PGP SIGNATURE-----

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

Pull performance events updates from Ingo Molnar:
 "uprobes updates:

   - Fix a category of bugs with optimized uprobes that can clobber the
     redzone area with call instruction storing return address on stack
     where user code may keep temporary data without adjusting RSP.

     Fix this by moving the optimized uprobes on top of 10-bytes NOP
     instruction, so we can squeeze another instruction to escape the
     redzone area before doing the call (Jiri Olsa, Andrii Nakryiko)

   - Switch uretprobes_srcu to SRCU-fast-updown, to improve performance
     (Puranjay Mohan)

  Intel CPU PMU driver updates:

   - Optimize ACR handling in match_prev_assignment() (Dapeng Mi)

   - Fix various PMU driver bugs and data leaks (Dapeng Mi)

   - Fix Intel PT stop/start with no update (Adrian Hunter)

  Intel uncore PMU driver updates:

   - Fix various uncore PMU setup robustness bugs (Zide Chen)

  AMD uncore PMU driver updates:

   - Add group validation (Sandipan Das)

  .. and misc fixes and updates by Dapeng Mi, Randy Dunlap and Zide Chen"

* tag 'perf-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (42 commits)
  perf/x86: Optimize ACR handling in match_prev_assignment()
  perf/x86/intel: Fix intel_cap handling on hybrid PMUs
  perf/x86: Remove stale fixed counter helper and fix hybrid PMU access
  perf/x86/intel: Unwind cpuc state if PEBS buffer setup fails
  perf/x86: Guard intel_pmu_cpu_dead() against invalid hybrid PMU casts
  perf/x86: Free hybrid state on PMU init failure
  perf/x86: Unregister PMI handler on PMU init failure
  perf/x86/intel/pt: Fix stop/start with no update
  perf/x86/intel/pt: Use bitwise access for PERF_HES_STOPPED
  perf/x86/intel/pt: Factor out pt_config_enable()
  uprobes: Switch uretprobes_srcu to SRCU-fast-updown
  srcu: Add lock guard for srcu_fast_updown flavor
  perf/x86/intel/pt: Drop kernel-doc for deleted struct members
  perf/x86/amd/uncore: Add group validation
  selftests/bpf: Add tests for forked/cloned optimized uprobes
  selftests/bpf: Add tests for uprobe nop10 red zone clobbering
  selftests/bpf: Add reattach tests for uprobe syscall
  selftests/bpf: Change uprobe/usdt trigger bench code to use nop10
  selftests/bpf: Change uprobe syscall tests to use nop10
  selftests/bpf: Emit nop,nop10 instructions combo for x86_64 arch
  ...
2026-08-18 12:31:07 -07:00
Linus Torvalds
7b24dd46a7 liveupdate: updates for v7.3-rc1
KHO:
 * Fix size calculation in kho_preserved_memory_reserve() for preservations
   larger than 2 GiB
 
 LUO:
   * move liveupdate selftest utilities into a library so that selftests of
     subsystems participating in liveupdate, e.g. PCI and VFIO, can use them and
     drop direct ioctl calls from the tests
   * add end to end liveupdate test infrastructure that allows running the
     tests across a kexec in QEMU
   * remove redundant INIT_LIST_HEAD in luo_session_alloc()
   * remember the error status of an FLB retrieve() and return it on subsequent
     attempts rather than retrying retrieve() with an FLB in an unexpected
     state
   * reference count the outgoing FLB so that it cannot be freed while a caller
     is using it, the same way it's done for the incoming FLB
   * reject nonzero reserved field in LIVEUPDATE_SESSION_FINISH so that it can
     be reused by a future extension
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEeOVYVaWZL5900a/pOQOGJssO/ZEFAmp9oz8ACgkQOQOGJssO
 /ZHtBwf+LyzW59fGyPd8hHASkqcGzlvRGe9E1ML1XjbR7vMPPxCwt/WbJ6V5dbIb
 Se/jNVrcnaI0NE1vudeA3uNqdboQwOQ8+KiPdLp/SjGsPptlQgpORX86gMf5ggYR
 rVl7FFCqQcZmVHbAvLWhuSdVfhdADBjeR50JfqVcLUch1L48ykkHLJG+n7cEsClg
 2YGsANNyM+l72JPBHzjRsy57O4fxCr5z9AQLJTHJYkT7N3j3aXprCzY00duFfiZw
 4xOlvgUAkcxEOs5J27Ra8X+Wy6EmNwL72vZQLC7JuLCaGnfQ0EAtHuOB/E5CQX9G
 o9fwgR8mY4/UPM2ao7+MjkV2cv23yA==
 =p+yU
 -----END PGP SIGNATURE-----

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

Pull liveupdate updates from Mike Rapoport:
 "Kexec Handover:

   - Fix size calculation in kho_preserved_memory_reserve() for
     preservations larger than 2 GiB

  Live Update Orchestrator:

   - move liveupdate selftest utilities into a library so that selftests
     of subsystems participating in liveupdate, e.g. PCI and VFIO, can
     use them and drop direct ioctl calls from the tests

   - add end to end liveupdate test infrastructure that allows running
     the tests across a kexec in QEMU

   - remove redundant INIT_LIST_HEAD in luo_session_alloc()

   - remember the error status of an FLB retrieve() and return it on
     subsequent attempts rather than retrying retrieve() with an FLB in
     an unexpected state

   - reference count the outgoing FLB so that it cannot be freed while a
     caller is using it, the same way it's done for the incoming FLB

   - reject nonzero reserved field in LIVEUPDATE_SESSION_FINISH so that
     it can be reused by a future extension"

* tag 'liveupdate-v7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux:
  kho: fix size calculation in kho_preserved_memory_reserve()
  selftests/liveupdate: Move luo_test_utils.* into a reusable library
  selftests/liveupdate: Use luo_test_utils.c for liveupdate ioctl APIs
  liveupdate: Remember FLB retrieve() status
  liveupdate: Reference count outgoing FLB data
  liveupdate: reject nonzero reserved value for SESSION_FINISH
  liveupdate: Remove redundant INIT_LIST_HEAD in luo_session_alloc
  selftests/liveupdate: add end to end test infrastructure and scripts
2026-08-18 10:43:01 -07:00
Linus Torvalds
ba24659b1d kexec: updates for v7.3-rc1
* Deduplicate crash memory allocation and the exclusion of reserved crash
   kernel regions from architecture specific code into a generic
   crash_prepare_headers() and enable crashkernel CMA reservation on arm64 and
   riscv reservation on arm64 and riscv.
 * Skip purgatory checksum verification when the kexec segments cannot be
   corrupted by DMA, which saves about 250ms on kexec.
 * Replace __ASSEMBLY__ with the compiler provided __ASSEMBLER__ in
   include/linux/kexec.h.
 * Fix a keyring refcount imbalance in the kdump kernel's dm-crypt key restore
   path, which over-dropped the user keyring reference when more than one key
   was restored.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEeOVYVaWZL5900a/pOQOGJssO/ZEFAmp9ouoACgkQOQOGJssO
 /ZEH/Af/b1qmnw8uUe2wzd1zcAEEsk6YwF8lmS5o4k7skiVKlHWQuDzPrwrxFTvg
 d6obJrLllMN2ULyLQ8ghMKbsdo8RCGBIpXF+bPEXmIF8bA/PhtDaxvi3scsxvie6
 zU3geZbExlzg0Ik525I0DyPoEZc2JAg5ietp8bF6ZN5HNkDtBoNvi2ROc4mR9kzO
 agrczVnIEuIE3Tk+IfD6081iS3Wz/PjRC+yPBU1yYFobA6/bL7kFma7kED8PnxvI
 2+oENcd1FtC/WBlmluZE0BC4SjNcsT1geyzAFlGlRvNzbHdtj13j6mTBSsbRpJMW
 WdewVpIpFGUqRbUIIdvOISLOcf62lg==
 =PjFs
 -----END PGP SIGNATURE-----

Merge tag 'kexec-v7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux

Pull kexec updates from Mike Rapoport:

 - Deduplicate crash memory allocation and the exclusion of reserved
   crash kernel regions from architecture specific code into a generic
   crash_prepare_headers() and enable crashkernel CMA reservation on
   arm64 and riscv reservation on arm64 and riscv.

 - Skip purgatory checksum verification when the kexec segments cannot
   be corrupted by DMA, which saves about 250ms on kexec.

 - Replace __ASSEMBLY__ with the compiler provided __ASSEMBLER__ in
   include/linux/kexec.h.

 - Fix a keyring refcount imbalance in the kdump kernel's dm-crypt key
   restore path, which over-dropped the user keyring reference when
   more than one key was restored.

* tag 'kexec-v7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux:
  crash_dump: release keyring reference at the correct time
  kexec: Replace __ASSEMBLY__ with __ASSEMBLER__ in header file
  kexec_file: skip checksum verification when safe
  riscv: kexec_file: Add support for crashkernel CMA reservation
  arm64: kexec_file: Add support for crashkernel CMA reservation
  powerpc/kexec_file: Use crash_exclude_core_ranges() helper
  LoongArch: kexec_file: Use crash_prepare_headers() helper to simplify code
  riscv: kexec_file: Use crash_prepare_headers() helper to simplify code
  x86/crash: Use crash_prepare_headers() helper to simplify code
  arm64: kexec_file: Use crash_prepare_headers() helper to simplify code
  crash: Add crash_prepare_headers() to exclude crash kernel memory
  powerpc/crash: sort crash memory ranges before preparing elfcorehdr
  riscv: kexec_file: Fix crashk_low_res not exclude bug
2026-08-18 10:28:28 -07:00
Linus Torvalds
a5778046a0 Power management updates for 7.3-rc1
- Minor fixes and cleanups in assorted cpufreq drivers (Dan Carpenter,
    Guru Das Srinagesh, Haoxiang Li, Karl Mehltretter, Sasha Finkelstein,
    and Pan Chuang)
 
  - Fix cpufreq table creation and bios_limits() callback in the Rust
    bindings (Priya Bala Govindasamy)
 
  - Add IPQ5210 support to qcom-nvmem driver (Varadarajan Narayanan)
 
  - Adjust the .adjust_perf() cpufreq driver callback to allow the
    maximum performance value to be passed to drivers and update the
    intel_pstate driver to use it (Rafael Wysocki)
 
  - Set policy->cur to the actual requested frequency in the intel_pstate
    driver when the performance policy is used (Rafael Wysocki)
 
  - Simplify HWP handling on Broadwell processors in intel_pstate (Rafael
    Wysocki)
 
  - Fix setting minimum P-state at init time in intel_pstate (Rafael
    Wysocki)
 
  - Consolidate frequency values computation in intel_pstate and clean up
    code in that driver (Rafael Wysocki)
 
  - Add missing kernel-doc descriptions for structure and union members
    in the amd-pstate driver (David Vernet)
 
  - Handle missing policy in dynamic EPP callbacks in the amd-pstate
    driver (EDAMAMEX)
 
  - Introduce EXPORT_SYMBOL_FOR_PSTATE_UT() to export amd-pstate driver
    symbols to the amd-pstate-ut subdriver (K Prateek Nayak)
 
  - Add dynamic EPP as an "energy_performance_preference" mode in
    amd-pstate, remove the "amd_dynamic_epp" kernel command line option
    and the "dynamic_epp" sysfs attribute, and update the dynamic_epp
    documentation accordingly (K Prateek Nayak)
 
  - Add unit tests for CPPC Performance Priority and the "dynamic" EPP
    mode in the amd-pstate driver (K Prateek Nayak)
 
  - Set min_limit_freq based on bios_min_perf in amd-pstate and remove
    the defensive check for bios_min_perf from it (K Prateek Nayak)
 
  - Fix EPP return type and handle errors in amd-pstate during
    initialization, toggle auto_sel in active mode on shared memory
    systems, and cache the firmware programmed EPP value (Marco Scardovi)
 
  - Skip tests in amd-pstate-ut if the amd-pstate driver is not in active
    use (Qianheng Peng)
 
  - Replace sprintf() with sysfs_emit() in sysfs show in the cpufreq
    schedutil governor and fix a self-contradictory comment in
    sugov_iowait_apply() (Zhongqiu Han)
 
  - Fix the usage example for the sampling_rate tunable of the ondemand
    cpufreq governor in admin-guide (wangxiaodong)
 
  - Avoid using deep idle states during initialization in the intel_idle
    driver to work around device handling issues (Rafael Wysocki)
 
  - Fix and refactor the ACPI processor driver code related to ACPI _LPI
    support and add ACPI _LPI support to intel_idle based on that ACPI
    processor driver update (Rafael Wysocki)
 
  - Backup and restore governor for cpufreq sptests (Yiwei Lin)
 
  - Remove unnecessary sudo from quick_shuffle() and remove unused local
    variables from switch_show_governor() in cpufreq selftests (Jinseok
    Kim)
 
  - Rename the PM core module parameter prefix to "pm" and allow the PM
    transition (DPM) watchdog to be disabled by default (Tzung-Bi Shih)
 
  - Fix off-by-one in wakelocks number limit check in the system sleep
    sysfs interface (Haowen Tu)
 
  - Remove kernel-doc markings from helper descriptions in the core
    hibernation code (Adi Nata)
 
  - Use %pe to print error pointer values in the hibernation core (Ronan
    Marchal)
 
  - Fix memory leak in snapshot_write_next() error path (Malaya Kumar
    Rout)
 
  - Delay allocating and linking the next swap_map_page in the
    hibernation image saving code until another image page actually
    needs to be recorded (Haesung Kim)
 
  - Fix cleanup ordering around scope-based pointers in OPP (Gregor
    Herburger).
 
  - Use clk_get_optional() for optional clocks in OPP (Praveen Talari).
 
  - Stop setting runtime_error on runtime resume callback failures to
    allow drivers to recover from resume issues (Praveen Talari)
 
  - Handle PMU registration failure during probe in the intel_rapl_tpmi
    driver (Sumeet Pawnikar)
 
  - Avoid optional imports in intel_pstate_tracer unless they are really
    needed (Yousef Alhouseen)
 
  - Add generic CPPC performance display to the cpupower utility, build
    and call CPPC information on non-AMD processors, make cpupower print
    kernel and hardware frequency information, and add libm to cpupower
    for generic CPPC view (Jeremy Linton)
 
  - Remove conditional return with no effect from cpupower (Sang-Heon
    Jeon)
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmp+DXsSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO10Z4IAIYwM9RKwbwCqPMKGvWExIb+1kpEy1aw
 wyFnYSiQd09XCt8/YjERFR9gB7CfGduisTxEOqOdCIpGX2rT9Me5xO5aR5Gz4FE3
 bML7KyulS9tVyaEVBjFx1yDZxGTNooTQVTLIxBYbCVB1RrgiCGdLyC2okn79XHlk
 olTZemq59Kn0B6t7BP7UQ0WCCCAs3RlbrQIZSrVh0HydoO0DHlJvttN2fc7bjeiM
 Je/dSm14o+vjglkVpY1kbxzBHJOH7/XH5nqSQRoHoAZWdllWK4+iQtll63Un4A72
 2KG0O5+nFrS3d166TEjDEInnEwR012Sod/8Gk72M0IZZhG/naqs5ekE=
 =mn7E
 -----END PGP SIGNATURE-----

Merge tag 'pm-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management updates from Rafael Wysocki:
 "As has been the case for quite some time, this set of changes is
  dominated by cpufreq updates including intel-pstate and amd-pstate
  driver updates, minor fixes and cleanups of other assorted cpufreq
  drivers, schedutil governor updates, fixes of the Rust bindings, new
  hardware support (IPQ5210 in qcom-nvmem), and some updates of self
  tests related to cpufreq.

  The second largest group of changes are cpuidle updates consisting of
  intel_idle driver updates and ACPI processor idle driver updates, both
  mostly related to ACPI _LPI support.

  There are also updates related to system sleep, mostly in the
  hibernation core code, two operating performance points (OPP) updates,
  one runtime PM framework update, one power capping update, and some
  tools updates including the addition of ACPI CPPC support to cpupower.

  Specifics:

   - Minor fixes and cleanups in assorted cpufreq drivers (Dan
     Carpenter, Guru Das Srinagesh, Haoxiang Li, Karl Mehltretter, Sasha
     Finkelstein, and Pan Chuang)

   - Fix cpufreq table creation and bios_limits() callback in the Rust
     bindings (Priya Bala Govindasamy)

   - Add IPQ5210 support to qcom-nvmem driver (Varadarajan Narayanan)

   - Adjust the .adjust_perf() cpufreq driver callback to allow the
     maximum performance value to be passed to drivers and update the
     intel_pstate driver to use it (Rafael Wysocki)

   - Set policy->cur to the actual requested frequency in the
     intel_pstate driver when the performance policy is used (Rafael
     Wysocki)

   - Simplify HWP handling on Broadwell processors in intel_pstate
     (Rafael Wysocki)

   - Fix setting minimum P-state at init time in intel_pstate (Rafael
     Wysocki)

   - Consolidate frequency values computation in intel_pstate and clean
     up code in that driver (Rafael Wysocki)

   - Add missing kernel-doc descriptions for structure and union members
     in the amd-pstate driver (David Vernet)

   - Handle missing policy in dynamic EPP callbacks in the amd-pstate
     driver (EDAMAMEX)

   - Introduce EXPORT_SYMBOL_FOR_PSTATE_UT() to export amd-pstate driver
     symbols to the amd-pstate-ut subdriver (K Prateek Nayak)

   - Add dynamic EPP as an "energy_performance_preference" mode in
     amd-pstate, remove the "amd_dynamic_epp" kernel command line option
     and the "dynamic_epp" sysfs attribute, and update the dynamic_epp
     documentation accordingly (K Prateek Nayak)

   - Add unit tests for CPPC Performance Priority and the "dynamic" EPP
     mode in the amd-pstate driver (K Prateek Nayak)

   - Set min_limit_freq based on bios_min_perf in amd-pstate and remove
     the defensive check for bios_min_perf from it (K Prateek Nayak)

   - Fix EPP return type and handle errors in amd-pstate during
     initialization, toggle auto_sel in active mode on shared memory
     systems, and cache the firmware programmed EPP value (Marco
     Scardovi)

   - Skip tests in amd-pstate-ut if the amd-pstate driver is not in
     active use (Qianheng Peng)

   - Replace sprintf() with sysfs_emit() in sysfs show in the cpufreq
     schedutil governor and fix a self-contradictory comment in
     sugov_iowait_apply() (Zhongqiu Han)

   - Fix the usage example for the sampling_rate tunable of the ondemand
     cpufreq governor in admin-guide (wangxiaodong)

   - Avoid using deep idle states during initialization in the
     intel_idle driver to work around device handling issues (Rafael
     Wysocki)

   - Fix and refactor the ACPI processor driver code related to ACPI
     _LPI support and add ACPI _LPI support to intel_idle based on that
     ACPI processor driver update (Rafael Wysocki)

   - Backup and restore governor for cpufreq sptests (Yiwei Lin)

   - Remove unnecessary sudo from quick_shuffle() and remove unused
     local variables from switch_show_governor() in cpufreq selftests
     (Jinseok Kim)

   - Rename the PM core module parameter prefix to "pm" and allow the PM
     transition (DPM) watchdog to be disabled by default (Tzung-Bi Shih)

   - Fix off-by-one in wakelocks number limit check in the system sleep
     sysfs interface (Haowen Tu)

   - Remove kernel-doc markings from helper descriptions in the core
     hibernation code (Adi Nata)

   - Use %pe to print error pointer values in the hibernation core
     (Ronan Marchal)

   - Fix memory leak in snapshot_write_next() error path (Malaya Kumar
     Rout)

   - Delay allocating and linking the next swap_map_page in the
     hibernation image saving code until another image page actually
     needs to be recorded (Haesung Kim)

   - Fix cleanup ordering around scope-based pointers in OPP (Gregor
     Herburger).

   - Use clk_get_optional() for optional clocks in OPP (Praveen Talari).

   - Stop setting runtime_error on runtime resume callback failures to
     allow drivers to recover from resume issues (Praveen Talari)

   - Handle PMU registration failure during probe in the intel_rapl_tpmi
     driver (Sumeet Pawnikar)

   - Avoid optional imports in intel_pstate_tracer unless they are
     really needed (Yousef Alhouseen)

   - Add generic CPPC performance display to the cpupower utility, build
     and call CPPC information on non-AMD processors, make cpupower
     print kernel and hardware frequency information, and add libm to
     cpupower for generic CPPC view (Jeremy Linton)

   - Remove conditional return with no effect from cpupower (Sang-Heon
     Jeon)"

* tag 'pm-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (76 commits)
  cpufreq: imx6q: fix out-of-bounds write when probed more than once
  cpufreq: imx6q: fix devres accumulation across driver rebind
  rust: cpufreq: Fix temporary write in Registration::bios_limit_callback
  rust: cpufreq: Add CPUFREQ_TABLE_END as last table entry in TableBuilder::to_table
  opp: Use clk_get_optional() to avoid leaving opp_table->clk as an error pointer
  intel_idle: Avoid using deep idle states during initialization
  cpupower: remove conditional return with no effect
  cpufreq: intel_pstate: Adjust policy->cur in active mode to policy
  cpufreq/amd-pstate: Document missing kernel-doc members
  cpufreq/amd-pstate-ut: Add unit test for CPPC Performance Priority
  cpufreq/amd-pstate-ut: Add unit test for "dynamic" EPP mode
  cpufreq/amd-pstate: Reduce the scope of exported symbols
  Documentation/amd-pstate: Update dynamic_epp documentation with new behavior
  cpufreq/amd-pstate: Remove "amd_dynamic_epp" cmdline and "dynamic_epp" sysfs
  cpufreq/amd-pstate: Add dynamic EPP as an "energy_performance_preference" mode
  cpufreq/amd-pstate: Extract platform profile to EPP conversion into a helper
  cpufreq/amd-pstate: Remove the defensive check for bios_min_perf
  cpufreq/amd-pstate: Set min_limit_freq based on bios_min_perf
  powercap: intel_rapl_tpmi: Handle PMU registration failure during probe
  PM: sleep: Allow disabling DPM watchdog by default
  ...
2026-08-18 08:47:09 -07:00
Linus Torvalds
55668d04e3 vfs-7.3-rc1.netfs
Please consider pulling these changes from the signed vfs-7.3-rc1.netfs tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCan7RJQAKCRCRxhvAZXjc
 oq5VAPwLHEyDBJUM581Nsj9O7NnkSRhffjp4//Cp2jHRYkaR4wEAiceqF+rONVWK
 VYCyLEDSU5TPP9EeON95qSzq0khbswo=
 =kcGi
 -----END PGP SIGNATURE-----

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

Pull cachefiles ondemand removal from Christian Brauner:
 "This sunsets cachefiles ondemand mode.

  It was an effort to make fscache usable as a kernel cache for lazy
  pulling. EROFS over fscache was its only in-tree user. fscache has
  since become netfslib-oriented while EROFS never acts as a network
  filesystem and EROFS over fscache has been removed.

  So this cleans up the netfs, fscache and cachefiles side as well"

* tag 'vfs-7.3-rc1.netfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  cachefiles,netfs: sunset ondemand mode
2026-08-17 13:32:50 -07:00
Linus Torvalds
fff0150b02 vfs-7.3-rc1.kthread
Please consider pulling these changes from the signed vfs-7.3-rc1.kthread tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCan7RJQAKCRCRxhvAZXjc
 ohHuAQCFeGhxqsb44KhuJaWXewiXbefr6eg31lXmxgSfg0DILAD/Tw/WmpiUbX5M
 H+/jh6NmLKnQ/ADjlWFRy3R1K1Il3w4=
 =jwPP
 -----END PGP SIGNATURE-----

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

Pull kthread vfs updates from Christian Brauner:
 "This stops kernel threads from sharing filesystem state with
  userspace. This work is about 3 cycles old and has been in -next
  for about that time.

  When the kernel boots init_task creates PID 1 and then kthreadd. From
  that point every kthread and PID 1 share the same fs_struct. That is
  why pivot_root() has to rewrite the fs_struct of all kthreads. The
  rewriting exists so that kthreads can use init's filesystem state when
  they want to. It also means userspace can move the ground out from
  under the kernel.

  PID 1 now gets a completely separate fs_struct. All kthreads are
  anchored in a private SB_KERNMOUNT instance of nullfs that cannot be
  mounted on and cannot be used to follow other mounts. Userspace init
  can no longer affect kthread filesystem state and kthreads can no
  longer affect userspace fs state without explicit opting in to that.

  Path lookup from a kthread now fails by default. It makes it
  deliberately hard to offload security sensitive operations into init's
  filesystem state from a kthread.

  Places that legitimately need to look something up there opt in
  through the new scoped_with_init_fs() which temporarily overrides the
  caller's fs_struct with init's. usermodehelpers remain the only kernel
  tasks that genuinely share init's filesystem state, since they execute
  random binaries in the root filesystem (excellent...).

  The visible result is that /proc/2/root is a nullfs with an empty
  mountinfo while /proc/1/root is the real root"

* tag 'vfs-7.3-rc1.kthread' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (26 commits)
  initramfs_test: use test init/exit hooks to override init fs
  fs: stop rewriting paths for PF_EXITING | PF_DUMPCORE
  fs: stop rewriting kthread fs structs
  fs: start all kthreads in nullfs
  nullfs: make nullfs multi-instance
  devtmpfs: create private mount namespace
  fs: add umh argument to struct kernel_clone_args
  fs: stop sharing fs_struct between init_task and pid 1
  af_unix: use scoped_with_init_fs() for coredump socket lookup
  initramfs: use scoped_with_init_fs() for rootfs unpacking
  pnfs/blocklayout: use scoped_with_init_fs() for SCSI device lookup
  ksmbd: use scoped_with_init_fs() for VFS path operations
  ksmbd: use scoped_with_init_fs() for filesystem info path lookup
  ksmbd: use scoped_with_init_fs() for share path resolution
  fs: use scoped_with_init_fs() for kernel_read_file_from_path_initns()
  coredump: use scoped_with_init_fs() for coredump path resolution
  btrfs: use scoped_with_init_fs() for update_dev_time()
  scsi: target: use scoped_with_init_fs() for APTPL metadata
  scsi: target: use scoped_with_init_fs() for ALUA metadata
  crypto: ccp: use scoped_with_init_fs() for SEV file access
  ...
2026-08-17 11:35:12 -07:00
Linus Torvalds
b9cba7ebfe vfs-7.3-rc1.binfmt
Please consider pulling these changes from the signed vfs-7.3-rc1.binfmt tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCan7RJAAKCRCRxhvAZXjc
 ovtnAQDiMF2CvH2vr/eiUEUNdDjeyzRKipkh3a9krO0XbFxpnAD8CZypBFw/oWOQ
 7z3PDGhHp10ie6KYC45XbUc+a4b6vgQ=
 =X9RZ
 -----END PGP SIGNATURE-----

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

Pull binfmt updates from Christian Brauner:
 "This contains a bunch of work for binfmt_misc. It fixes a bunch of
  old bugs, reworks the locking, and then extends the format registry
  so a binary type can be matched programmatically and its interpreter
  computed per exec instead of being a fixed string recorded at
  registration time.

  This allows nixos and other to e.g., implement relocatable binaries
  meaning the interpreter/dynamic loader can be determined
  programatically, say found relative to the binary. The mechanism is
  flexible and can support other policies:

   - Handler lookup is now an rcu walk. An exec that matches no
     binfmt_misc entry should now never write to a shared cacheline

   - remove the VERBOSE_STATUS and USE_DEBUG compile time toggles

   - convert the entry file to a seq_file which simplifies things quite
     a bit and kills a lot of custom logic

   - make flags proper enums

   - rename struct Node to binfmt_misc_entry

   - allow entries to be removed with unlink(2)

   - Add the ability to attach bpf programs to binfmt_misc entries so
     it's possible to dynamically choose the execution environment such
     as the loader or interpreter on a per binary basis.

     A handler is an instance of a binfmt_misc_ops struct_ops with a
     ->match() and a ->load() program. match() decides from the entry
     lookup walk whether the handler applies under the same
     registration-order. It can read file content as needed not only the
     prefetched 256 bytes in bprm->buf.

     load() then selects the interpreter and stages it through the new
     bpf_binprm_set_interp(), bpf_binprm_set_interp_arg() and
     bpf_binprm_set_flags() kfuncs.

     Handlers are published in a registry keyed by the registering
     task's user namespace and activated through the existing text
     interface with a new 'B' type carrying the handler name:

	echo ':origin:B::::nix:' > /proc/sys/fs/binfmt_misc/register

     The permission and namespacing model is unchanged. Activating a
     handler requires the same write access to an instance as any other
     registration. A container mounting its own instance escapes the
     host's entries exactly as before. The computed interpreter is
     opened with open_exec() under the caller's credentials and goes
     through full LSM vetting as the next binprm level. A program can
     only ever redirect the caller to something the caller could exec
     anyway.

   - Two dispatch modes are added. So far the chosen interpreter owns
     the whole process identity (argv[0], /proc/pid/cmdline,
     /proc/self/exe all name interpreter information). So relocatable
     find the dynamic linker instead. Also a binary passed to execveat()
     as an inaccessible O_CLOEXEC fd cannot run at all and gdb trips
     because AT_ENTRY and AT_PHDR do not match the exe file. So PIE
     symbols are unrelocated.

     This adds transparent dispatch which allows the interpreter to load
     the binary through AT_EXECFD and leaves the argument vector exactly
     as the caller built it and labels mm->exe_file and comm with the
     binary. It also raises the AT_FLAGS_TRANSPARENT_INTERP aux vector
     bit. The interpreter keeps control of mapping the binary.

     The second mode is loader substitution. This allows a binary to be
     executed natively and only the interpreter to be changed.

   - Last, interpreters can be bound at registration time. Each
     interpreter is opened by its own write with the credentials the
     entry file was opened with. The program picks one per exec with
     bpf_binprm_select_interp().

     Ucounts are used to properly account for pre-opened interpreters
     via /proc/sys/user/max_binfmt_misc_interpreters"

* tag 'vfs-7.3-rc1.binfmt' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (63 commits)
  binfmt_misc: document the pre-opened interpreter limit
  selftests/exec: test the pre-opened interpreter limit
  binfmt_misc: correctly account pre-opened interpreters
  binfmt_misc: document interpreters bound by a 'B' entry
  selftests/exec: test interpreters bound to a 'B' entry
  binfmt_misc: let a 'B' entry bind its interpreters
  binfmt_misc: carry pre-opened interpreters in struct binfmt_misc_interp
  selftests/exec: share the bpf handler preconditions
  binfmt_misc: document registering an entry disabled
  selftests/exec: test registering an entry disabled
  selftests/exec: let binfmt_flag_supported() return a bool
  selftests/exec: check that a binfmt_misc instance cannot be pinned
  binfmt_misc: let a register string create an entry disabled
  binfmt_misc: document loader substitution
  selftests/exec: test binfmt_misc loader substitution
  binfmt_misc: let a bpf handler request loader substitution
  binfmt_misc: add the 'L' loader substitution flag
  binfmt_elf_fdpic: consume a stashed PT_INTERP substitute
  binfmt_elf: consume a stashed PT_INTERP substitute
  exec: carry a PT_INTERP substitute in struct linux_binprm
  ...
2026-08-17 08:35:25 -07:00
Linus Torvalds
043d7a2b40 ipc-7.3-rc1.misc
Please consider pulling these changes from the signed ipc-7.3-rc1.misc tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCan7RJAAKCRCRxhvAZXjc
 ooOoAP9pECC4lIvizRLhV+8id21aYyyHP6svcZDgMv7yI8E7qgD/Zaxt0hS/rsLY
 IUA9iphoZ6pWyPyv/Lq6M0mk3wyoigM=
 =KcXC
 -----END PGP SIGNATURE-----
mergetag object d7337cad4d
 type commit
 tag kernel-7.3-rc1.misc
 tagger Christian Brauner <brauner@kernel.org> 1786695972 +0200
 
 kernel-7.3-rc1.misc
 
 Please consider pulling these changes from the signed kernel-7.3-rc1.misc tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCan7RJAAKCRCRxhvAZXjc
 osV7AP0cdSyVJmxYRbryVuQykwbH83e+VyUwla8Qy4Lx7DaPqgEAg6MyH2kFZCKY
 eahHCBwW7B5ef9x08zw1BpLwjhHNkQU=
 =MhTX
 -----END PGP SIGNATURE-----

Merge tags 'ipc-7.3-rc1.misc' and 'kernel-7.3-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull misc ipc and core updates from Christian Brauner:

 - reject mq_notify() with a zero signal number

 - fix coding style in the exit path

* tag 'ipc-7.3-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  mqueue: reject mq_notify with signo 0

* tag 'kernel-7.3-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  kernel: exit: fix coding style missing spaces
2026-08-17 08:27:30 -07:00
Linus Torvalds
fd923b32d7 - Make sure a delayed sched entity's runtime stats are updated at the right
time so that it receives the proper lag compensation
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmqB/CQACgkQEsHwGGHe
 VUq4Eg//ZeldqtFqUxohjcy5ZrgJ9dhdxwRfqZgYhZCSqTJHVLqAxWVAHnJZWfiz
 Vh63rnt78rIPpVX6E/lZLnYm2VwhEO6P6piMzG4CVlh2pMySjhoRIQ3ufNAQRt0o
 P79Y29rLhDhHkOaL+jjgSr+ePiDzerrkBfYHK0wJ+BAjphjWxML1wYyCGwhWk/Lu
 KuXN/jzbEbAn2QWEwEy9KyxztzJlTYTE+l8jiGfRywAeZOBo8HaXg0HhuCwLnaXb
 yPmarhof2/7XUdW/CBGYggLaXF+mW6VeMaiqdhxSKl48KMpIfPnBC99/YCJy6vmQ
 pD+kOiysGSFy+3vMbTvjwOYV8T3g7LOpeVkY8KkVmAHUFVF9wBSyPULyooNuxGS9
 2pBv6Uz2ojm3wMVk+gggt2VU5uVNLsn9IKpNObyuBRDkt3My4Jej3cQ89LeqyS8Z
 q49JbAhEwCRfGpxq92WW6izMWjOnduhiTd9TXF/WoXVtcT9ZSbyxJ3sCxbTBrJxd
 na7xln2xsR8w9+G91DmmNPRnBtBkBOJ6xRGacKDeV8dcfKcZGGH6/sRMN9mIhP8v
 huCVazSwNCVWDaHn8o/ORBJ0dEJ/536a806ysYfB6MdNzZYtU8iepCj5Lr+uAG/Q
 W49ftqYFst9o22wT2i4ZdTfrDrkbekVU67BLv9yu8VcmoQJgt90=
 =bK3W
 -----END PGP SIGNATURE-----

Merge tag 'sched_urgent_for_v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fix from Borislav Petkov:

 - Make sure a delayed sched entity's runtime stats are updated at the
   right time so that it receives the proper lag compensation

* tag 'sched_urgent_for_v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched: Update time before requeueing delayed entities
2026-08-16 11:15:23 -07:00
Linus Torvalds
9da3fc37f5 - Prevent the use of exited events as group leaders
- Avoid use-after-free of an event's group leader by promoting detached
   sibling events to standalone entities and correct related accounting and
   state transitions
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmqB6xQACgkQEsHwGGHe
 VUpWFQ/+KyU6R2DC48ifpChzgTFmQ2gmIjy1IIsWSGmdSbyD5CEWar8hHDRq1X9r
 peuQizTXTQ2Ze75atTMIBExR6eUFYb2sKA1HpobcGnB96cpK8e2vmxhvXoHgB3IZ
 TYDXQ1RMPnbyTn2rCQwr5cgSq2Qe7w2tMXMQKzfmDxP1r7cE81zJVFAsRdVVZP75
 kvlcCL43pIwzxzP7sDb9bU9lTkW2Sw83dLIp3jBd3iiUpIQpwqV+UG3/fkInV58n
 L56cYFsovLbvWdxq4oj6cFwRBmvyrYKV0zkT+zW0SO2AzlVhfwCD/o74hxLwrN//
 Gas0d51uQfWt+5M7s6T0KFQYBfClG4uoIi2yh7zXxWEXyhcNuvmAVrY3xiQxReIi
 m88+ByWHfBc/mYTHKWJAqb8sHhJiktU52T55ktOJaPNGczA5+O/4alnOg3Kxvw7d
 CXp1raxJLqDxvd7Ubu/LVjWY96ds+fAaC15ydC6Lh08b9LPhA8rRCavf7NeSOzOD
 E1NA3QLS3TwbrTboaGqLMmzOLPkBBZ+28PUASg1ZpyfGnw91Ggv/gOVNUgr5PvMU
 D/gzRCwEYfDdhOrIHzGrfJ1fwj4qFsZ6HSge3sHDj8/BCcQYj/zmlTKe0CHKbaiy
 D7bkLNwdBc0z+eh5T7UfCYodUu0qiiek5Y0G3q8FVad0mFDYtUA=
 =moR8
 -----END PGP SIGNATURE-----

Merge tag 'perf_urgent_for_v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Borislav Petkov:

 - Prevent the use of exited events as group leaders

 - Avoid use-after-free of an event's group leader by promoting detached
   sibling events to standalone entities and correct related accounting
   and state transitions

* tag 'perf_urgent_for_v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix group leader use-after-free after sibling detach
  perf: Reject exited events as group leaders
2026-08-16 10:31:05 -07:00
Linus Torvalds
ad8d485e66 vfs-7.2-rc8.fixes
Please consider pulling these changes from the signed vfs-7.2-rc8.fixes tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCan7RJAAKCRCRxhvAZXjc
 olPOAP9C1jX75LIMjyoJb9lpVAvCdlrvf0wcD88NXVBylueILAEA6GC8/lVpvUX8
 nSFAZojyykVsPitfUdsbLagltXwLqgU=
 =/Rxi
 -----END PGP SIGNATURE-----

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

Pull vfs fixes from Christian Brauner:

 - Don't warn when a mount is completed from another user namespace.

   fsopen() records the caller's user namespace in fc->user_ns and
   hands back an ordinary file descriptor. The task that calls
   fsconfig(FSCONFIG_CMD_CREATE) doesn't have to be the one that
   created the context, and mount_capable() lets it through as long
   as the caller has CAP_SYS_ADMIN over fc->user_ns, which anyone in
   an ancestor namespace does. So fc->user_ns != current_user_ns()
   is something an unprivileged user can arrange.

   Both overlayfs and binfmt_misc WARN_ON() that. Overlayfs already
   has the same check as a plain error return in ovl_parse_param().

   Drop the WARN_ON() and just refuse. Add selftests for both cases.

 - Reject pid allocations through dead ancestor pid namespaces.

   Require PIDNS_ADDING in every namespace that will receive the pid
   before publishing any of them. That preserves the invariant that
   free_pid() never decrements pid_allocated in a namespace whose
   child_reaper is no longer live. The existing ENOMEM behavior is
   unchanged.

* tag 'vfs-7.2-rc8.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  pid: reject allocations through dead ancestor pid namespaces
  selftests/filesystems: test completing a context from another user namespace
  binfmt_misc: don't warn when the mount is completed from another user namespace
  ovl: don't warn when the mount is completed from another user namespace
2026-08-14 07:58:01 -07:00
Vincent Guittot
68e3748781 sched/fair: Fix flat hierarchy
When a fair task is enqueued, we must update curr and more precisely
its vruntime before placing the enqueued task so avg vruntime will take
into account the last exec phase.

Example:
TA is an always running task in cgroup G0.
TB is a short running task (cyclictest) in cgroup G1.
The lag of TB always increases up the clamp limit because TB is placed
before TA(curr) is updated (since the last tick). When curr(TA) is
finally updated, its last exec phase provide positive lag to TB

Because TA and TB don't belong to the same group, enqueue_hierarchy() will not
update TA's entity when updating curr but only G0's entity at root level.

The same applies when dequeuing.

This is because update_curr() uses ->h_curr, rather than ->curr, and therefore,
while it is invoked on the root cfs_rq, which contains all the eevdf bits, it
does not do the right thing.

Fixes: 85570f10a4 ("sched/eevdf: Move to a single runqueue")
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260812125039.1717249-1-vincent.guittot@linaro.org
2026-08-14 16:13:02 +02:00
Peter Zijlstra
3f8fa8fe90 Merge branch 'sched/urgent'
Pull in dependents, the flat hierarchy fix depends on this.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
2026-08-14 16:12:58 +02:00
Vincent Guittot
333238da9a sched: Update time before requeueing delayed entities
In order to compute the right lag, it is required to update time to 'now'.
Without this, the delayed entity might appear younger than it really is and
receive less compensation for having waited.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
2026-08-14 16:12:55 +02:00
Michael Wu
c3730b8373 tracing: Fix race between update_event_fields and, event_define_fields
The following sequence may leads race between event_define_fields()
and update_event_fields():

 CPU0 (loads module A)                      CPU1 (loads module B)
 ===============================            ===============================
 load_module(A)                             load_module(B)
   notifier_call_chain                        notifier_call_chain
     trace_module_notify                        trace_module_notify
       mutex_lock(&event_mutex)                   trace_event_update_all()
         trace_module_add_events(A)                 down_write(&trace_event_sem)
            __register_event(call_A)
              __add_event_to_tracers(call_A)
                event_define_fields(call_A)
                  for each f:                         list_for_each_entry(field,
                    list_add(&f->link,                                    &class->fields, link)
                             &class->fields)            field = class->fields->next;

Where access to the class->fields is not protected by the event_mutex in
trace_event_update_all().

This produces the following panic:
   Unable to handle kernel access ... at virtual address 0000000000000018
   pc : update_event_fields+0xf8/0x368
   Call trace:
    update_event_fields+0xf8/0x368
    trace_event_update_all+0x7c/0x2b4
    trace_module_notify+0x4c/0x1dc
    notifier_call_chain+0x84/0x168
    blocking_notifier_call_chain_robust+0x64/0xd4
    load_module+0x10c8/0x123c
    __arm64_sys_finit_module+0x230/0x31c

Fix by taking event_mutex in trace_event_update_all() before
trace_event_sem.

Cc: stable@vger.kernel.org
Fixes: b3bc8547d3 ("tracing: Have TRACE_DEFINE_ENUM affect trace event types as well")
Link: https://patch.msgid.link/2e5730d2-c631-da41-3a3a-ae35bb4895f3@allwinnertech.com
Signed-off-by: Michael Wu <michael@allwinnertech.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-13 15:38:25 -04:00
Hui Su
b69859204d tracing: Fix NULL pointer dereference in module event cache removal
A module-only event filter such as ":mod:foo" is cached with a NULL
event_mod->match when foo has not been loaded. If a later write tries to
remove a specific match from the same module, remove_cache_mod() passes
the NULL cached match to strcmp(), causing a NULL pointer dereference.

The issue can be reproduced from userspace:

  echo ':mod:trace_events_kunit_missing' > /sys/kernel/tracing/set_event
  echo '!foo_bar:mod:trace_events_kunit_missing' >> /sys/kernel/tracing/set_event

The second write must be a concatenation (">>") to not include O_TRUNC as
that would cause ftrace_clear_events() to clear the cached modules lines.

The crash was reproduced on x86_64 QEMU while KUnit workers contended on
the event tracing path:

  BUG: kernel NULL pointer dereference, address: 0000000000000000
  #PF: supervisor read access in kernel mode
  RIP: 0010:strcmp+0x10/0x30
  Call Trace:
   __ftrace_set_clr_event_nolock+0x373/0x4a0
   ftrace_set_clr_event+0xf0/0x180
   ftrace_event_write+0xdf/0x110
   vfs_write+0xf6/0x440
   ksys_write+0x68/0xe0
   do_syscall_64+0xf9/0x540
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

Check event_mod->match before comparing it, consistent with the existing
NULL checks for the cached system and event fields. The mismatched removal
continues to return -EINVAL; a broad cached module filter is removed with
"!:mod:<module>".

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260811173902.1927376-2-sh_def@163.com
Fixes: b355247df1 ("tracing: Cache \":mod:\" events for modules not loaded yet")
Reported-by: syzbot+4d3143c8e28f6266c636@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/6a7a6b7f.9c11d2ce.289b96.00f8.GAE@google.com/
Signed-off-by: Hui Su <sh_def@163.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-13 15:38:03 -04:00
Waiman Long
2b58c749b8 sched/isolation: Defer freeing of cpumask memblock memory to initcall
When testing a linux-next kernel with commit 59bd1d914b ("memblock:
warn when freeing reserved memory before memory map is initialized"),
the following warning was hit when there was a "nohz_full" kernel boot
parameter.

  Cannot free reserved memory because of deferred initialization of the memory map
  WARNING: mm/memblock.c:904 at __free_reserved_area+0xde/0xf0, CPU#0: swapper/0/0
    :
  Call Trace:
   <TASK>
   memblock_phys_free+0xcb/0x100
   housekeeping_init+0x14c/0x170
   start_kernel+0x207/0x450
   x86_64_start_reservations+0x24/0x30
   x86_64_start_kernel+0xda/0xe0
   common_startup_64+0x13e/0x141
   </TASK>

IOW, we shouldn't free memblock allocated memory so early
in the boot process when memory map isn't fully initialized in
deferred_init_memmap().

Fix it by saving the housekeeping cpumask memblock memory to be
freed into a llist free list in housekeeping_init() and add a new
housekeeping_late_init() helper to defer the actual freeing of memblock
memory to when initcall's are being processed. The cpumask memblock
memory is treated as a llist_node with the size of a "long" type which
is also smallest cpumask size that can be allocated.

The non-atomic version of the llist APIs are used as there is no
contention.

This commit depends on the presence of commit 7c2eee9c13 ("memblock:
don't touch memblock arrays when memblock_free() is called late")
to prevent a KASAN UAF bug report [1].

 [1] https://lore.kernel.org/lkml/20260505051821.1107133-1-longman@redhat.com/

Fixes: 27c3a5967f ("sched/isolation: Convert housekeeping cpumasks to rcu pointers")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Link: https://patch.msgid.link/20260701195810.477326-1-longman@redhat.com
2026-08-13 12:37:03 +02:00
Gao Xiang
949eb95d5b
cachefiles,netfs: sunset ondemand mode
It was an effort to enhance fscache as a kernel cache for lazy
pulling (at least according to previous Incremental FS discussion [1])
and EROFS over fscache was the in-tree user of this mode.

fscache has since evolved to be netfslib-oriented, serving network
filesystem inodes via the netfs library, but EROFS never acts as a
network filesystem and we need to cache golden filesystem images rather
than individual EROFS inodes.

Since EROFS over fscache is now removed, clean up netfs/fscache/
cachefiles upstream too.

[1] https://lore.kernel.org/r/CAOQ4uxi4dzxArY24YO=+kBCK2gGoq3Ptb8WkzCqSogPgU_R3dQ@mail.gmail.com

[dh] Fixed up comments on:
https://sashiko.dev/#/patchset/20260716103030.3065561-1-dhowells%40redhat.com
https://sashiko.dev/#/patchset/20260722130218.78958-1-dhowells%40redhat.com

Signed-off-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/1046393.1786544127@warthog.procyon.org.uk
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-erofs@lists.ozlabs.org
cc: bpf@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-12 16:24:26 +02:00
Jérémy Jean
b64a9f67e0
pid: reject allocations through dead ancestor pid namespaces
alloc_pid() checks PIDNS_ADDING only on the leaf pid namespace before
making a new struct pid visible in every ancestor namespace. That is
insufficient when an unborn descendant pid namespace outlives an
ancestor whose init task has already exited. The descendant can still be
initialized later through setns(), and the new pid is then published
into the dead ancestor as well.

Keep the existing ENOMEM behavior, but require PIDNS_ADDING to be set in
every namespace that will receive the new pid before publishing any of
them. This preserves the invariant that free_pid() never decrements
pid_allocated in a namespace whose child_reaper is no longer live.

Fixes: a3bdc23ba8 ("pid_namespace: allow opening pid_for_children before init was created")
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-12 12:56:30 +02:00
Thomas Weißschuh (Schneider Electric)
859b069ec5 timer_list: Use ktime_t over nanoseconds
hrtimers use ktime_t in their implementation and API.
The timer list performs a lot of unnecessary conversion to nanoseconds
which make the code harder to read and are also wrong in case the values
ever become negative.

Remove the conversions.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-5-910cbd485390@linutronix.de
2026-08-11 18:11:20 +02:00
Thomas Weißschuh (Schneider Electric)
40e05cf391 timer_list: Use standard 'long long' format placeholders
'%Ld' and '%Lu' are GNU extensions. While they do work for kernel code,
checkpatch complains about them all the time. Replace them with the
standard placeholders for 'long long' types, namely '%lld' and '%llu'.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-4-910cbd485390@linutronix.de
2026-08-11 18:11:20 +02:00
Thomas Weißschuh (Schneider Electric)
d2e6ee3ecb hrtimer: Add a lockdep assertion to hrtimer_update_base()
Document and verify that the hrtimer_cpu_base::lock is held at this point.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-3-910cbd485390@linutronix.de
2026-08-11 18:11:20 +02:00
Thomas Weißschuh (Schneider Electric)
406a037ce7 timekeeping: Use u32 for clock_was_set_seq
Use an explicitly sized type to make the code a bit more consistent
with other fields of the datastructure and other sequence counters.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-2-910cbd485390@linutronix.de
2026-08-11 18:11:20 +02:00
Thomas Weißschuh (Schneider Electric)
4f39d3c19b timekeeping: Rename clockid_aux_valid() to clockid_is_aux_clock()
The current name is not clear about its behavior.

Rename it.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-1-910cbd485390@linutronix.de
2026-08-11 18:11:19 +02:00
Liang Hao
32a05ba399 hrtimer: Account nr_retries on recovered interrupt retries
Re-arranging hrtimer_interrupt() switched the retry path to a local
counter and dropped the update of cpu_base->nr_retries, leaving the
field exported via /proc/timer_list stuck at zero.

Increment nr_retries only when another pass through the expiry loop
is started; the third attempt that falls through to hang handling is
still accounted by nr_hangs alone.

Fixes: 2889243848 ("hrtimer: Re-arrange hrtimer_interrupt()")
Signed-off-by: Liang Hao <haohlliang@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260731150408.19554-1-haohlliang@gmail.com
2026-08-11 18:08:24 +02:00
Jérémy Jean
18c7d85864 timers/itimer: Zero-init old itimerval before copy to userspace
On native sparc64, struct __kernel_old_timeval contains a four-byte hole
after tv_usec because tv_sec is 64-bit while __kernel_suseconds_t is 32-bit.
put_itimerval() fills only the named fields in a stack-allocated
__kernel_old_itimerval and copies the entire object to userspace, so
getitimer() can expose the two padding holes.

Zero-initialize the aggregate before assigning the fields so implicit
padding is deterministic before it crosses the user/kernel boundary.

Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: Codex:gpt-5
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260809190428.1523014-1-Jeremy.Jean@oss.cyber.gouv.fr
2026-08-11 15:43:12 +02:00
Julian Braha
b17006b452 nohz: Replace dead select with choice default
'select' does not work on config options in a 'choice', so currently the
'select VIRT_CPU_ACCOUNTING_GEN' for NO_HZ_FULL is dead, with the choice
option VIRT_CPU_ACCOUNTING_GEN only being enabled when NO_HZ_FULL=y because
the other choice members depend on NO_HZ_FULL=n.

Remove the dead select, and encode this relationship as a default of the
choice, instead.

This dead select was found by kconfirm, a static analysis tool for Kconfig.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Bradley Morgan <include@grrlz.net>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/20260801160140.2391000-1-julianbraha@gmail.com
2026-08-11 15:37:23 +02:00
Thomas Weißschuh (Schneider Electric)
1b51577187 timekeeping: Remove the unused ktime_get_clock_ts64()
The last user was removed in commit a6d799608e ("ptp: Switch to
ktime_get_snapshot_id() for pre/post timestamps").

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260731-timekeeping-aux-must-check-v1-1-11ae93068497@linutronix.de
2026-08-11 11:12:43 +02:00
Thomas Weißschuh (Schneider Electric)
4b61084b11 timekeeping: Check the return value of tk_get_aux_ts64 in __do_adjtimex()
If the auxiliary clock is disabled during tk_get_aux_ts64() but is enabled
before tks->clock_valid is checked, then uninitialized stackdata will be
used in the calculations and indirectly leaked to userspace.

The same race window also exists after this change and also for the core
timekeeper. But in these cases the only effect would be incorrect
adjustments and this is userspace's responsibility to avoid this.

Fixes: 4eca49d0b6 ("timekeeping: Prepare do_adtimex() for auxiliary clocks")
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260731-timekeeping-aux-adjtimex-return-v1-1-b7fea4692886@linutronix.de
2026-08-10 22:16:34 +02:00
Dennis Moshegov
d7fc133bf9 timekeeping: Use READ_ONCE/WRITE_ONCE() for xtime_sec to prevent tearing
The timekeeper update path uses a bulk memcpy() to synchronize the
timekeeper structure, which is not guaranteed to be atomic. This allows for
torn reads in ktime_get_real_seconds() on 64-bit systems, where the
sequence counter protection is bypassed for performance.

To prevent reading a torn 64-bit xtime_sec value, enforce atomic-like
access by using WRITE_ONCE() for the critical field before the bulk
memcpy() in timekeeping_update_from_shadow(). Correspondingly, use
READ_ONCE() in ktime_get_real_seconds() to ensure a fresh, consistent load
from memory.

[ tglx: Format changelog and add comment ]

Reported-by: syzbot+72789cd1697965e714ca@syzkaller.appspotmail.com
Signed-off-by: Dennis Moshegov <dennis@xzync.uk>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260724154405.70-1-dennis@xzync.uk
Closes: https://syzkaller.appspot.com/bug?extid=72789cd1697965e714ca
2026-08-10 17:52:19 +02:00
Boqun Feng
3b0e2a22d4 preempt: Introduce HAS_SEPARATE_PREEMPT_RESCHED_BITS
With the changes that enable preempt count to track IRQ disabling
nesting, we don't have enough bits in 32-bit preempt count
implementation, as a result we move NMI nesting bits out of the 32-bit
preempt count. However on the architectures that can support 64-bit
preempt count implementation, we can keep the NMI nesting bits in the
32-bit preempt count and avoid maintaining NMI nesting bits outside of
the same cache line.

Therefore HAS_SEPARATE_PREEMPT_RESCHED_BITS is introduced to allow
architectures to select this. Note that under this Kconfig, preempt
count is maintained in a 64-bit word however preempt_count() still
remains as an int because all the effective bits still fit in
(previously we mask out NEED_RESCHED bit in preempt_count()). This
should make no functional changes for existing preempt_count() users.

Enable this for x86_64 along with the introduction of the Kconfig.

[boqun: Undo the __preempt_count_{add,sub}() optimization in 32-bit
preempt count since it may introduce {over,under}flow]

Originally-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804161447.84806-11-boqun@kernel.org
2026-08-10 10:50:19 +02:00
Boqun Feng
560fcaa92e sched: Avoid signed comparison of preempt_count() in __cant_migrate()
Currently preempt_count() is always a non-negative int on all archs
(PREEMPT_NEED_RESCHED archs will mask out the MSB when returning
preempt_count()), hence the checking in __cant_migrate() is in fact just
checking whether preempt_count() is 0 or not. In a future change, we are
going to use all the 32 bits of preempt_count(), which would make
negative int values possible from preempt_count(). Therefore convert the
"> 0" comparison into a zero check to prepare for the future change.
No functional changes are intended.

Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804161447.84806-10-boqun@kernel.org
2026-08-10 10:50:19 +02:00
Boqun Feng
ac4231a779 sched: Remove the unused preempt_offset parameter of __cant_sleep()
The preempt_offset is always 0 in all the callsites of __cant_sleep(),
hence remove it. It also allows us to clear up the code a bit by
no longer using a "preempt_count() > .." comparison.

Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804161447.84806-9-boqun@kernel.org
2026-08-10 10:50:19 +02:00
Boqun Feng
1b08668748 locking: Switch to _irq_{disable,enable}() variants in cleanup guards
The semantics of various IRQ disabling guards match what
*_irq_{disable,enable}() provide, i.e. the interrupt disabling is
properly nested, therefore it's OK to switch to use
*_irq_{disable,enable}() primitives.

[boqun: Adjust the user-side changes in do_sched_cfs_*_timer() provided
by Peter and Lyude]

Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804161447.84806-8-boqun@kernel.org
2026-08-10 10:50:18 +02:00
Lyude Paul
07a88e2bcd irq: Add KUnit test for refcounted interrupt enable/disable
While making changes to the refcounted interrupt patch series, at some
point on my local branch I broke something and ended up writing some kunit
tests for testing refcounted interrupts as a result. So, let's include
these tests now that we have refcounted interrupts.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804161447.84806-7-boqun@kernel.org
2026-08-10 10:50:18 +02:00
Boqun Feng
e901c1510e irq,spin_lock: Add counted interrupt disabling/enabling
Currently the nested interrupt disabling and enabling is represented by
_irqsave() and _irqrestore() APIs, which are relatively unsafe, for
example:

	<interrupts are enabled as beginning>
	spin_lock_irqsave(l1, flag1);
	spin_lock_irqsave(l2, flag2);
	spin_unlock_irqrestore(l1, flags1);
	<l2 is still held but interrupts are enabled>
	// accesses to interrupt-disable protected data will cause races

This is even easier to trigger with guard facilities:

	unsigned long flag2;

	scoped_guard(spin_lock_irqsave, l1) {
		spin_lock_irqsave(l2, flag2);
	}
	// l2 locked but interrupts are enabled.
	spin_unlock_irqrestore(l2, flag2);

(Hand-to-hand locking critical sections are not uncommon for a
fine-grained lock design)

And because of this unsafety, Rust cannot easily wrap the
interrupt-disabling locks in a safe API, which complicates the design.

To resolve this, introduce a new set of interrupt disabling APIs:

*	local_interrupt_disable();
*	local_interrupt_enable();

They work like local_irq_save() and local_irq_restore() except that 1)
the outermost local_interrupt_disable() call saves the interrupt state
into a per-CPU variable, so that the outermost local_interrupt_enable()
can restore the state, and 2) a per-CPU counter is added to record the
nest level of these calls, so that interrupts are not accidentally
enabled inside the outermost critical section.

Also add the corresponding spin_lock primitives: spin_lock_irq_disable()
and spin_unlock_irq_enable(), as a result, code as follows:

	spin_lock_irq_disable(l1);
	spin_lock_irq_disable(l2);
	spin_unlock_irq_enable(l1);
	// Interrupts are still disabled.
	spin_unlock_irq_enable(l2);

doesn't have the issue that interrupts are accidentally enabled.

This also makes the wrapper of interrupt-disabling locks on Rust easier
to design.

[boqun: Apply Peter's feedback and fix spell errors reported by Ingo]
[boqun: Address the duplicate spin_acquire() spotted by sashiko]
Co-developed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804182657.87716-1-boqun@kernel.org
2026-08-10 10:50:18 +02:00
Linus Torvalds
b9b3e33b70 tracing fixes for 7.2:
- Fix use-after-free in eventfs_remove_rec()
 
   The freeing of the eventfs_inode children used list_for_each_entry() where
   the child is freed via srcu, but there's still a chance that it gets freed.
   It should be using list_for_each_entry_safe().
 
 - Fix eventfs_inode SRCU use of list in freeing
 
   The iterator uses an SRCU protected list walk on the eventfs inodes. The
   eventfs inode uses its "list" field in a union with the RCU list head.
   When the inode gets added to the SRCU list it immediately corrupts the
   list pointer and can cause an issue with the iterator. Move the RCU list
   head to be shared with the children list head which allows the iterator to
   check the parent inode if is freed before referencing the child. Have the
   iterator check the parent "is_freed" field and break out if it is set.
   Also add memory barriers to make sure the ordering is correct.
 
 - Fix various RCU synchronization issues with direct_functions
 
   Updates to direct_functions have some missing RCU protection and
   synchronization. Restructure the code a bit to make sure updates to the
   direct_functions are protected.
 
 - Remove an unneeded comma from a scope_guard()
 
   There's a spurious comma in a scope_guard(). Remove it.
 
 - Fix race in per CPU buffer swap in the ring buffer
 
   When a per CPU buffer swap happens, it must make sure that it doesn't
   occur while a writer is active. Instead it returns an -EBUSY. But there's
   a small race window when a writer moves from one sub-buffer to the next
   that it resets the "committing" counter. If a swap happens at that moment,
   the buffer used for the commit of an event will not match the buffer the
   event is actually on. Instead of using the "committing" counter, use the
   recursive detection counter that does not get reset when the writer
   crosses sub-buffers.
 
 - Fix off-by-one in ftrace_free_mem()
 
   The function ftrace_free_mem() gets an "end_ptr" as a parameter that is
   exclusive to the rang to be freed. But its value is used to search for the
   records that expects an inclusive value. Subtract one from the parameter
   to convert it to an inclusive range.
 
 - Disable resizing of the ring buffer for persistent buffers
 
   Resizing the persistent buffer has undefined behavior. Prevent it from
   being resized.
 
 - Disable changing ring buffer subbuf order when resizing is disabled
 
   The ring buffer subbuffer order can not be changed during resizing. Use
   that instead of just checking if the buffer is mapped as mapped buffers
   also have resizing disabled.
 
 - Initialize subbuf_order of reader pages when they are created
 
   In rb_allocate_cpu_buffer() the bpage->order is not updated to the current
   subbuf_order leaving it as zero. This value is used when the page is freed.
 
 - Fix test_ringbuffer() to test for ERR_PTR before calling kthread_stop()
 
   The rb_threads[] array is assigned the output of kthread_run_on_cpu()
   which could return an ERR_PTR. At the end of the test, all threads in the
   array are cleaned up by kthread_stop() passing in the value in the array
   if it isn't zero. But if the array contains an ERR_PTR, kthread_stop()
   will not be able to handle it properly.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCanicmBQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6quonAP9HgM214Bt43edhuJb3oFy9fdS+sqYZ
 RIJ9q90iMDUH0AEAk3650lu7u80YniD4INKNrz5QMM2EbIMaNqtqwkS8uwQ=
 =tZwi
 -----END PGP SIGNATURE-----

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

Pull tracing fixes from Steven Rostedt:

 - Fix use-after-free in eventfs_remove_rec()

   The freeing of the eventfs_inode children used list_for_each_entry()
   where the child is freed via srcu, but there's still a chance that it
   gets freed. It should be using list_for_each_entry_safe().

 - Fix eventfs_inode SRCU use of list in freeing

   The iterator uses an SRCU protected list walk on the eventfs inodes.
   The eventfs inode uses its "list" field in a union with the RCU list
   head. When the inode gets added to the SRCU list it immediately
   corrupts the list pointer and can cause an issue with the iterator.
   Move the RCU list head to be shared with the children list head which
   allows the iterator to check the parent inode if is freed before
   referencing the child. Have the iterator check the parent "is_freed"
   field and break out if it is set. Also add memory barriers to make
   sure the ordering is correct.

 - Fix various RCU synchronization issues with direct_functions

   Updates to direct_functions have some missing RCU protection and
   synchronization. Restructure the code a bit to make sure updates to
   the direct_functions are protected.

 - Remove an unneeded comma from a scope_guard()

   There's a spurious comma in a scope_guard(). Remove it.

 - Fix race in per CPU buffer swap in the ring buffer

   When a per CPU buffer swap happens, it must make sure that it doesn't
   occur while a writer is active. Instead it returns an -EBUSY. But
   there's a small race window when a writer moves from one sub-buffer
   to the next that it resets the "committing" counter. If a swap
   happens at that moment, the buffer used for the commit of an event
   will not match the buffer the event is actually on. Instead of using
   the "committing" counter, use the recursive detection counter that
   does not get reset when the writer crosses sub-buffers.

 - Fix off-by-one in ftrace_free_mem()

   The function ftrace_free_mem() gets an "end_ptr" as a parameter that
   is exclusive to the rang to be freed. But its value is used to search
   for the records that expects an inclusive value. Subtract one from
   the parameter to convert it to an inclusive range.

 - Disable resizing of the ring buffer for persistent buffers

   Resizing the persistent buffer has undefined behavior. Prevent it
   from being resized.

 - Disable changing ring buffer subbuf order when resizing is disabled

   The ring buffer subbuffer order can not be changed during resizing.
   Use that instead of just checking if the buffer is mapped as mapped
   buffers also have resizing disabled.

 - Initialize subbuf_order of reader pages when they are created

   In rb_allocate_cpu_buffer() the bpage->order is not updated to the
   current subbuf_order leaving it as zero. This value is used when the
   page is freed.

 - Fix test_ringbuffer() to test for ERR_PTR before calling
   kthread_stop()

   The rb_threads[] array is assigned the output of kthread_run_on_cpu()
   which could return an ERR_PTR. At the end of the test, all threads in
   the array are cleaned up by kthread_stop() passing in the value in
   the array if it isn't zero. But if the array contains an ERR_PTR,
   kthread_stop() will not be able to handle it properly.

* tag 'trace-v7.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  ring-buffer: Fix crash passing ERR_PTR to kthread_stop()
  ring-buffer: Initialise reader page order in rb_allocate_cpu_buffer()
  ring-buffer: Prevent subbuf order change when resizing is disabled
  ring-buffer: Prevent resizing of persistent ring buffer
  ftrace: Fix off-by-one fentry site disable in ftrace_free_mem()
  ring-buffer: Use current_context for safe per-CPU buffer swap
  ftrace: Drop extra comma in trace_buffered_event_enable
  ftrace: Protect direct_functions in update_ftrace_direct_mod
  ftrace: Protect direct_functions in update_ftrace_direct_del
  ftrace: Protect direct_functions in ftrace_find_rec_direct
  eventfs: Use children field for rcu head and add memory barriers
  eventfs: Fix use-after-free in eventfs_remove_rec()
2026-08-09 08:47:31 -07:00
Hui Su
91542863ab ring-buffer: Fix crash passing ERR_PTR to kthread_stop()
In test_ringbuffer()'s out_free cleanup loop, the check
`!rb_threads[cpu]` only catches NULL entries and misses entries that
hold an ERR_PTR.

rb_threads[] is static, so unassigned slots are NULL. But when
kthread_run_on_cpu() fails for a cpu, it stores ERR_PTR(-ENOMEM) (or
-EINTR) in rb_threads[cpu] before the creation loop jumps to out_free.
That entry is non-NULL, so the old `!ptr` check does not break, and the
cleanup proceeds to call kthread_stop() on the ERR_PTR. kthread_stop()
then dereferences the bogus pointer, crashing the kernel during the
late_initcall self-test.

crash logs:
  BUG: kernel NULL pointer dereference, address: 000000000000001c
  Oops: 0002 [#1] SMP NOPTI
  CPU: 1 PID: 1 Comm: swapper/0 Not tainted 7.2.0-rc6-dirty #7 PREEMPT(lazy)
  RIP: 0010:kthread_stop+0x2e/0x220
  RBX: fffffffffffffff4
  CR2: 000000000000001c
  Call Trace:
   <TASK>
   test_ringbuffer+0x1ec/0x650
   do_one_initcall+0x6c/0x2c0
   kernel_init_freeable+0x21d/0x420
   kernel_init+0x15/0x1c0
   ret_from_fork+0x21b/0x320
   </TASK>
  Kernel panic - not syncing: Fatal exception

Cc: stable@vger.kernel.org
Fixes: 64ed3a049e ("ring-buffer: make use of the helper function kthread_run_on_cpu()")
Link: https://patch.msgid.link/20260807154145.2846521-2-sh_def@163.com
Signed-off-by: Hui Su <sh_def@163.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-08-08 22:26:30 -04:00
Vincent Donnefort
6d014e44b6 ring-buffer: Initialise reader page order in rb_allocate_cpu_buffer()
In rb_allocate_cpu_buffer(), bpage->order was omitted, leaving it as 0.
This is an issue for a ring-buffer with subbufs bigger than PAGE_SIZE if
when freed: free_buffer_page() relies on this value. Align the value
with the actual allocation size (buffer::subbuf_order).

Cc: stable@vger.kernel.org
Fixes: f9b94daa54 ("ring-buffer: Set new size of the ring buffer sub page")
Link: https://patch.msgid.link/20260806211306.3704194-4-vdonnefort@google.com
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-08 22:26:11 -04:00
Vincent Donnefort
bf98d7b0d5 ring-buffer: Prevent subbuf order change when resizing is disabled
Because ring_buffer_subbuf_order_set() frees buffer pages, we can't
allow it when resizing is disabled. A non-consuming reader is at risk of
use-after-free (rb_advance_iter()).

Return -EBUSY on resize_disabled, matching ring_buffer_resize()
behaviour.

Cc: stable@vger.kernel.org
Fixes: f9b94daa54 ("ring-buffer: Set new size of the ring buffer sub page")
Link: https://patch.msgid.link/20260806211306.3704194-3-vdonnefort@google.com
Reported-by: syzbot+e0cc44465d6bae735679@syzkaller.appspotmail.com
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-08 22:23:45 -04:00
Vincent Donnefort
7c727dfce6 ring-buffer: Prevent resizing of persistent ring buffer
Dynamically resizing a persistent ring buffer is not possible. Disable
the feature.

Cc: stable@vger.kernel.org
Fixes: be68d63a13 ("ring-buffer: Add ring_buffer_alloc_range()")
Link: https://patch.msgid.link/20260806211306.3704194-2-vdonnefort@google.com
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-08 22:23:18 -04:00
Josh Poimboeuf
8b8292d648 ftrace: Fix off-by-one fentry site disable in ftrace_free_mem()
When a module's init text is freed, do_init_module() calls
ftrace_free_mem() with a half-open [start, end) range.  However the
ftrace_cmp_recs() comparator treats the upper bound as inclusive, as all
its other users do, passing 'ip + size - 1'.  So ftrace_free_mem() can
delete a record sitting exactly at 'end', which is outside the freed
range.

For a kernel without CFI or IBT, the first record of a function is at
the function start, which for the first function in a module is also the
base of its text allocation.  As the module allocator packs its regions,
that address is often the 'end' passed by a neighboring module's
do_init_module(), causing the first function's ftrace location to get
disabled, preventing an attempt to livepatch it:

  livepatch: failed to find location for function 'pcspkr_probe'

Convert the exclusive end to the inclusive 'end - 1' the comparator
expects, and return early for an empty range to avoid the subtraction
from underflowing when the init text size is zero.

Cc: stable@vger.kernel.org
Fixes: 42c269c88d ("ftrace: Allow for function tracing to record init functions on boot up")
Link: https://patch.msgid.link/1b5ccfa8095bdb1277f84af1c2c2e2205aca03ae.1785992188.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-08 22:22:41 -04:00