From: Oleg Nesterov <oleg@redhat.com>
To: Babanpreet Singh <bbnpreetsingh@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
syzbot+c382ee653fd70f5cf1bb@syzkaller.appspotmail.com
Subject: Re: [PATCH] pid: use READ_ONCE() in pid_alive()
Date: Fri, 2 Oct 2026 13:59:06 +0200 [thread overview]
Message-ID: <ar-cijUnCr1L8urs@redhat.com> (raw)
In-Reply-To: <20261002012141.7-1-bbnpreetsingh@gmail.com>
On 10/02, Babanpreet Singh wrote:
>
> --- a/include/linux/pid.h
> +++ b/include/linux/pid.h
> @@ -264,7 +264,7 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)
> */
> static inline int pid_alive(const struct task_struct *p)
> {
> - return p->thread_pid != NULL;
> + return READ_ONCE(p->thread_pid) != NULL;
> }
>
> static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
> diff --git a/kernel/pid.c b/kernel/pid.c
> index 95b8ccfa82690..adf7216067684 100644
> --- a/kernel/pid.c
> +++ b/kernel/pid.c
> @@ -411,7 +411,7 @@ static void __change_pid(struct pid **pids, struct task_struct *task,
> pid = *pid_ptr;
>
> hlist_del_rcu(&task->pid_links[type]);
> - *pid_ptr = new;
> + WRITE_ONCE(*pid_ptr, new);
Acked-by: Oleg Nesterov <oleg@redhat.com>
next prev parent reply other threads:[~2026-10-02 11:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 1:21 [PATCH] pid: use READ_ONCE() in pid_alive() Babanpreet Singh
2026-10-02 6:33 ` Bradley Morgan
2026-10-02 11:59 ` Oleg Nesterov [this message]
2026-10-03 17:22 ` David Laight
2026-10-04 10:55 ` Oleg Nesterov
2026-10-04 11:11 ` Oleg Nesterov
2026-10-04 11:51 ` David Laight
2026-10-04 13:14 ` Oleg Nesterov
2026-10-04 13:31 ` David Laight
2026-10-05 15:03 ` Oleg Nesterov
2026-10-05 18:46 ` David Laight
2026-10-12 9:13 ` Christian Brauner
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=ar-cijUnCr1L8urs@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bbnpreetsingh@gmail.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ptikhomirov@virtuozzo.com \
--cc=syzbot+c382ee653fd70f5cf1bb@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.