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>] [day] [month] [year] [list]
Message-Id: <20240710184240.389395-1-kiryushin@ancud.ru>
Date: Wed, 10 Jul 2024 21:42:40 +0300
From: Nikita Kiryushin <kiryushin@...ud.ru>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Nikita Kiryushin <kiryushin@...ud.ru>,
	Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
	Waiman Long <longman@...hat.com>,
	linux-kernel@...r.kernel.org,
	lvc-project@...uxtesting.org
Subject: [PATCH] x86/smpboot: Mark memory allocations in smp_prepare_cpus_common __GFP_NOFAIL

As of now, zalloc_cpumask_var_node for various maps in
smp_prepare_cpus_common is not checked.

As memory allocations here are critical and there is no reasonable
allocation failure policy, the allocations should never fail.

Use __GFP_NOFAIL flag, as suggested in
https://lore.kernel.org/all/ZhaUZFY5MUyy6hWK@gmail.com/

Signed-off-by: Nikita Kiryushin <kiryushin@...ud.ru>
---
 arch/x86/kernel/smpboot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 0c35207320cb..76fabb74b8ea 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1044,11 +1044,11 @@ void __init smp_prepare_cpus_common(void)
 	for_each_possible_cpu(cpu) {
 		node = cpu_to_node(cpu);
 
-		zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map,    cpu), GFP_KERNEL, node);
-		zalloc_cpumask_var_node(&per_cpu(cpu_core_map,       cpu), GFP_KERNEL, node);
-		zalloc_cpumask_var_node(&per_cpu(cpu_die_map,        cpu), GFP_KERNEL, node);
-		zalloc_cpumask_var_node(&per_cpu(cpu_llc_shared_map, cpu), GFP_KERNEL, node);
-		zalloc_cpumask_var_node(&per_cpu(cpu_l2c_shared_map, cpu), GFP_KERNEL, node);
+		zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map,    cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+		zalloc_cpumask_var_node(&per_cpu(cpu_core_map,       cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+		zalloc_cpumask_var_node(&per_cpu(cpu_die_map,        cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+		zalloc_cpumask_var_node(&per_cpu(cpu_llc_shared_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+		zalloc_cpumask_var_node(&per_cpu(cpu_l2c_shared_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
 	}
 
 	set_cpu_sibling_map(0);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ