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>] [day] [month] [year] [list]
Date:   Tue, 22 Jun 2021 21:55:59 -0700
From:   Elliot Berman <eberman@...eaurora.org>
To:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Boqun Feng <boqun.feng@...il.com>
Cc:     Elliot Berman <eberman@...eaurora.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] lockdep: Remove console_verbose when disable lock debugging

debug_locks_off can be called in scenarios where the kernel doesn't
immediately panic. For instance, debug_locks_off is called with a
mismatched preempt_count or when registering an improper lockdep map
and fails the sanity check for lock-class key [1]. Both of these issues
were discovered in vendor kernel code and were fixed.

When console_verbose is enabled, we have found that kernel tends to be
unstable because it is spending much of its time printing to the serial
log, so the system may miss watchdog pats. We explicitly set our system
to reduce the loglevel in order to prevent such scenarios, however
lockdep can circumvent the commandline setting. Thus, when we ran into
the kernel bugs, we first ended up trying to debug why the kernel wasn't
able to respond to watchdog pets and why it was spending all of its time
flushing the console, which did not quickly lead us to the "real"
lock dependency issue.

Remove the console_verbose when turning off lock debugging. Other debug
facilities, such as KASAN, KFENCE, SPINLOCK_DEBUG, and DEBUG_OBJECTS
don't set console_verbose when issues are detected. Current other uses
for console_verbose are in situations where kernel is in a panic path.

[1]: kernel/locking/lockdep.c:lockdep_init_map_waits:4617

Signed-off-by: Elliot Berman <eberman@...eaurora.org>
---
 lib/debug_locks.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/debug_locks.c b/lib/debug_locks.c
index 06d3135bd184..f91b5d31f63c 100644
--- a/lib/debug_locks.c
+++ b/lib/debug_locks.c
@@ -38,12 +38,8 @@ EXPORT_SYMBOL_GPL(debug_locks_silent);
  */
 noinstr int debug_locks_off(void)
 {
-	if (debug_locks && __debug_locks_off()) {
-		if (!debug_locks_silent) {
-			console_verbose();
-			return 1;
-		}
-	}
+	if (debug_locks && __debug_locks_off() && !debug_locks_silent)
+		return 1;
 	return 0;
 }
 EXPORT_SYMBOL_GPL(debug_locks_off);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ