mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] livepatch: Do not lose exiting tasks during a transition
@ 2026-11-23 20:52 Binoy Ravindran via B4 Relay
  2026-11-23 20:52 ` [PATCH 1/2] rcu-tasks: Add helpers to visit tasks on the exit lists Binoy Ravindran via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Binoy Ravindran via B4 Relay @ 2026-11-23 20:52 UTC (permalink / raw)
  To: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang,
	Josh Poimboeuf, Miroslav Benes, Petr Mladek, Joe Lawrence,
	Song Liu, Ingo Molnar, Jiri Kosina
  Cc: rcu, linux-kernel, live-patching, Yafang Shao, Jaidev Shastri,
	Binoy Ravindran

After exit_notify(), a self-reaping task is unhashed from the task list
but keeps running the rest of do_exit(). The livepatch transition walks
the task list, so it can complete while such a task still runs code from
a patch module that atomic replace is about to free. Yafang Shao and
Petr Mladek discussed this race in [1]. It is hard to hit, but it is
reachable by any livepatch that replaces a function on the exit path,
for example a fix to do_exit() itself.

Every exiting task is already on an RCU-tasks exit list from
exit_tasks_rcu_start(), before exit_notify(), until
exit_tasks_rcu_finish(). After that, do_exit() runs with preemption
disabled until the final switch, so the task cannot sleep or be
preempted. Patch 1 adds helpers to visit the tasks on these lists.
Patch 2 makes every transition step, including reverse and force,
visit them too. The exit path itself is unchanged. Kernels without
CONFIG_TASKS_RCU have no exit lists and are not covered.

We reproduced the crash with two atomic-replace livepatches of the
CVE-2025-38424 fix, which replaces do_exit(). With a debug-only sleep
after exit_notify(), 11 of 12 runs crash without the series and none
with it. With it, there were also no crashes in 1,200 cycles of a /proc
stress test or in 400 cycles with preempt=full. The measurements were
taken on v6.12.1. This series is the forward port to v7.4-rc2. On
mainline it has been build-tested only: it builds without new warnings
with livepatch on, with livepatch on and preemption off, and with
TASKS_RCU off. It has not yet been run on mainline. A reproducer and the
logs are available on request.

[1] https://lore.kernel.org/all/20250127063526.76687-1-laoar.shao@gmail.com/

---
Binoy Ravindran (2):
      rcu-tasks: Add helpers to visit tasks on the exit lists
      livepatch: Include exiting tasks in the transition

 include/linux/rcupdate.h      |  9 ++++++
 kernel/livepatch/transition.c | 72 +++++++++++++++++++++++++++++++++++++++++++
 kernel/rcu/tasks.h            | 67 ++++++++++++++++++++++++++++++++++++----
 3 files changed, 142 insertions(+), 6 deletions(-)
---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261123-klp-series-v3-d52796c0590f

Best regards,
--  
Binoy Ravindran <binoy@vt.edu>



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-24  4:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 20:52 [PATCH 0/2] livepatch: Do not lose exiting tasks during a transition Binoy Ravindran via B4 Relay
2026-11-23 20:52 ` [PATCH 1/2] rcu-tasks: Add helpers to visit tasks on the exit lists Binoy Ravindran via B4 Relay
2026-11-23 20:52 ` [PATCH 2/2] livepatch: Include exiting tasks in the transition Binoy Ravindran via B4 Relay
2026-11-23 22:40 ` [PATCH 0/2] livepatch: Do not lose exiting tasks during a transition Ravindran, Binoy
2026-11-24  4:00   ` Yafang Shao
2026-11-24  4:57     ` Ravindran, Binoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®