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: <m1399j1ysk.fsf@fess.ebiederm.org>
Date:	Wed, 07 Mar 2012 20:50:35 -0800
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Fernando Luis Vázquez Cao 
	<fernando@....ntt.co.jp>
Cc:	Don Zickus <dzickus@...hat.com>, linux-tip-commits@...r.kernel.org,
	Yinghai Lu <yinghai@...nel.org>, mingo@...e.hu,
	kexec@...ts.infradead.org, linux-kernel@...r.kernel.org,
	mingo@...hat.com, hpa@...or.com, akpm@...ux-foundation.org,
	torvalds@...ux-foundation.org, tglx@...utronix.de,
	vgoyal@...hat.com
Subject: Re: [PATCH 2/2] boot: add early NMI counter

Fernando Luis Vázquez Cao <fernando@....ntt.co.jp> writes:

> Subject: [PATCH] boot: add early NMI counter
>
> From: Fernando Luis Vazquez Cao <fernando@....ntt.co.jp>
>
> We currently ignore early NMIs but it would be nice to be able to
> know whether they actually occurred.
>
> This patch adds an early NMI counter and exports it trough
> /proc/interrupts with the name of ENM (Early NMI).

For a userspace interface I suspect we just want to dump the count
into the NMI counter.

It probably makes sense to have a separate variable in early boot like
you do, but then about the time we setup the normal NMI handler move the
NMI count over and possibly do something like reboot if that is our
policy.

I don't see it making sense to educate userspace for an edge case like
this.

Eric


> Signed-off-by: Fernando Luis Vazquez Cao <fernando@....ntt.co.jp>
> ---
>
> diff -urNp linux-3.3-rc6-orig/arch/x86/include/asm/processor.h linux-3.3-rc6/arch/x86/include/asm/processor.h
> --- linux-3.3-rc6-orig/arch/x86/include/asm/processor.h	2012-03-07 15:49:01.826241682 +0900
> +++ linux-3.3-rc6/arch/x86/include/asm/processor.h	2012-03-07 18:52:27.668054122 +0900
> @@ -402,6 +402,7 @@ DECLARE_PER_CPU(char *, irq_stack_ptr);
>  DECLARE_PER_CPU(unsigned int, irq_count);
>  extern unsigned long kernel_eflags;
>  extern asmlinkage void ignore_sysret(void);
> +extern unsigned int early_nmi_count;
>  #else	/* X86_64 */
>  #ifdef CONFIG_CC_STACKPROTECTOR
>  /*
> diff -urNp linux-3.3-rc6-orig/arch/x86/kernel/head_64.S linux-3.3-rc6/arch/x86/kernel/head_64.S
> --- linux-3.3-rc6-orig/arch/x86/kernel/head_64.S	2012-03-07 18:51:17.583160114 +0900
> +++ linux-3.3-rc6/arch/x86/kernel/head_64.S	2012-03-07 18:54:37.205699422 +0900
> @@ -327,6 +327,7 @@ early_exception_handler:
>  	jmp 1b
>  
>  early_nmi_handler:
> +	incl early_nmi_count(%rip) # exported as ENM in /proc/interrupts
>  	iretq
>  
>  #ifdef CONFIG_EARLY_PRINTK
> @@ -340,6 +341,10 @@ early_idt_ripmsg:
>  #endif /* CONFIG_EARLY_PRINTK */
>  	.previous
>  
> +	.globl early_nmi_count
> +early_nmi_count:
> +	.long 0
> +
>  #define NEXT_PAGE(name) \
>  	.balign	PAGE_SIZE; \
>  ENTRY(name)
> diff -urNp linux-3.3-rc6-orig/arch/x86/kernel/irq.c linux-3.3-rc6/arch/x86/kernel/irq.c
> --- linux-3.3-rc6-orig/arch/x86/kernel/irq.c	2012-03-07 15:49:01.838241839 +0900
> +++ linux-3.3-rc6/arch/x86/kernel/irq.c	2012-03-07 18:55:14.078179448 +0900
> @@ -125,6 +125,7 @@ int arch_show_interrupts(struct seq_file
>  #if defined(CONFIG_X86_IO_APIC)
>  	seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
>  #endif
> +	seq_printf(p, "%*s: %10u\n", prec, "ENM", early_nmi_count);
>  	return 0;
>  }
>  
--
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