* [PATCH 1/1] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit
@ 2018-03-14 11:24 Andy Whitcroft
2018-03-14 11:51 ` Peter Zijlstra
2018-03-14 12:28 ` [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels tip-bot for Andy Whitcroft
0 siblings, 2 replies; 7+ messages in thread
From: Andy Whitcroft @ 2018-03-14 11:24 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, David Woodhouse, Peter Zijlstra
Cc: Andy Whitcroft, H. Peter Anvin, x86, linux-kernel
In 9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps
for objtool") we added annotations for CALL_NOSPEC/JMP_NOSPEC on x86 64bit.
We did not annotate the 32bit path. Annotate it similarly.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
arch/x86/include/asm/nospec-branch.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
While reviewing indirect calls in our builds I noted that the
i386 retpoline CALL_NOSPEC is not annotated safe even though
its amd64 equivalent is. I cannot see any reason this is not
also inherantly safe. Peter was there a reason that you did
not annotate this one too? Anyhow, on the assumption this was
just missed, this patch annotates it.
-apw
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index d0dabeae0505..07886162bdf8 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -183,7 +183,10 @@
* otherwise we'll run out of registers. We don't care about CET
* here, anyway.
*/
-# define CALL_NOSPEC ALTERNATIVE("call *%[thunk_target]\n", \
+# define CALL_NOSPEC \
+ ALTERNATIVE( \
+ ANNOTATE_RETPOLINE_SAFE \
+ "call *%[thunk_target]\n", \
" jmp 904f;\n" \
" .align 16\n" \
"901: call 903f;\n" \
--
2.15.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit
2018-03-14 11:24 [PATCH 1/1] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit Andy Whitcroft
@ 2018-03-14 11:51 ` Peter Zijlstra
2018-03-14 12:24 ` Ingo Molnar
2018-03-14 12:28 ` [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels tip-bot for Andy Whitcroft
1 sibling, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2018-03-14 11:51 UTC (permalink / raw)
To: Andy Whitcroft
Cc: Thomas Gleixner, Ingo Molnar, David Woodhouse, H. Peter Anvin,
x86, linux-kernel
On Wed, Mar 14, 2018 at 11:24:27AM +0000, Andy Whitcroft wrote:
> In 9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps
> for objtool") we added annotations for CALL_NOSPEC/JMP_NOSPEC on x86 64bit.
> We did not annotate the 32bit path. Annotate it similarly.
>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
> arch/x86/include/asm/nospec-branch.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> While reviewing indirect calls in our builds I noted that the
> i386 retpoline CALL_NOSPEC is not annotated safe even though
> its amd64 equivalent is. I cannot see any reason this is not
> also inherantly safe. Peter was there a reason that you did
> not annotate this one too? Anyhow, on the assumption this was
> just missed, this patch annotates it.
Yeah, just an oversight aided by the fact that I (obviously) never build
32bit kernels.
> diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> index d0dabeae0505..07886162bdf8 100644
> --- a/arch/x86/include/asm/nospec-branch.h
> +++ b/arch/x86/include/asm/nospec-branch.h
> @@ -183,7 +183,10 @@
> * otherwise we'll run out of registers. We don't care about CET
> * here, anyway.
> */
> -# define CALL_NOSPEC ALTERNATIVE("call *%[thunk_target]\n", \
> +# define CALL_NOSPEC \
> + ALTERNATIVE( \
> + ANNOTATE_RETPOLINE_SAFE \
> + "call *%[thunk_target]\n", \
> " jmp 904f;\n" \
> " .align 16\n" \
> "901: call 903f;\n" \
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit
2018-03-14 11:51 ` Peter Zijlstra
@ 2018-03-14 12:24 ` Ingo Molnar
0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2018-03-14 12:24 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Andy Whitcroft, Thomas Gleixner, Ingo Molnar, David Woodhouse,
H. Peter Anvin, x86, linux-kernel
* Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Mar 14, 2018 at 11:24:27AM +0000, Andy Whitcroft wrote:
> > In 9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps
> > for objtool") we added annotations for CALL_NOSPEC/JMP_NOSPEC on x86 64bit.
> > We did not annotate the 32bit path. Annotate it similarly.
> >
> > Signed-off-by: Andy Whitcroft <apw@canonical.com>
> > ---
> > arch/x86/include/asm/nospec-branch.h | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > While reviewing indirect calls in our builds I noted that the
> > i386 retpoline CALL_NOSPEC is not annotated safe even though
> > its amd64 equivalent is. I cannot see any reason this is not
> > also inherantly safe. Peter was there a reason that you did
> > not annotate this one too? Anyhow, on the assumption this was
> > just missed, this patch annotates it.
>
> Yeah, just an oversight aided by the fact that I (obviously) never build
> 32bit kernels.
>
> > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> > index d0dabeae0505..07886162bdf8 100644
> > --- a/arch/x86/include/asm/nospec-branch.h
> > +++ b/arch/x86/include/asm/nospec-branch.h
> > @@ -183,7 +183,10 @@
> > * otherwise we'll run out of registers. We don't care about CET
> > * here, anyway.
> > */
> > -# define CALL_NOSPEC ALTERNATIVE("call *%[thunk_target]\n", \
> > +# define CALL_NOSPEC \
> > + ALTERNATIVE( \
> > + ANNOTATE_RETPOLINE_SAFE \
> > + "call *%[thunk_target]\n", \
> > " jmp 904f;\n" \
> > " .align 16\n" \
> > "901: call 903f;\n" \
>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Applied, thanks guys!
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
2018-03-14 11:24 [PATCH 1/1] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit Andy Whitcroft
2018-03-14 11:51 ` Peter Zijlstra
@ 2018-03-14 12:28 ` tip-bot for Andy Whitcroft
2018-03-14 13:03 ` Josh Poimboeuf
1 sibling, 1 reply; 7+ messages in thread
From: tip-bot for Andy Whitcroft @ 2018-03-14 12:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, dave.hansen, arjan, mingo, dwmw, gregkh, torvalds, apw, bp,
luto, dan.j.williams, jpoimboe, tglx, linux-kernel, dwmw2,
peterz
Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96
Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96
Author: Andy Whitcroft <apw@canonical.com>
AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 14 Mar 2018 13:24:31 +0100
x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
In the following commit:
9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps for objtool")
... we added annotations for CALL_NOSPEC/JMP_NOSPEC on 64-bit x86 kernels,
but we did not annotate the 32-bit path.
Annotate it similarly.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180314112427.22351-1-apw@canonical.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/nospec-branch.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index b7063cfa19f9..b3996d60f981 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -183,7 +183,10 @@
* otherwise we'll run out of registers. We don't care about CET
* here, anyway.
*/
-# define CALL_NOSPEC ALTERNATIVE("call *%[thunk_target]\n", \
+# define CALL_NOSPEC \
+ ALTERNATIVE( \
+ ANNOTATE_RETPOLINE_SAFE \
+ "call *%[thunk_target]\n", \
" jmp 904f;\n" \
" .align 16\n" \
"901: call 903f;\n" \
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
2018-03-14 12:28 ` [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels tip-bot for Andy Whitcroft
@ 2018-03-14 13:03 ` Josh Poimboeuf
2018-03-14 13:39 ` Ingo Molnar
0 siblings, 1 reply; 7+ messages in thread
From: Josh Poimboeuf @ 2018-03-14 13:03 UTC (permalink / raw)
To: tip-bot for Andy Whitcroft
Cc: linux-tip-commits, hpa, dave.hansen, arjan, mingo, dwmw, gregkh,
torvalds, apw, bp, luto, dan.j.williams, tglx, linux-kernel,
dwmw2, peterz
On Wed, Mar 14, 2018 at 05:28:01AM -0700, tip-bot for Andy Whitcroft wrote:
> Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96
> Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96
> Author: Andy Whitcroft <apw@canonical.com>
> AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000
> Committer: Ingo Molnar <mingo@kernel.org>
> CommitDate: Wed, 14 Mar 2018 13:24:31 +0100
>
> x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
>
> In the following commit:
>
> 9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps for objtool")
>
> ... we added annotations for CALL_NOSPEC/JMP_NOSPEC on 64-bit x86 kernels,
> but we did not annotate the 32-bit path.
>
> Annotate it similarly.
This patch has no effect because objtool only supports 64-bit kernels.
--
Josh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
2018-03-14 13:03 ` Josh Poimboeuf
@ 2018-03-14 13:39 ` Ingo Molnar
2018-03-14 13:51 ` Josh Poimboeuf
0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2018-03-14 13:39 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: tip-bot for Andy Whitcroft, linux-tip-commits, hpa, dave.hansen,
arjan, dwmw, gregkh, torvalds, apw, bp, luto, dan.j.williams,
tglx, linux-kernel, dwmw2, peterz
* Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Wed, Mar 14, 2018 at 05:28:01AM -0700, tip-bot for Andy Whitcroft wrote:
> > Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96
> > Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96
> > Author: Andy Whitcroft <apw@canonical.com>
> > AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000
> > Committer: Ingo Molnar <mingo@kernel.org>
> > CommitDate: Wed, 14 Mar 2018 13:24:31 +0100
> >
> > x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
> >
> > In the following commit:
> >
> > 9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps for objtool")
> >
> > ... we added annotations for CALL_NOSPEC/JMP_NOSPEC on 64-bit x86 kernels,
> > but we did not annotate the 32-bit path.
> >
> > Annotate it similarly.
>
> This patch has no effect because objtool only supports 64-bit kernels.
Yeah, indeed - but it's still a good change for completeness, right?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
2018-03-14 13:39 ` Ingo Molnar
@ 2018-03-14 13:51 ` Josh Poimboeuf
0 siblings, 0 replies; 7+ messages in thread
From: Josh Poimboeuf @ 2018-03-14 13:51 UTC (permalink / raw)
To: Ingo Molnar
Cc: tip-bot for Andy Whitcroft, linux-tip-commits, hpa, dave.hansen,
arjan, dwmw, gregkh, torvalds, apw, bp, luto, dan.j.williams,
tglx, linux-kernel, dwmw2, peterz
On Wed, Mar 14, 2018 at 02:39:43PM +0100, Ingo Molnar wrote:
>
> * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> > On Wed, Mar 14, 2018 at 05:28:01AM -0700, tip-bot for Andy Whitcroft wrote:
> > > Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96
> > > Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96
> > > Author: Andy Whitcroft <apw@canonical.com>
> > > AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000
> > > Committer: Ingo Molnar <mingo@kernel.org>
> > > CommitDate: Wed, 14 Mar 2018 13:24:31 +0100
> > >
> > > x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
> > >
> > > In the following commit:
> > >
> > > 9e0e3c5130e9 ("x86/speculation, objtool: Annotate indirect calls/jumps for objtool")
> > >
> > > ... we added annotations for CALL_NOSPEC/JMP_NOSPEC on 64-bit x86 kernels,
> > > but we did not annotate the 32-bit path.
> > >
> > > Annotate it similarly.
> >
> > This patch has no effect because objtool only supports 64-bit kernels.
>
> Yeah, indeed - but it's still a good change for completeness, right?
Yeah, it's fine. Objtool won't use it, but I suppose it makes the code
less surprising and more consistent for humans.
--
Josh
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-14 13:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 11:24 [PATCH 1/1] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit Andy Whitcroft
2018-03-14 11:51 ` Peter Zijlstra
2018-03-14 12:24 ` Ingo Molnar
2018-03-14 12:28 ` [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels tip-bot for Andy Whitcroft
2018-03-14 13:03 ` Josh Poimboeuf
2018-03-14 13:39 ` Ingo Molnar
2018-03-14 13:51 ` Josh Poimboeuf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.