Re: [PATCH] x86/nospec: Unwreck the RSB stuffing

From: Boris Petkov
Date: Tue Aug 16 2022 - 14:15:43 EST


On August 16, 2022 6:04:36 PM UTC, Daniel Sneddon <daniel.sneddon@xxxxxxxxxxxxxxx> wrote:
>diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>index 62f6b8b7c4a5..5c476b37b3bc 100644
>--- a/arch/x86/kernel/alternative.c
>+++ b/arch/x86/kernel/alternative.c
>@@ -284,6 +284,9 @@ void __init_or_module noinline apply_alternatives(struct
>alt_instr *start,
> /* Mask away "NOT" flag bit for feature to test. */
> u16 feature = a->cpuid & ~ALTINSTR_FLAG_INV;


I guess it is time for struct altinstr.flags. I never liked this INV mask bit...

>
>+ if (feature == X86_FEATURE_NEVER)
>+ goto next;
>+
> instr = (u8 *)&a->instr_offset + a->instr_offset;
> replacement = (u8 *)&a->repl_offset + a->repl_offset;
> BUG_ON(a->instrlen > sizeof(insn_buff));
>


--
Sent from a small device: formatting sux and brevity is inevitable.