From: Peter Zijlstra <peterz@infradead.org>
To: kbuild-all@lists.01.org
Subject: Re: [peterz-queue:x86/objtool 4/20] arch/x86/kernel/relocate_kernel_64.o: warning: objtool: .text+0x0: unreachable instruction
Date: Sun, 22 Mar 2020 11:39:44 +0100 [thread overview]
Message-ID: <20200322103944.GG2452@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <202003221657.gVRW0vRM%lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]
On Sun, Mar 22, 2020 at 04:02:21PM +0800, kbuild test robot wrote:
> All warnings (new ones prefixed by >>):
>
> >> arch/x86/kernel/relocate_kernel_64.o: warning: objtool: .text+0x0: unreachable instruction
Josh, the below patch generates this warning. It actually does get
there:
/* jump to identity mapped page */
addq $(identity_mapped - relocate_kernel), %r8
pushq %r8
ret
But I don't blame objtool for not actually grokking that. Any idea what
the best way to fix this would be? The annotate_reachable() annotation
doesn't seem to work...
SYM_CODE_START_NOALIGN(relocate_kernel)
+ 999:
+ .pushsection .discard.reachable
+ .long 999b - .
+ .popsection
/*
* %rdi indirection_page
* %rsi page_list
---
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -32,7 +32,6 @@ KASAN_SANITIZE_paravirt.o := n
# by several compilation units. To be safe, disable all instrumentation.
KCSAN_SANITIZE := n
-OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y
OBJECT_FILES_NON_STANDARD_test_nx.o := y
OBJECT_FILES_NON_STANDARD_paravirt_patch.o := y
--- a/arch/x86/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
@@ -9,6 +9,7 @@
#include <asm/kexec.h>
#include <asm/processor-flags.h>
#include <asm/pgtable_types.h>
+#include <asm/nospec-branch.h>
/*
* Must be relocatable PIC code callable as a C function
@@ -192,14 +193,12 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_ma
1:
popq %rdx
leaq PAGE_SIZE(%r10), %rsp
+ ANNOTATE_RETPOLINE_SAFE
call *%rdx
/* get the re-entry point of the peer system */
movq 0(%rsp), %rbp
- call 1f
-1:
- popq %r8
- subq $(1b - relocate_kernel), %r8
+ leaq relocate_kernel(%rip), %r8
movq CP_PA_SWAP_PAGE(%r8), %r10
movq CP_PA_BACKUP_PAGES_MAP(%r8), %rdi
movq CP_PA_TABLE_PAGE(%r8), %rax
prev parent reply other threads:[~2020-03-22 10:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-22 8:02 [peterz-queue:x86/objtool 4/20] arch/x86/kernel/relocate_kernel_64.o: warning: objtool: .text+0x0: unreachable instruction kbuild test robot
2020-03-22 10:39 ` Peter Zijlstra [this message]
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=20200322103944.GG2452@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=kbuild-all@lists.01.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 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.