lkml.org 
[lkml]   [2024]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 10/14] x86/cpu/keylocker: Check Gather Data Sampling mitigation
On Thu, Mar 28, 2024 at 06:53:42PM -0700, Chang S. Bae wrote:
> +/*
> + * The mitigation is implemented at a microcode level. Ensure that the
> + * microcode update is applied and the mitigation is locked.
> + */
> +static bool __init have_gds_mitigation(void)
> +{
> + u64 mcu_ctrl;
> +
> + /* GDS_CTRL is set if new microcode is loaded. */
> + if (!(x86_read_arch_cap_msr() & ARCH_CAP_GDS_CTRL))
> + goto vulnerable;
> +
> + /* If GDS_MITG_LOCKED is set, GDS_MITG_DIS is forced to 0. */
> + rdmsrl(MSR_IA32_MCU_OPT_CTRL, mcu_ctrl);
> + if (mcu_ctrl & GDS_MITG_LOCKED)
> + return true;

Similar to RFDS, above checks can be simplified to:

if (gds_mitigation == GDS_MITIGATION_FULL_LOCKED)
return true;
> +
> +vulnerable:
> + pr_warn("x86/keylocker: Susceptible to the GDS vulnerability.\n");
> + return false;
> +}

\
 
 \ /
  Last update: 2024-03-29 07:58    [W:0.544 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site