Re: [PATCH] ipc: fix to protect IPCS lookups using RCU instead of semaphore
From: Andrew Morton
Date: Fri Feb 14 2025 - 18:21:35 EST
On Sat, 15 Feb 2025 03:01:57 +0900 Jeongjun Park <aha310510@xxxxxxxxx> wrote:
> In shm_destroy_orphaned(), we are not performing updates to the IPCS and are
> only calling idr_for_each(), which can be protected by the RCU read-critical
> section.
>
> And if idr_for_each() is not protected by the RCU read-critical section,
> then when radix_tree_node_free() is called to free the struct radix_tree_node
> through call_rcu(), the node will be freed immediately, and when reading the
> next node in radix_tree_for_each_slot(), the memory that has already been
> freed may be read.
A use-after-free?
Is there any report of this occurring, or was this change a result of
code inspection? If the former, please share details (Link:,
Reported-by:, Closes:, etc).
> Therefore, I think it is appropriate to use RCU instead of semaphore to
> protect it.