Andrii Nakryiko 0cf981de76 uprobes: Ensure return_instance is detached from the list before freeing
Ensure that by the time we call free_ret_instance() to clean up an
instance of struct return_instance it isn't reachable from
utask->return_instances anymore.

free_ret_instance() is called in a few different situations, all but one
of which already are fine w.r.t. return_instance visibility:

  - uprobe_free_utask() guarantees that ri_timer() won't be called
    (through timer_delete_sync() call), and so there is no need to
    unlink anything, because entire utask is being freed;
  - uprobe_handle_trampoline() is already unlinking to-be-freed
    return_instance with rcu_assign_pointer() before calling
    free_ret_instance().

Only cleanup_return_instances() violates this property, which so far is
not causing problems due to RCU-delayed freeing of return_instance,
which we'll change in the next patch. So make sure we unlink
return_instance before passing it into free_ret_instance(), as otherwise
reuse will be unsafe.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Link: https://lore.kernel.org/r/20241206002417.3295533-4-andrii@kernel.org
2024-12-09 15:50:29 +01:00
..
2024-11-22 20:36:11 -08:00
2024-11-20 09:54:49 -08:00
2024-11-25 12:11:55 -08:00
2024-06-15 10:43:06 -07:00
2024-11-19 14:16:06 -08:00
2024-11-27 10:20:50 -08:00
2024-11-20 09:21:11 -08:00
2024-11-20 10:08:00 -08:00
2024-12-02 11:52:59 +01:00
2024-11-18 17:34:05 -08:00
2024-11-29 11:43:29 -08:00
2024-07-29 10:45:54 -07:00
2024-11-05 17:12:28 -08:00
2024-09-03 21:15:26 -07:00
2024-11-03 01:28:06 -05:00
2024-09-19 10:18:15 +02:00
2023-12-01 09:51:44 -08:00
2024-11-03 01:28:06 -05:00
2024-09-27 08:18:43 -07:00
2023-10-04 10:41:57 -07:00
2023-12-29 12:22:29 -08:00
2024-07-18 12:19:20 -07:00
2024-11-18 18:10:37 -08:00
2024-11-03 01:28:06 -05:00
2024-05-30 15:31:38 -07:00
2024-11-22 20:36:11 -08:00
2024-11-03 01:28:06 -05:00