lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210126084651.32277-1-qiang.zhang@windriver.com>
Date:   Tue, 26 Jan 2021 16:46:51 +0800
From:   qiang.zhang@...driver.com
To:     valentin.schneider@....com
Cc:     peterz@...radead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] sched/core: add rcu_read_lock/unlock() protection

From: Zqiang <qiang.zhang@...driver.com>

Due to for_each_process_thread belongs to RCU read operation,
need to add rcu_read_lock/unlock() protection.

Signed-off-by: Zqiang <qiang.zhang@...driver.com>
---
 kernel/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8c5481077c9c..c3f0103fdf53 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7738,6 +7738,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
 	lockdep_assert_held(&rq->lock);
 
 	printk("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
+	rcu_read_lock();
 	for_each_process_thread(g, p) {
 		if (task_cpu(p) != cpu)
 			continue;
@@ -7747,6 +7748,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
 
 		printk("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
 	}
+	rcu_read_unlock();
 }
 
 int sched_cpu_dying(unsigned int cpu)
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ