Skip to contentSkip to conversation

pid-document-that-do_each_pid_task-needs-tasklist_lock.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Oct 12

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: pid: document that do_each_pid_task() needs tasklist_lock
has been removed from the -mm tree. Its filename was
pid-document-that-do_each_pid_task-needs-tasklist_lock.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Oleg Nesterov <[email protected]>
Subject: pid: document that do_each_pid_task() needs tasklist_lock
Date: Sun, 11 Oct 2026 16:16:51 +0200

do_each_pid_task() looks "obviously rcu-safe". This confuses people and we already have 2 buggy users: send_sigio() and send_sigurg().

The reasons why it is not are not obvious at all, add the comment.

---

 include/linux/pid.h |    9 +++++++++
 1 file changed, 9 insertions(+)
include/linux/pid.h renamed from include/linux/pid.h~pid-document-that-do_each_pid_task-needs-tasklist_lock +9 -0
@@ -187,6 +187,15 @@ static inline pid_t pid_nr(struct pid *p
 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
 pid_t pid_vnr(struct pid *pid);
 
+/*
+ * Needs tasklist_lock if type > PIDTYPE_TGID. A lockless reader can:
+ *
+ * - race with a change_pid() that moves the task to another hlist,
+ *   and continue to scan the wrong list.
+ *
+ * - race with a copy_process() that adds a new task to the start of hlist,
+ *   and miss the new child.
+ */
 #define do_each_pid_task(pid, type, task)				\
 	do {								\
 		if ((pid) != NULL)					\

_

Patches currently in -mm which might be from [email protected] are