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: <db5ea22c61ad4653a9c03a042cadee89@nokia-sbell.com>
Date:   Mon, 31 Aug 2020 07:02:15 +0000
From:   "Zhou, Libing (NSB - CN/Hangzhou)" <libing.zhou@...ia-sbell.com>
To:     "peterz@...radead.org" <peterz@...radead.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "bp@...en8.de" <bp@...en8.de>, "bp@...e.de" <bp@...e.de>,
        "x86@...nel.org" <x86@...nel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "hpa@...or.com" <hpa@...or.com>
Subject: RE: [PATCH v2] x86/nmi: Fix nmi_handle duration miscalculation

Hi,

Any comment on this?

-----Original Message-----
From: Libing Zhou <libing.zhou@...ia-sbell.com> 
Sent: 2020年8月20日 10:57
To: peterz@...radead.org; tglx@...utronix.de; mingo@...hat.com; bp@...en8.de; bp@...e.de; x86@...nel.org
Cc: linux-kernel@...r.kernel.org; Zhou, Libing (NSB - CN/Hangzhou) <libing.zhou@...ia-sbell.com>; hpa@...or.com
Subject: [PATCH v2] x86/nmi: Fix nmi_handle duration miscalculation

In nmi_check_duration(), the 'whole_msecs' value get from 'action->max_duration' is wrong.

Fixes: 248ed51048c4 ("x86/nmi: Remove irq_work from the long duration NMI handler")
Signed-off-by: Libing Zhou <libing.zhou@...ia-sbell.com>
---
v2:
Change solution as peterz@...radead.org suggested.

 arch/x86/kernel/nmi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index 4fc9954a9560..47381666d6a5 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -102,7 +102,6 @@ fs_initcall(nmi_warning_debugfs);
 
 static void nmi_check_duration(struct nmiaction *action, u64 duration)  {
-	u64 whole_msecs = READ_ONCE(action->max_duration);
 	int remainder_ns, decimal_msecs;
 
 	if (duration < nmi_longest_ns || duration < action->max_duration) @@ -110,12 +109,12 @@ static void nmi_check_duration(struct nmiaction *action, u64 duration)
 
 	action->max_duration = duration;
 
-	remainder_ns = do_div(whole_msecs, (1000 * 1000));
+	remainder_ns = do_div(duration, (1000 * 1000));
 	decimal_msecs = remainder_ns / 1000;
 
 	printk_ratelimited(KERN_INFO
 		"INFO: NMI handler (%ps) took too long to run: %lld.%03d msecs\n",
-		action->handler, whole_msecs, decimal_msecs);
+		action->handler, duration, decimal_msecs);
 }
 
 static int nmi_handle(unsigned int type, struct pt_regs *regs)
--
2.22.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ