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]
Date:	Mon, 16 May 2011 20:55:51 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
	Mike Galbraith <efault@....de>,
	Yong Zhang <yong.zhang0@...il.com>
Subject: [PATCH] sched: fix priority leakage in pick_next_highest_task_rt()

When picking the second highest RT task for a given runqueue, if no
task found after scanning the queue of priority == idx, the next idx
should also be checked even in case that next is already existing, or
the window of priority leakage could be opened.

Signed-off-by: Hillf Danton <dhillf@...il.com>
---

--- a/kernel/sched_rt.c	2011-04-27 11:48:50.000000000 +0800
+++ b/kernel/sched_rt.c	2011-05-16 19:58:42.000000000 +0800
@@ -1166,6 +1166,8 @@ static struct task_struct *pick_next_hig
 	int idx;

 	for_each_leaf_rt_rq(rt_rq, rq) {
+		struct task_struct *this;
+
 		array = &rt_rq->active;
 		idx = sched_find_first_bit(array->bitmap);
 next_idx:
@@ -1173,6 +1175,7 @@ next_idx:
 			continue;
 		if (next && next->prio < idx)
 			continue;
+		this = NULL;
 		list_for_each_entry(rt_se, array->queue + idx, run_list) {
 			struct task_struct *p;

@@ -1181,11 +1184,15 @@ next_idx:

 			p = rt_task_of(rt_se);
 			if (pick_rt_task(rq, p, cpu)) {
-				next = p;
+				this = p;
 				break;
 			}
 		}
-		if (!next) {
+		if (this != NULL)
+			next = this;
+		else {	/*
+			 * we have to check next idx even if next != NULL
+			 */
 			idx = find_next_bit(array->bitmap, MAX_RT_PRIO, idx+1);
 			goto next_idx;
 		}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ