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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201106141216.2062-2-thunder.leizhen@huawei.com>
Date:   Fri, 6 Nov 2020 22:12:16 +0800
From:   Zhen Lei <thunder.leizhen@...wei.com>
To:     Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, x86 <x86@...nel.org>,
        "H . Peter Anvin" <hpa@...or.com>,
        linux-edac <linux-edac@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
CC:     Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH v2 1/1] x86/mce: correct the detection of invalid mce priorities

enum mce_notifier_prios {
	MCE_PRIO_LOWEST,
	...
	MCE_PRIO_CEC
};

After commit c9c6d216ed28 ("x86/mce: Rename "first" function as "early""),
the range of invalid priorities is changed. Add a new enumeration value
MCE_PRIO_HIGHEST, so that people can add enumeration values greater than
MCE_PRIO_CEC in the future without having to modify the function
mce_register_decode_chain().

Because the type of "nb->priority" is int, so the priority less than
MCE_PRIO_LOWEST is also invalid.

Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
 arch/x86/include/asm/mce.h     | 3 ++-
 arch/x86/kernel/cpu/mce/core.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index a0f147893a04..fc25c88c7ff2 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -177,7 +177,8 @@ enum mce_notifier_prios {
 	MCE_PRIO_EXTLOG,
 	MCE_PRIO_UC,
 	MCE_PRIO_EARLY,
-	MCE_PRIO_CEC
+	MCE_PRIO_CEC,
+	MCE_PRIO_HIGHEST = MCE_PRIO_CEC
 };
 
 struct notifier_block;
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 4102b866e7c0..0a54a2cfeeff 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -162,7 +162,8 @@ EXPORT_SYMBOL_GPL(mce_log);
 
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
+	if (WARN_ON((nb->priority < MCE_PRIO_LOWEST) ||
+		    (nb->priority > MCE_PRIO_HIGHEST)))
 		return;
 
 	blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);
-- 
2.26.0.106.g9fadedd


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ