Re: [PATCH 1/1] x86/pti: Fix kernel warnings for pti= and nopti cmdline options.
From: Sohil Mehta
Date: Mon Aug 14 2023 - 17:13:01 EST
On 8/12/2023 8:54 AM, Jo Van Bulck wrote:
> arch/x86/mm/pti.c | 55 ++++++++++++++++++++++++-----------------------
> 1 file changed, 28 insertions(+), 27 deletions(-)
>
This version is very similar to the original patch and much simpler.
Sorry about the unnecessary churn.
Apart from the minor nits below,
Reviewed-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
> + if (cpu_mitigations_off())
> pti_mode = PTI_FORCE_OFF;
> + if (pti_mode == PTI_FORCE_OFF) {
> pti_print_if_insecure("disabled on command line.");
> return;
> }
A new line here would be useful.
> + if (pti_mode == PTI_FORCE_ON) {
> + pti_print_if_secure("force enabled on command line.");
> + goto enable;
> + }
>
> -autosel:
> if (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
> return;
> enable:
> setup_force_cpu_cap(X86_FEATURE_PTI);
> }
>
Was there an issue with the flow you had in the original patch? It was
avoiding the goto label and flow was a bit more linear.
> if (pti_mode == PTI_AUTO && !boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
> return;
>
> if (pti_mode == PTI_FORCE_ON)
> pti_print_if_secure("force enabled on command line.");
>
> setup_force_cpu_cap(X86_FEATURE_PTI);
Sohil