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: Tue, 23 Jan 2024 12:26:24 +0100
From: Borislav Petkov <bp@...en8.de>
To: NOMURA JUNICHI(野村 淳一) <junichi.nomura@....com>
Cc: "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
	"mingo@...hat.com" <mingo@...hat.com>,
	"tglx@...utronix.de" <tglx@...utronix.de>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
	"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
	"ardb@...nel.org" <ardb@...nel.org>,
	"david@...hat.com" <david@...hat.com>,
	"nikunj@....com" <nikunj@....com>,
	"thomas.lendacky@....com" <thomas.lendacky@....com>,
	"debarbos@...hat.com" <debarbos@...hat.com>,
	"jlelli@...hat.com" <jlelli@...hat.com>,
	"lgoncalv@...hat.com" <lgoncalv@...hat.com>,
	"dzickus@...hat.com" <dzickus@...hat.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] x86/boot: Add a message about ignored early NMIs

On Mon, Jan 15, 2024 at 08:57:45AM +0000, NOMURA JUNICHI(野村 淳一) wrote:
> +	if (spurious_nmi_count) {
> +		error_putstr("Spurious early NMI ignored. Number of NMIs: 0x");
> +		error_puthex(spurious_nmi_count);
> +		error_putstr("\n");

Uff, that's just silly:

Spurious early NMIs ignored: 0x0000000000000017

Would you like to add a error_putnum() or so in a prepatch which would
make this output

Spurious early NMIs ignored: 23.

?

So that it is human readable and doesn't make me wonder what that hex
value is supposed to mean?

Thx.

Btw, please use this version when sending next time:

---
From: =?UTF-8?q?NOMURA=20JUNICHI=28=E9=87=8E=E6=9D=91=20=E6=B7=B3=E4=B8=80?=
 =?UTF-8?q?=29?= <junichi.nomura@....com>
Date: Mon, 15 Jan 2024 08:57:45 +0000
Subject: [PATCH] x86/boot: Add a message about ignored early NMIs

Commit

  78a509fba9c9 ("x86/boot: Ignore NMIs during very early boot")

added an empty handler in early boot stage to avoid boot failure due to
spurious NMIs.

Add a diagnostic message to show when early NMIs have occurred and/or
what happened to them.

  [ bp: Touchups. ]

Suggested-by: Borislav Petkov <bp@...en8.de>
Suggested-by: H. Peter Anvin <hpa@...or.com>
Signed-off-by: Jun'ichi Nomura <junichi.nomura@....com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Link: https://lore.kernel.org/lkml/20231130103339.GCZWhlA196uRklTMNF@fat_crate.local
---
 arch/x86/boot/compressed/ident_map_64.c | 2 +-
 arch/x86/boot/compressed/misc.c         | 7 +++++++
 arch/x86/boot/compressed/misc.h         | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c
index ff09ca6dbb87..909f2a35b60c 100644
--- a/arch/x86/boot/compressed/ident_map_64.c
+++ b/arch/x86/boot/compressed/ident_map_64.c
@@ -389,5 +389,5 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code)
 
 void do_boot_nmi_trap(struct pt_regs *regs, unsigned long error_code)
 {
-	/* Empty handler to ignore NMI during early boot */
+	spurious_nmi_count++;
 }
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index b99e08e6815b..e7f4eb24a9a4 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -52,6 +52,7 @@ struct port_io_ops pio_ops;
 
 memptr free_mem_ptr;
 memptr free_mem_end_ptr;
+int spurious_nmi_count;
 
 static char *vidmem;
 static int vidport;
@@ -493,6 +494,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, unsigned char *output)
 	/* Disable exception handling before booting the kernel */
 	cleanup_exception_handling();
 
+	if (spurious_nmi_count) {
+		error_putstr("Spurious early NMIs ignored: 0x");
+		error_puthex(spurious_nmi_count);
+		error_putstr("\n");
+	}
+
 	return output + entry_offset;
 }
 
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index bc2f0f17fb90..b858d6aa648c 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -59,6 +59,7 @@ extern char _head[], _end[];
 /* misc.c */
 extern memptr free_mem_ptr;
 extern memptr free_mem_end_ptr;
+extern int spurious_nmi_count;
 void *malloc(int size);
 void free(void *where);
 void __putstr(const char *s);
-- 
2.43.0



-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ