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-f1b2f6eccf99fc457221cc84c7550a8e3b17d4df@git.kernel.org>
Date:   Tue, 11 Sep 2018 08:33:55 -0700
From:   tip-bot for Peter Zijlstra <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     hpa@...or.com, mingo@...nel.org, torvalds@...ux-foundation.org,
        tglx@...utronix.de, peterz@...radead.org,
        linux-kernel@...r.kernel.org
Subject: [tip:locking/core] locking/lockdep, cpu/hotplug: Annotate AP thread

Commit-ID:  f1b2f6eccf99fc457221cc84c7550a8e3b17d4df
Gitweb:     https://git.kernel.org/tip/f1b2f6eccf99fc457221cc84c7550a8e3b17d4df
Author:     Peter Zijlstra <peterz@...radead.org>
AuthorDate: Tue, 11 Sep 2018 11:51:27 +0200
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 11 Sep 2018 12:37:00 +0200

locking/lockdep, cpu/hotplug: Annotate AP thread

Anybody trying to assert the cpu_hotplug_lock is held (lockdep_assert_cpus_held())
from AP callbacks will fail, because the lock is held by the BP.

Stick in an explicit annotation in cpuhp_thread_fun() to make this work.

Reported-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-tip-commits@...r.kernel.org
Fixes: cb538267ea1e ("jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations")
Link: http://lkml.kernel.org/r/20180911095127.GT24082@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 0097acec1c71..08c168b159da 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -616,6 +616,12 @@ static void cpuhp_thread_fun(unsigned int cpu)
 	 */
 	smp_mb();
 
+	/*
+	 * The BP holds the hotplug lock, but we're now running on the AP,
+	 * ensure that anybody asserting the lock is held, will actually find
+	 * it so.
+	 */
+	rwsem_acquire(&cpu_hotplug_lock.rw_sem.dep_map, 0, 0, _THIS_IP_);
 	cpuhp_lock_acquire(bringup);
 
 	if (st->single) {
@@ -661,6 +667,7 @@ static void cpuhp_thread_fun(unsigned int cpu)
 	}
 
 	cpuhp_lock_release(bringup);
+	rwsem_release(&cpu_hotplug_lock.rw_sem.dep_map, 1, _THIS_IP_);
 
 	if (!st->should_run)
 		complete_ap_thread(st, bringup);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ