[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200407132745.iieggolloidvdiwu@treble>
Date: Tue, 7 Apr 2020 08:27:45 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Alexandre Chartre <alexandre.chartre@...cle.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, peterz@...radead.org,
jthierry@...hat.com, tglx@...utronix.de
Subject: Re: [PATCH V2 6/9] x86/speculation: Change __FILL_RETURN_BUFFER to
work with objtool
On Tue, Apr 07, 2020 at 09:31:39AM +0200, Alexandre Chartre wrote:
> Change __FILL_RETURN_BUFFER so that the stack state is deterministically
> defined for each iteration and that objtool can have an accurate view
> of the stack.
>
> Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
> ---
> arch/x86/include/asm/nospec-branch.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> index 5c24a7b35166..9a946fd5e824 100644
> --- a/arch/x86/include/asm/nospec-branch.h
> +++ b/arch/x86/include/asm/nospec-branch.h
> @@ -60,8 +60,8 @@
> jmp 775b; \
> 774: \
> dec reg; \
> - jnz 771b; \
> - add $(BITS_PER_LONG/8) * nr, sp;
> + add $(BITS_PER_LONG/8) * 2, sp; \
> + jnz 771b;
>
> #ifdef __ASSEMBLY__
This still isn't a complete fix because the macro is used in an
alternative. So in the !X86_FEATURE_RSB_CTXSW case, this code isn't
patched in and the ORC data which refers to it is wrong.
As I said before I think the easiest fix would be to convert RSB and
retpolines to use static branches instead of alternatives.
--
Josh
Powered by blists - more mailing lists