diff options
| author | Babanpreet Singh <bbnpreetsingh@gmail.com> | 2026-10-02 01:21:41 +0000 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-12 11:13:01 +0200 |
| commit | 12e19bba68ba4ef222033ff9a3b63df07b7fad38 (patch) | |
| tree | eba52444903795eb1360ec3c8df065f244d75f93 /kernel | |
| parent | 2ec5a070946165c66b4ee1190016d5a8e44dc055 (diff) | |
pid: use READ_ONCE() in pid_alive()
KCSAN reports pid_alive() reading task->thread_pid while it gets cleared
under tasklist_lock. The check only cares about NULL, so READ_ONCE() and
WRITE_ONCE() are enough.
Reported-by: syzbot+c382ee653fd70f5cf1bb@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c382ee653fd70f5cf1bb
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
Link: https://patch.msgid.link/20261002012141.7-1-bbnpreetsingh@gmail.com
Acked-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/pid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 95b8ccfa8269..adf721606768 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); for (tmp = PIDTYPE_MAX; --tmp >= 0; ) if (pid_has_task(pid, tmp)) |
