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-next>] [day] [month] [year] [list]
Date:   Wed, 28 Aug 2019 14:11:00 +0800
From:   Cao jin <caoj.fnst@...fujitsu.com>
To:     <x86@...nel.org>, <linux-kernel@...r.kernel.org>
CC:     <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
        <hpa@...or.com>, Dave Hansen <dave.hansen@...el.com>
Subject: [PATCH] x86/cpufeature: explicit comments for duplicate macro

Help people to understand the author's intent of apparent duplication of
BUILD_BUG_ON_ZERO(NCAPINTS != n), which is hard to detect by eyes.

CC: Dave Hansen <dave.hansen@...el.com>
Suggested-by: Borislav Petkov <bp@...en8.de>
Signed-off-by: Cao jin <caoj.fnst@...fujitsu.com>
---
Tried my best to describe it accurately, in case of any inaccuracy, feel
free to rephrase.

 arch/x86/include/asm/cpufeature.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 58acda503817..e943174abf1e 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -61,6 +61,17 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
 #define CHECK_BIT_IN_MASK_WORD(maskname, word, bit)	\
 	(((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
 
+/*
+ * REQUIRED_MASK_CHECK may seems duplicate, but actually has its reason to
+ * live here.
+ * New CPUID leaf added or feature bit adjustment would/may result in increase
+ * in NCAPINTS. When it does, two required-features.h and here need to be
+ * modified correspondingly. BUILD_BUG_ON_ZERO assures the modification to be
+ * carried out, checking NCAPINTS also reminds the additional lines for new
+ * word. But, required-features.h as a single header file, can't be compiled
+ * directly, that is why a wrapper is defined there and called here.
+ * Totally the same case for DISABLED_MASK_BIT_SET.
+ */
 #define REQUIRED_MASK_BIT_SET(feature_bit)		\
 	 ( CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK,  0, feature_bit) ||	\
 	   CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK,  1, feature_bit) ||	\
-- 
2.17.0



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ