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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180927090311.031340865@linuxfoundation.org>
Date:   Thu, 27 Sep 2018 11:04:07 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steve Muckle <smuckle@...gle.com>,
        Chris Redpath <Chris.Redpath@....com>,
        John Dias <joaodias@...gle.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Miguel de Dios <migueldedios@...gle.com>,
        Morten Rasmussen <Morten.Rasmussen@....com>,
        Patrick Bellasi <Patrick.Bellasi@....com>,
        Paul Turner <pjt@...gle.com>,
        Quentin Perret <quentin.perret@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Todd Kjos <tkjos@...gle.com>, kernel-team@...roid.com,
        Ingo Molnar <mingo@...nel.org>
Subject: [PATCH 4.18 86/88] sched/fair: Fix vruntime_normalized() for remote non-migration wakeup

4.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Muckle <smuckle@...gle.com>

commit d0cdb3ce8834332d918fc9c8ff74f8a169ec9abe upstream.

When a task which previously ran on a given CPU is remotely queued to
wake up on that same CPU, there is a period where the task's state is
TASK_WAKING and its vruntime is not normalized. This is not accounted
for in vruntime_normalized() which will cause an error in the task's
vruntime if it is switched from the fair class during this time.

For example if it is boosted to RT priority via rt_mutex_setprio(),
rq->min_vruntime will not be subtracted from the task's vruntime but
it will be added again when the task returns to the fair class. The
task's vruntime will have been erroneously doubled and the effective
priority of the task will be reduced.

Note this will also lead to inflation of all vruntimes since the doubled
vruntime value will become the rq's min_vruntime when other tasks leave
the rq. This leads to repeated doubling of the vruntime and priority
penalty.

Fix this by recognizing a WAKING task's vruntime as normalized only if
sched_remote_wakeup is true. This indicates a migration, in which case
the vruntime would have been normalized in migrate_task_rq_fair().

Based on a similar patch from John Dias <joaodias@...gle.com>.

Suggested-by: Peter Zijlstra <peterz@...radead.org>
Tested-by: Dietmar Eggemann <dietmar.eggemann@....com>
Signed-off-by: Steve Muckle <smuckle@...gle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Chris Redpath <Chris.Redpath@....com>
Cc: John Dias <joaodias@...gle.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Miguel de Dios <migueldedios@...gle.com>
Cc: Morten Rasmussen <Morten.Rasmussen@....com>
Cc: Patrick Bellasi <Patrick.Bellasi@....com>
Cc: Paul Turner <pjt@...gle.com>
Cc: Quentin Perret <quentin.perret@....com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Todd Kjos <tkjos@...gle.com>
Cc: kernel-team@...roid.com
Fixes: b5179ac70de8 ("sched/fair: Prepare to fix fairness problems on migration")
Link: http://lkml.kernel.org/r/20180831224217.169476-1-smuckle@google.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

---
 kernel/sched/fair.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10019,7 +10019,8 @@ static inline bool vruntime_normalized(s
 	 * - A task which has been woken up by try_to_wake_up() and
 	 *   waiting for actually being woken up by sched_ttwu_pending().
 	 */
-	if (!se->sum_exec_runtime || p->state == TASK_WAKING)
+	if (!se->sum_exec_runtime ||
+	    (p->state == TASK_WAKING && p->sched_remote_wakeup))
 		return true;
 
 	return false;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ