Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 18, 2023 at 10:37:47PM +0200, Borislav Petkov wrote:

> And here's the fix:
> 
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 73be3931e4f0..50d64f5226f4 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -748,14 +748,20 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
>                         continue;
>  
>                 op = insn.opcode.bytes[0];
> -               if (op == JMP32_INSN_OPCODE)
> +               if (op == JMP32_INSN_OPCODE || op == JMP8_INSN_OPCODE)
>                         dest = addr + insn.length + insn.immediate.value;
>  
> 
> I'd still prefer the revert, though, that close to the MW. We can work
> at those things later, at leisure.

Yet another fall-out from removing the section... When in it's own
section the compiler must emit long form jump because it doesn't know
where the target is.

Now, not so much.

Anyway, yes, that seems trivial enough as a fix.



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux