x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit
Subsystems (2)
PATCH 1/1 x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32bit
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.
--- 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
arch/x86/include/asm/nospec-branch.h +4 -1
@@ -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" \
Signature · 1 line
2.15.1
Quoted 9 lines · Andy Whitcroft
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 <[email protected]>--- arch/x86/include/asm/nospec-branch.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 6 lines
While reviewing indirect calls in our builds I noted that the i386 retpoline
CALL_NOSPECis 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.
Quoted 6 lines
arch/x86/include/asm/nospec-branch.h +0
-0@@ -183,7 +183,10 @@* otherwise we'll run out of registers. We don't care about CET
arch/x86/include/asm/nospec-branch.h line 192
Quoted 10 lines
arch/x86/include/asm/nospec-branch.h +4
-1* 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" \
Ingo Molnar
AppliedQuoted 30 lines · Peter Zijlstra
Quoted 9 lines · Andy Whitcroft
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 <[email protected]>--- arch/x86/include/asm/nospec-branch.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Quoted 6 lines
While reviewing indirect calls in our builds I noted that the i386 retpoline
CALL_NOSPECis 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.
Quoted 10 lines
arch/x86/include/asm/nospec-branch.h +1
-1@@ -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 \
Quoted 8 lines
arch/x86/include/asm/nospec-branch.h line 192
Quoted 6 lines
arch/x86/include/asm/nospec-branch.h +3
-0+ALTERNATIVE ( \ +ANNOTATE_RETPOLINE_SAFE \ +"call *%[thunk_target]\n" , \" jmp 904f;\n" \" .align 16\n" \ "901: call 903f;\n" \
Applied, thanks guys!
Ingo
tip-bot for Andy Whitcroft
merge bot[tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
In reply to Andy Whitcroftx86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96 Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96 Author: Andy Whitcroft <[email protected]> AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000 Committer: Ingo Molnar <[email protected]> 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.
--- arch/x86/include/asm/nospec-branch.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/include/asm/nospec-branch.h +4 -1
@@ -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" \
Re: [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
Quoted 9 lines · tip-bot for Andy Whitcroft
Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96 Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96 Author: Andy Whitcroft <[email protected]> AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 14 Mar 2018 13:24:31 +0100x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
Quoted 8 lines
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.
Signature · 1 line
Josh
Re: [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
Quoted 12 lines · Josh Poimboeuf
Quoted 11 lines · tip-bot for Andy Whitcroft
Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96 Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96 Author: Andy Whitcroft <[email protected]> AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 14 Mar 2018 13:24:31 +0100x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
In the following commit:
Quoted 8 lines
Quoted 6 lines
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
Re: [tip:x86/pti] x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Josh Poimboeuf
Quoted 13 lines · tip-bot for Andy Whitcroft
Commit-ID: a14bff131108faf50cc0cf864589fd71ee216c96 Gitweb: https://git.kernel.org/tip/a14bff131108faf50cc0cf864589fd71ee216c96 Author: Andy Whitcroft <[email protected]> AuthorDate: Wed, 14 Mar 2018 11:24:27 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 14 Mar 2018 13:24:31 +0100x86/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")
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
... 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.
Signature · 1 line
Josh