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: <20070720160347.GB1960@Krystal>
Date:	Fri, 20 Jul 2007 12:03:47 -0400
From:	Mathieu Desnoyers <compudj@...stal.dyndns.org>
To:	Andi Kleen <ak@...e.de>
Cc:	jeremy@...p.org, patches@...-64.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [3/11] x86: Stop MCEs and NMIs during code patching

* Andi Kleen (ak@...e.de) wrote:

> Index: linux/arch/x86_64/kernel/nmi.c
> ===================================================================
> --- linux.orig/arch/x86_64/kernel/nmi.c
> +++ linux/arch/x86_64/kernel/nmi.c
> @@ -384,11 +384,14 @@ int __kprobes nmi_watchdog_tick(struct p
>  	return rc;
>  }
>  
> +static unsigned ignore_nmis;
> +
>  asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code)
>  {
>  	nmi_enter();
>  	add_pda(__nmi_count,1);
> -	default_do_nmi(regs);
> +	if (!ignore_nmis) 
> +		default_do_nmi(regs);
>  	nmi_exit();
>  }
>  
> @@ -401,6 +404,18 @@ int do_nmi_callback(struct pt_regs * reg
>  	return 0;
>  }
>  
> +void stop_nmi(void)
> +{
> +	ignore_nmis++;
> +	acpi_nmi_disable();
> +}

I would do:

acpi_nmi_disable();
ignore_nmis++;

Instead, so we minimize the chances to have to drop a do_nmi.

> +
> +void restart_nmi(void)
> +{
> +	ignore_nmis--;
> +	acpi_nmi_enable();
> +}
> +
>  #ifdef CONFIG_SYSCTL
>  
...
>  #endif /* ASM_NMI_H */
> Index: linux/arch/i386/kernel/traps.c
> ===================================================================
> --- linux.orig/arch/i386/kernel/traps.c
> +++ linux/arch/i386/kernel/traps.c
> @@ -774,6 +774,8 @@ static __kprobes void default_do_nmi(str
>  	reassert_nmi();
>  }
>  
> +static int ignore_nmis;
> +
>  fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code)
>  {
>  	int cpu;
> @@ -784,11 +786,24 @@ fastcall __kprobes void do_nmi(struct pt
>  
>  	++nmi_count(cpu);
>  
> -	default_do_nmi(regs);
> +	if (!ignore_nmis)
> +		default_do_nmi(regs);
>  
>  	nmi_exit();
>  }
>  
> +void stop_nmi(void)
> +{
> +	ignore_nmis++;
> +	acpi_nmi_disable();
> +}
> +

Same here, I would swap the two.

> +void restart_nmi(void)
> +{
> +	ignore_nmis--;
> +	acpi_nmi_enable();
> +}
> +

Besides that, it looks good.

Mathieu

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
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