[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231012171144.wtzcheq7x3qwpym6@treble>
Date: Thu, 12 Oct 2023 10:11:44 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: "Kaplan, David" <David.Kaplan@....com>,
"x86@...nel.org" <x86@...nel.org>,
"luto@...nel.org" <luto@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -v2] x86/retpoline: Ensure default return thunk isn't
used at runtime
On Thu, Oct 12, 2023 at 04:10:31PM +0200, Borislav Petkov wrote:
> On Tue, Oct 10, 2023 at 01:41:19PM -0700, Josh Poimboeuf wrote:
> > Even if it's not a security hole, I'd still view it as a major BUG() as
> > it would directly contradict our understanding (and the comments above)
> > and could cause performance or other correctness issues that would
> > otherwise go unnoticed.
> >
> > So I think an unconditional UD2 is warranted.
>
> Before David's outlook mangles v2, lemme send it from a real mail
> client :-P.
>
> v2 uses X86_FEATURE_ALWAYS as Josh requested.
>
> ---
> From: David Kaplan <david.kaplan@....com>
> Date: Thu, 12 Oct 2023 08:52:32 -0500
> Subject: [PATCH] x86/retpoline: Ensure default return thunk isn't used at runtime
>
> All CPU bugs that require a return thunk define a special return thunk
> to use (e.g., srso_return_thunk). The default thunk,
> __x86_return_thunk, should never be used after apply_returns()
> completes. Otherwise this could lead to potential speculation holes.
>
> Enforce this by replacing this thunk with a ud2 when alternatives are
> applied. Alternative instructions are applied after apply_returns().
>
> The default thunk is only used during kernel boot, it is not used during
> module init since that occurs after apply_returns().
>
> Signed-off-by: David Kaplan <david.kaplan@....com>
> Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@...nel.org>
--
Josh
Powered by blists - more mailing lists