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:	Wed, 14 Dec 2011 08:30:25 -0500
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <andi@...stfloor.org>,
	"H. Peter Anvin" <hpa@...ux.intel.com>,
	Paul Turner <pjt@...gle.com>
Subject: Re: [RFC][PATCH 5/5 v2] x86: Allow NMIs to hit breakpoints in i386

* Steven Rostedt (rostedt@...dmis.org) wrote:
[...]> From: Steven Rostedt <srostedt@...hat.com>
> +#define nmi_preprocess(regs)						\
> +	do {								\
> +		if (__get_cpu_var(nmi_state) != NMI_NOT_RUNNING) {	\
> +			__get_cpu_var(nmi_state) = NMI_LATCHED;		\
> +			return;						\
> +		}							\
> +	nmi_restart:							\
> +		__get_cpu_var(nmi_state) = NMI_EXECUTING;		\
> +	} while (0)
> +
> +#define nmi_postprocess()						\
> +	do {								\
> +		if (cmpxchg(&__get_cpu_var(nmi_state),			\
> +		    NMI_EXECUTING, NMI_NOT_RUNNING) != NMI_EXECUTING)	\
> +			goto nmi_restart;				\
> +	} while (0)
> +
[...]
> +dotraplinkage notrace __kprobes void
> +do_nmi(struct pt_regs *regs, long error_code)
> +{
> +	nmi_preprocess(regs);
> +
>  	nmi_enter();
>  
>  	inc_irq_stat(__nmi_count);
> @@ -428,8 +515,7 @@ do_nmi(struct pt_regs *regs, long error_code)
>  
>  	nmi_exit();
>  
> -	if (unlikely(update_debug_stack))
> -		reset_debug_stack();
> +	nmi_postprocess();

Just to make sure I understand: if an NMI nests over do_nmi between
nmi_postprocess() and the following iret (in which case the CPU is in
state NMI_NOT_RUNNING), we will end up with two NMI handlers nested on
the stack, right ? Given that there is no upper-bound on the nesting
level of this situation (although nesting like this more than once is
extremely unlikely), is this side-effect something we should care about
in terms of stack space usage ? Also, is the stack dump OOPS handler
aware of this stack layout that was until now impossible ?

Thanks,

Mathieu

>  }
>  
>  void stop_nmi(void)
> -- 
> 1.7.7.3
> 
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
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