LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] procfs: Do not list TID 0 in /proc/<pid>/task
@ 2021-09-29 20:23 Florian Weimer
2021-09-30 9:22 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2021-09-29 20:23 UTC (permalink / raw)
To: linux-fsdevel
Cc: Andrew Morton, Christian Brauner, Kees Cook, Eric W. Biederman,
linux-kernel
If a task exits concurrently, task_pid_nr_ns may return 0.
Signed-off-by: Florian Weimer <fweimer@redhat.com>
---
fs/proc/base.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 533d5836eb9a..54f29399088f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3800,6 +3800,9 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
char name[10 + 1];
unsigned int len;
tid = task_pid_nr_ns(task, ns);
+ if (!tid)
+ /* The task has just exited. */
+ continue;
len = snprintf(name, sizeof(name), "%u", tid);
if (!proc_fill_cache(file, ctx, name, len,
proc_task_instantiate, task, NULL)) {
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] procfs: Do not list TID 0 in /proc/<pid>/task
2021-09-29 20:23 [PATCH] procfs: Do not list TID 0 in /proc/<pid>/task Florian Weimer
@ 2021-09-30 9:22 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2021-09-30 9:22 UTC (permalink / raw)
To: Florian Weimer
Cc: linux-fsdevel, Andrew Morton, Kees Cook, Eric W. Biederman, linux-kernel
On Wed, Sep 29, 2021 at 10:23:32PM +0200, Florian Weimer wrote:
> If a task exits concurrently, task_pid_nr_ns may return 0.
>
> Signed-off-by: Florian Weimer <fweimer@redhat.com>
> ---
Looks good,
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-30 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 20:23 [PATCH] procfs: Do not list TID 0 in /proc/<pid>/task Florian Weimer
2021-09-30 9:22 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).