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] [day] [month] [year] [list]
Message-ID: <5aa1c496-f790-4a02-78ce-3590ff340d70@amd.com>
Date: Wed, 23 Jul 2025 12:11:16 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: linux-kernel@...r.kernel.org, x86@...nel.org
Cc: Borislav Petkov <bp@...en8.de>, Thomas Gleixner <tglx@...utronix.de>,
 Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] x86/CPU/AMD: Perform function calls post ZEN feature
 check regardless

On 7/23/25 12:01, Tom Lendacky wrote:
> Currently, if a ZEN family/model is not recognized in bsp_init_amd(), then
> function calls after the family/model check are skipped. This can prevent
> older kernels from enabling features on newer hardware, e.g., unrecognized
> new hardware won't enable SEV-SNP because bsp_determine_snp() is skipped.
> 
> Rearrange the way the WARN_ONCE() is issued so that functions called after
> the family/model check are still called.
> 
> Fixes: 216d106c7ff7 ("x86/sev: Add SEV-SNP host initialization support")

I put a Fixes: tag, but I'm not sure if this should go to stable. Given
that tsa_init() has been backported, it might be?

Thanks,
Tom

> Signed-off-by: Tom Lendacky <thomas.lendacky@....com>
> ---
>  arch/x86/kernel/cpu/amd.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index a5ece6ebe8a7..79ea6a0fcf8a 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -420,6 +420,8 @@ static void tsa_init(struct cpuinfo_x86 *c)
>  
>  static void bsp_init_amd(struct cpuinfo_x86 *c)
>  {
> +	bool model_warn = false;
> +
>  	if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
>  
>  		if (c->x86 > 0x10 ||
> @@ -489,7 +491,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
>  			setup_force_cpu_cap(X86_FEATURE_ZEN2);
>  			break;
>  		default:
> -			goto warn;
> +			model_warn = true;
>  		}
>  		break;
>  
> @@ -504,7 +506,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
>  			setup_force_cpu_cap(X86_FEATURE_ZEN4);
>  			break;
>  		default:
> -			goto warn;
> +			model_warn = true;
>  		}
>  		break;
>  
> @@ -521,7 +523,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
>  			setup_force_cpu_cap(X86_FEATURE_ZEN6);
>  			break;
>  		default:
> -			goto warn;
> +			model_warn = true;
>  		}
>  		break;
>  
> @@ -529,16 +531,13 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
>  		break;
>  	}
>  
> +	WARN_ONCE(model_warn, "Family 0x%x, model: 0x%x??\n", c->x86, c->x86_model);
> +
>  	bsp_determine_snp(c);
>  	tsa_init(c);
>  
>  	if (cpu_has(c, X86_FEATURE_GP_ON_USER_CPUID))
>  		setup_force_cpu_cap(X86_FEATURE_CPUID_FAULT);
> -
> -	return;
> -
> -warn:
> -	WARN_ONCE(1, "Family 0x%x, model: 0x%x??\n", c->x86, c->x86_model);
>  }
>  
>  static void early_detect_mem_encrypt(struct cpuinfo_x86 *c)
> 
> base-commit: 804fa10c3a3c8a33ce6ffdb999f94d3a7a6c20b8

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ