public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: <x86@kernel.org>, <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	Sedat Dilek <sedat.dilek@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	<clang-built-linux@googlegroups.com>,
	Miroslav Benes <mbenes@suse.cz>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH 17/21] x86/acpi: Convert indirect jump to retpoline
Date: Fri, 15 Jan 2021 00:54:41 +0000	[thread overview]
Message-ID: <70343174-b9cd-d80b-7be0-5d3e3e609ca2@citrix.com> (raw)
In-Reply-To: <20210114234737.xpltgdu3vpa6spgb@treble>

On 14/01/2021 23:47, Josh Poimboeuf wrote:
> On Thu, Jan 14, 2021 at 10:59:39PM +0000, Andrew Cooper wrote:
>> On 14/01/2021 19:40, Josh Poimboeuf wrote:
>>> It's kernel policy to not have (unannotated) indirect jumps because of
>>> Spectre v2.  This one's probably harmless, but better safe than sorry.
>>> Convert it to a retpoline.
>>>
>>> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
>>> Cc: Len Brown <len.brown@intel.com>
>>> Cc: Pavel Machek <pavel@ucw.cz>
>>> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
>>> ---
>>>  arch/x86/kernel/acpi/wakeup_64.S | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
>>> index 5d3a0b8fd379..0b371580e620 100644
>>> --- a/arch/x86/kernel/acpi/wakeup_64.S
>>> +++ b/arch/x86/kernel/acpi/wakeup_64.S
>>> @@ -7,6 +7,7 @@
>>>  #include <asm/msr.h>
>>>  #include <asm/asm-offsets.h>
>>>  #include <asm/frame.h>
>>> +#include <asm/nospec-branch.h>
>>>  
>>>  # Copyright 2003 Pavel Machek <pavel@suse.cz
>>>  
>>> @@ -39,7 +40,7 @@ SYM_FUNC_START(wakeup_long64)
>>>  	movq	saved_rbp, %rbp
>>>  
>>>  	movq	saved_rip, %rax
>>> -	jmp	*%rax
>>> +	JMP_NOSPEC rax
>>>  SYM_FUNC_END(wakeup_long64)
>> I suspect this won't work as you intend.
>>
>> wakeup_long64() still executes on the low mappings, not the high
>> mappings, so the `jmp __x86_indirect_thunk_rax` under this JMP_NOSPEC
>> will wander off into the weeds.
>>
>> This is why none of the startup "jmps from weird contexts onto the high
>> mappings" have been retpolined-up.
> D'oh.  Of course it wouldn't be that easy.  I suppose the other two
> retpoline patches (15 and 21) are bogus as well.

If by 21 you mean 19, then most likely, yes.  They're all low=>high
jumps in weird contexts.

~Andrew

  reply	other threads:[~2021-01-15  0:56 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 19:39 [PATCH 00/21] objtool: vmlinux.o and CLANG LTO support Josh Poimboeuf
2021-01-14 19:39 ` [PATCH 01/21] objtool: Fix seg fault in BT_FUNC() with fake jump Josh Poimboeuf
2021-01-14 20:04   ` Josh Poimboeuf
2021-01-14 19:39 ` [PATCH 02/21] objtool: Fix error handling for STD/CLD warnings Josh Poimboeuf
2021-01-14 19:39 ` [PATCH 03/21] objtool: Fix retpoline detection in asm code Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 04/21] objtool: Fix ".cold" section suffix check for newer versions of GCC Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 05/21] objtool: Support retpoline jump detection for vmlinux.o Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 06/21] x86/ftrace: Add UNWIND_HINT_FUNC annotation for ftrace_stub Josh Poimboeuf
2021-01-14 20:42   ` Steven Rostedt
2021-01-14 19:40 ` [PATCH 07/21] objtool: Assume only ELF functions do sibling calls Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 08/21] objtool: Add asm version of STACK_FRAME_NON_STANDARD Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 09/21] objtool: Combine UNWIND_HINT_RET_OFFSET and UNWIND_HINT_FUNC Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 10/21] objtool: Add xen_start_kernel() to noreturn list Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 11/21] objtool: Move unsuffixed symbol conversion to a helper function Josh Poimboeuf
2021-01-14 20:55   ` [PATCH v1.1 " Josh Poimboeuf
2021-01-14 21:30     ` Sedat Dilek
2021-01-14 19:40 ` [PATCH 12/21] objtool: Add CONFIG_CFI_CLANG support Josh Poimboeuf
2021-01-14 20:49   ` Sami Tolvanen
2021-01-14 20:52     ` Josh Poimboeuf
2021-01-14 20:56   ` [PATCH v1.1 " Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 13/21] x86/xen: Support objtool validation in xen-asm.S Josh Poimboeuf
2021-01-15  0:31   ` boris.ostrovsky
2021-01-14 19:40 ` [PATCH 14/21] x86/xen: Support objtool vmlinux.o validation in xen-head.S Josh Poimboeuf
2021-01-15  0:32   ` boris.ostrovsky
2021-01-15  5:17   ` Jürgen Groß
2021-01-15 19:46     ` Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 15/21] x86/xen/pvh: Convert indirect jump to retpoline Josh Poimboeuf
2021-01-15  0:33   ` boris.ostrovsky
2021-01-15  5:24   ` Jürgen Groß
2021-01-15 15:08     ` Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 16/21] x86/ftrace: Support objtool vmlinux.o validation in ftrace_64.S Josh Poimboeuf
2021-01-14 20:42   ` Steven Rostedt
2021-01-14 19:40 ` [PATCH 17/21] x86/acpi: Convert indirect jump to retpoline Josh Poimboeuf
2021-01-14 22:59   ` Andrew Cooper
2021-01-14 23:47     ` Josh Poimboeuf
2021-01-15  0:54       ` Andrew Cooper [this message]
2021-01-14 19:40 ` [PATCH 18/21] x86/acpi: Support objtool validation in wakeup_64.S Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 19/21] x86/power: Convert indirect jumps to retpolines Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 20/21] x86/power: Move restore_registers() to top of the file Josh Poimboeuf
2021-01-14 19:40 ` [PATCH 21/21] x86/power: Support objtool validation in hibernate_asm_64.S Josh Poimboeuf
2021-01-15  0:41 ` [PATCH 00/21] objtool: vmlinux.o and CLANG LTO support Sami Tolvanen
2021-01-15  0:49   ` Nick Desaulniers
2021-01-15 19:52   ` Josh Poimboeuf
2021-01-15 20:19     ` Sedat Dilek
2021-01-15 20:59       ` Josh Poimboeuf
2021-01-15 21:01         ` Sedat Dilek
2021-01-18 17:22   ` Josh Poimboeuf
2021-01-19 21:29     ` Nick Desaulniers
2021-01-20 15:37       ` Josh Poimboeuf
2021-01-15  4:51 ` Sedat Dilek
2021-01-15  5:18   ` Sedat Dilek
2021-01-15 15:30   ` Sedat Dilek
2021-01-15 18:54     ` Sedat Dilek
2021-01-15 19:28       ` Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70343174-b9cd-d80b-7be0-5d3e3e609ca2@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=ndesaulniers@google.com \
    --cc=pavel@ucw.cz \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=samitolvanen@google.com \
    --cc=sedat.dilek@gmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox