The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jeongjun Park <aha310510@gmail.com>
Cc: Liam.Howlett@Oracle.com, brauner@kernel.org,
	lorenzo.stoakes@oracle.com, willy@infradead.org,
	davidlohr.bueso@hp.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipc: fix to protect IPCS lookups using RCU instead of semaphore
Date: Fri, 14 Feb 2025 15:21:28 -0800	[thread overview]
Message-ID: <20250214152128.61a1054b90d1a53eff9cf16b@linux-foundation.org> (raw)
In-Reply-To: <20250214180157.10288-1-aha310510@gmail.com>

On Sat, 15 Feb 2025 03:01:57 +0900 Jeongjun Park <aha310510@gmail.com> 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.


  parent reply	other threads:[~2025-02-14 23:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 18:01 [PATCH] ipc: fix to protect IPCS lookups using RCU instead of semaphore Jeongjun Park
2025-02-14 18:58 ` Matthew Wilcox
2025-02-14 23:21 ` Andrew Morton [this message]
2025-02-15  5:00   ` Jeongjun Park
2025-02-15 17:39     ` Matthew Wilcox
2025-02-19 10:07       ` Jeongjun Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250214152128.61a1054b90d1a53eff9cf16b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Liam.Howlett@Oracle.com \
    --cc=aha310510@gmail.com \
    --cc=brauner@kernel.org \
    --cc=davidlohr.bueso@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox