Re: [PATCH 0/2] livepatch: Do not lose exiting tasks during a transition

From: Ravindran, Binoy

Date: Mon Nov 23 2026 - 17:40:29 EST



The two issues Sashiko reported on patch 2 are valid:

1. An exiting task that has not been unhashed is on both the task list
and an exit list, so klp_start_transition() can visit it twice and
set TIF_PATCH_PENDING again after it has switched.

2. Between exit_tasks_rcu_finish() and its final switch, an exiting
task is on neither list and can still enter patched code with a
stale patch_state.

v2 will walk the exit lists under tasklist_lock and skip tasks that are
still hashed, so each task is visited exactly once. It will also call
klp_synchronize_transition() before func->transition is set and before
completion, to wait out tasks in that last stretch. It will document
rtp_exit_cursor as well.

I'll post v2 after testing it on mainline. Please hold off on
reviewing v1.

Thanks,
Binoy