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:   Sat, 12 Oct 2019 18:23:46 +0800
From:   Li RongQing <lirongqing@...du.com>
To:     akpm@...ux-foundation.org, sergey.senozhatsky.work@...il.com,
        linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: [PATCH] watchdog/hardlockup: reassign last_timestamp when enable nmi event

last_timestamp is not initialized and is zero after boot, or stop
to forward when nmi watchdog is disabled; and false positives still
is possible when restart NMI timer after stopping 120 seconds

so reassign last_timestamp always when enable nmi event

Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with turbo modes")
Signed-off-by: Li RongQing <lirongqing@...du.com>
---
 kernel/watchdog_hld.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 247bf0b1582c..fc3a5c7ccd82 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -189,6 +189,8 @@ static int hardlockup_detector_event_create(void)
  */
 void hardlockup_detector_perf_enable(void)
 {
+	ktime_t now = ktime_get_mono_fast_ns();
+
 	if (hardlockup_detector_event_create())
 		return;
 
@@ -196,6 +198,7 @@ void hardlockup_detector_perf_enable(void)
 	if (!atomic_fetch_inc(&watchdog_cpus))
 		pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
 
+	this_cpu_write(last_timestamp, now);
 	perf_event_enable(this_cpu_read(watchdog_ev));
 }
 
@@ -274,8 +277,12 @@ void __init hardlockup_detector_perf_restart(void)
 	for_each_online_cpu(cpu) {
 		struct perf_event *event = per_cpu(watchdog_ev, cpu);
 
-		if (event)
+		if (event) {
+			ktime_t now = ktime_get_mono_fast_ns();
+
+			per_cpu(last_timestamp, cpu) = now;
 			perf_event_enable(event);
+		}
 	}
 }
 
-- 
2.16.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ