/[packages]/backports/8/kernel/current/SOURCES/fs-procfs-do-not-list-TID-0-in-proc-pid-task.patch
ViewVC logotype

Contents of /backports/8/kernel/current/SOURCES/fs-procfs-do-not-list-TID-0-in-proc-pid-task.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1749863 - (show annotations) (download)
Thu Oct 7 11:59:42 2021 UTC (2 years, 6 months ago) by tmb
File size: 1276 byte(s)
- update to 5.14.10
- procfs: do not list TID 0 in /proc/<pid>/task


1 From 435664ed44c4a17e6715d007061e2b155d3535c8 Mon Sep 17 00:00:00 2001
2 From: Florian Weimer <fweimer@redhat.com>
3 Date: Fri, 1 Oct 2021 13:38:15 +1000
4 Subject: procfs: do not list TID 0 in /proc/<pid>/task
5
6 If a task exits concurrently, task_pid_nr_ns may return 0.
7
8 Link: https://lkml.kernel.org/r/8735pn5dx7.fsf@oldenburg.str.redhat.com
9 Signed-off-by: Florian Weimer <fweimer@redhat.com>
10 Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
11 Cc: Kees Cook <keescook@chromium.org>
12 Cc: "Eric W. Biederman" <ebiederm@xmission.com>
13 Cc: Alexey Dobriyan <adobriyan@gmail.com>
14 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
15 Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
16 ---
17 fs/proc/base.c | 3 +++
18 1 file changed, 3 insertions(+)
19
20 diff --git a/fs/proc/base.c b/fs/proc/base.c
21 index 533d5836eb9a4..54f29399088f0 100644
22 --- a/fs/proc/base.c
23 +++ b/fs/proc/base.c
24 @@ -3800,6 +3800,9 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
25 char name[10 + 1];
26 unsigned int len;
27 tid = task_pid_nr_ns(task, ns);
28 + if (!tid)
29 + /* The task has just exited. */
30 + continue;
31 len = snprintf(name, sizeof(name), "%u", tid);
32 if (!proc_fill_cache(file, ctx, name, len,
33 proc_task_instantiate, task, NULL)) {
34 --
35 cgit 1.2.3-1.el7
36

  ViewVC Help
Powered by ViewVC 1.1.30