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]
- Subject: Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime
- From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Date: Thu, 19 Oct 2023 09:43:42 +0200
- Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-tip-commits@xxxxxxxxxxxxxxx, David Kaplan <david.kaplan@xxxxxxx>, x86@xxxxxxxxxx, David Howells <dhowells@xxxxxxxxxx>
- In-reply-to: <20231018203747.GJZTBCG7mv5HL4w6CC@fat_crate.local>
- References: <20231012141031.GHZSf+V1NjjUJTc9a9@fat_crate.local> <169713303534.3135.10558074245117750218.tip-bot2@tip-bot2> <20231018132352.GBZS/caGJ8Wk9kmTbg@fat_crate.local> <ZS/f8DeEIWhBtBeb@gmail.com> <20231018151245.GCZS/17QhDGe7q6K+w@fat_crate.local> <20231018155433.z4auwckr5s27wnig@treble> <20231018175531.GEZTAcE2p92U1AuVp1@fat_crate.local> <20231018203747.GJZTBCG7mv5HL4w6CC@fat_crate.local>
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]