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]
Date:	Mon, 22 Sep 2008 19:47:09 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Aristeu Rozanski <aris@...hat.com>
Cc:	linux-kernel@...r.kernel.org, dzickus@...hat.com,
	prarit@...hat.com, vgoyal@...hat.com
Subject: Re: [PATCH] NMI watchdog: setup before enabling NMI watchdog


* Aristeu Rozanski <aris@...hat.com> wrote:

> There's a small window when NMI watchdog is being set up that if any NMIs
> are triggered, the NMI code will make make use of not initalized wd_ops
> elements:
> 	void setup_apic_nmi_watchdog(void *unused)
> 	{       
> 		if (__get_cpu_var(wd_enabled))
> 			return;
> 
> 		/* cheap hack to support suspend/resume */
> 		/* if cpu0 is not active neither should the other cpus */
> 		if (smp_processor_id() != 0 && atomic_read(&nmi_active) <= 0)
> 			return;
> 
> 		switch (nmi_watchdog) {
> 		case NMI_LOCAL_APIC:
> 			/* enable it before to avoid race with handler */
> -->			__get_cpu_var(wd_enabled) = 1;
> -->			if (lapic_watchdog_init(nmi_hz) < 0) {
> (...)
> 	asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
> 	{       
> 	(...)
> 			if (nmi_watchdog_tick(regs, reason))
> 				return;
> (...)
> 	notrace __kprobes int
> 	nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
> 	{       
> 	(...)
> 		if (!__get_cpu_var(wd_enabled))
> 			return rc;
> 		switch (nmi_watchdog) {
> 		case NMI_LOCAL_APIC:
> 			rc |= lapic_wd_event(nmi_hz);
> (...)
> int lapic_wd_event(unsigned nmi_hz)
> {       
> 	struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
> 	u64 ctr;
> 
> -->	rdmsrl(wd->perfctr_msr, ctr);
> 
> and wd->*_msr will be initialized on each processor type specific setup, after
> enabling NMIs for PMIs. Since the counter was just set, the chances of an
> performance counter generated NMI is minimal, but any other unknown NMI would
> trigger the problem. This patch fixes the problem by setting everything up
> before enabling performance counter generated NMIs and will set wd_enabled
> using a callback function.
> 
> Signed-off-by: Aristeu Rozanski <aris@...hat.com>
> Acked-by: Don Zickus <dzickus@...hat.com>
> Acked-by: Prarit Bhargava <prarit@...hat.com>
> Acked-by: Vivek Goyal <vgoyal@...hat.com>

applied to tip/x86/nmi-watchdog, thanks Aristeu!

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ