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: <tip-be6a2e4c46cc122ba9113ba569fbc50fad075fff@git.kernel.org>
Date:   Tue, 4 Oct 2016 01:06:56 -0700
From:   tip-bot for Ingo Molnar <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     mingo@...nel.org, kernel@...ivas.org, linux-kernel@...r.kernel.org,
        tglx@...utronix.de, peterz@...radead.org, xiaolong.ye@...el.com,
        cchalpha@...il.com, hpa@...or.com
Subject: [tip:sched/urgent] Revert "sched/core: Do not use
 smp_processor_id() with preempt enabled in smpboot_thread_fn()"

Commit-ID:  be6a2e4c46cc122ba9113ba569fbc50fad075fff
Gitweb:     http://git.kernel.org/tip/be6a2e4c46cc122ba9113ba569fbc50fad075fff
Author:     Ingo Molnar <mingo@...nel.org>
AuthorDate: Tue, 4 Oct 2016 09:55:57 +0200
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 4 Oct 2016 09:55:57 +0200

Revert "sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()"

This reverts commit 4fa5cd5245b627db88c9ca08ae442373b02596b4.

The original change widens a preempt-off section, to avoid a seemingly unsafe
smp_processor_id() use.

During review I overlooked two facts:

 - The code to calls a non-trivial function callback:

                                ht->park(td->cpu);

   ... which might (and does occasionally) sleep, triggering the warning.

 - More importantly, as pointed out by Peter Zijlstra, using
   smp_processor_id() in that context is safe, if it's done from
   a kernel thread that is pinned to a single CPU - which is the
   case here.

So revert to the original code that enables preemption sooner.

Reported-by: kernel test robot <xiaolong.ye@...el.com>
Acked-by: Peter Zijlstra <peterz@...radead.org>
Cc: Con Kolivas <kernel@...ivas.org>
Cc: Alfred Chen <cchalpha@...il.com>
Link: http://lkml.kernel.org/r/20160930015102.GB20189@yexl-desktop
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index fc0d8270..13bc43d 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -122,12 +122,12 @@ static int smpboot_thread_fn(void *data)
 
 		if (kthread_should_park()) {
 			__set_current_state(TASK_RUNNING);
+			preempt_enable();
 			if (ht->park && td->status == HP_THREAD_ACTIVE) {
 				BUG_ON(td->cpu != smp_processor_id());
 				ht->park(td->cpu);
 				td->status = HP_THREAD_PARKED;
 			}
-			preempt_enable();
 			kthread_parkme();
 			/* We might have been woken for stop */
 			continue;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ