Patch "x86/resctrl: Only show tasks' pid in current pid namespace" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/resctrl: Only show tasks' pid in current pid namespace

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-resctrl-only-show-tasks-pid-in-current-pid-names.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f906861f841781539273d274cbace0847588efd6
Author: Shawn Wang <shawnwang@xxxxxxxxxxxxxxxxx>
Date:   Mon May 15 14:04:48 2023 +0800

    x86/resctrl: Only show tasks' pid in current pid namespace
    
    [ Upstream commit 2997d94b5dd0e8b10076f5e0b6f18410c73e28bd ]
    
    When writing a task id to the "tasks" file in an rdtgroup,
    rdtgroup_tasks_write() treats the pid as a number in the current pid
    namespace. But when reading the "tasks" file, rdtgroup_tasks_show() shows
    the list of global pids from the init namespace, which is confusing and
    incorrect.
    
    To be more robust, let the "tasks" file only show pids in the current pid
    namespace.
    
    Fixes: e02737d5b826 ("x86/intel_rdt: Add tasks files")
    Signed-off-by: Shawn Wang <shawnwang@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
    Acked-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
    Acked-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
    Tested-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
    Link: https://lore.kernel.org/all/20230116071246.97717-1-shawnwang@xxxxxxxxxxxxxxxxx/
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 1a943743cfe4b..1e73b6fae3b4c 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -715,11 +715,15 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of,
 static void show_rdt_tasks(struct rdtgroup *r, struct seq_file *s)
 {
 	struct task_struct *p, *t;
+	pid_t pid;
 
 	rcu_read_lock();
 	for_each_process_thread(p, t) {
-		if (is_closid_match(t, r) || is_rmid_match(t, r))
-			seq_printf(s, "%d\n", t->pid);
+		if (is_closid_match(t, r) || is_rmid_match(t, r)) {
+			pid = task_pid_vnr(t);
+			if (pid)
+				seq_printf(s, "%d\n", pid);
+		}
 	}
 	rcu_read_unlock();
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux