mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	x86/bugs: Add attack vector controls for BHI
Use attack vector controls to determine if BHI mitigation is required. Signed-off-by: David Kaplan <david.kaplan@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250707183316.1349127-15-david.kaplan@amd.com
This commit is contained in:
		
							parent
							
								
									07a659edcf
								
							
						
					
					
						commit
						ddcd4d3cb3
					
				
					 1 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -2217,11 +2217,20 @@ early_param("spectre_bhi", spectre_bhi_parse_cmdline);
 | 
			
		|||
 | 
			
		||||
static void __init bhi_select_mitigation(void)
 | 
			
		||||
{
 | 
			
		||||
	if (!boot_cpu_has(X86_BUG_BHI) || cpu_mitigations_off())
 | 
			
		||||
	if (!boot_cpu_has(X86_BUG_BHI))
 | 
			
		||||
		bhi_mitigation = BHI_MITIGATION_OFF;
 | 
			
		||||
 | 
			
		||||
	if (bhi_mitigation == BHI_MITIGATION_AUTO)
 | 
			
		||||
		bhi_mitigation = BHI_MITIGATION_ON;
 | 
			
		||||
	if (bhi_mitigation != BHI_MITIGATION_AUTO)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	if (cpu_attack_vector_mitigated(CPU_MITIGATE_GUEST_HOST)) {
 | 
			
		||||
		if (cpu_attack_vector_mitigated(CPU_MITIGATE_USER_KERNEL))
 | 
			
		||||
			bhi_mitigation = BHI_MITIGATION_ON;
 | 
			
		||||
		else
 | 
			
		||||
			bhi_mitigation = BHI_MITIGATION_VMEXIT_ONLY;
 | 
			
		||||
	} else {
 | 
			
		||||
		bhi_mitigation = BHI_MITIGATION_OFF;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void __init bhi_update_mitigation(void)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue