From: Oleg Nesterov <oleg@redhat.com>
To: "Cen Zhang (Microsoft)" <blbllhy@gmail.com>
Cc: brauner@kernel.org, akpm@linux-foundation.org, jack@suse.cz,
avagin@gmail.com, ptikhomirov@virtuozzo.com, mjguzik@gmail.com,
include@grrlz.net, linux-kernel@vger.kernel.org,
AutonomousCodeSecurity@microsoft.com,
tgopinath@linux.microsoft.com, kys@microsoft.com,
stable@vger.kernel.org
Subject: Re: [PATCH v2 2/2] pid: fix cad_pid use-after-free race
Date: Sat, 18 Jul 2026 15:19:57 +0200 [thread overview]
Message-ID: <alt9fbrO1WlJg-Jh@redhat.com> (raw)
In-Reply-To: <20260718032000.9184-2-blbllhy@gmail.com>
On 07/17, Cen Zhang (Microsoft) wrote:
>
> int kill_cad_pid(int sig, int priv)
> {
> - return kill_pid(cad_pid, sig, priv);
> + struct pid *pid;
> + int ret;
> +
> + rcu_read_lock();
> + pid = get_pid(rcu_dereference(cad_pid));
> + rcu_read_unlock();
> +
> + ret = kill_pid(pid, sig, priv);
> + put_pid(pid);
Hmm. Why do we need get/put_pid() ? I think that
rcu_read_lock();
ret = kill_pid(rcu_dereference(cad_pid), sig, priv);
rcu_read_unlock();
return ret;
should work just fine?
Oleg.
next prev parent reply other threads:[~2026-07-18 13:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 3:19 [PATCH v2 1/2] pid: deinline kill_cad_pid Cen Zhang (Microsoft)
2026-07-18 3:20 ` [PATCH v2 2/2] pid: fix cad_pid use-after-free race Cen Zhang (Microsoft)
2026-07-18 11:54 ` Bradley Morgan
2026-07-18 13:19 ` Oleg Nesterov [this message]
2026-07-18 13:59 ` Bradley Morgan
2026-07-18 14:13 ` Oleg Nesterov
2026-07-18 14:28 ` Bradley Morgan
2026-07-18 15:37 ` Mateusz Guzik
2026-07-18 15:58 ` Oleg Nesterov
2026-07-18 10:24 ` [PATCH v2 1/2] pid: deinline kill_cad_pid Bradley Morgan
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=alt9fbrO1WlJg-Jh@redhat.com \
--to=oleg@redhat.com \
--cc=AutonomousCodeSecurity@microsoft.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@gmail.com \
--cc=blbllhy@gmail.com \
--cc=brauner@kernel.org \
--cc=include@grrlz.net \
--cc=jack@suse.cz \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=stable@vger.kernel.org \
--cc=tgopinath@linux.microsoft.com \
/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