lkml.org 
[lkml]   [2022]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 14/29] x86/ibt: Add IBT feature, MSR and #CP handling
Date
On 18/02/2022 16:49, Peter Zijlstra wrote:
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -592,6 +593,27 @@ static __init int setup_disable_pku(char
> __setup("nopku", setup_disable_pku);
> #endif /* CONFIG_X86_64 */
>
> +static __always_inline void setup_cet(struct cpuinfo_x86 *c)
> +{
> + u64 msr;
> +
> + if (!IS_ENABLED(CONFIG_X86_IBT) ||
> + !cpu_feature_enabled(X86_FEATURE_IBT))
> + return;
> +
> + cr4_set_bits(X86_CR4_CET);
> +
> + rdmsrl(MSR_IA32_S_CET, msr);
> + if (cpu_feature_enabled(X86_FEATURE_IBT))
> + msr |= CET_ENDBR_EN;
> + wrmsrl(MSR_IA32_S_CET, msr);

So something I learnt the hard way with shstk is that you really want to
disable S_CET before heading into purgatory.

I've got no idea what's going to result from UEFI finally getting CET
support.  However, clearing out the other IBT settings is probably a
wise move.

In particular, if there was a stale legacy bitmap pointer, then
ibt_selftest() could take #PF ahead of #CP.

~Andrew
\
 
 \ /
  Last update: 2022-02-18 20:32    [W:1.044 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site