All of lore.kernel.org
 help / color / mirror / Atom feed
* [peterz-queue:x86/objtool 4/20] arch/x86/kernel/relocate_kernel_64.o: warning: objtool: .text+0x0: unreachable instruction
@ 2020-03-22  8:02 kbuild test robot
  2020-03-22 10:39 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2020-03-22  8:02 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/objtool
head:   40ca5fa157f3f5874c19277624728286f4bdc546
commit: b74c79de9b7b82a1f0270a8b3b6f5f26b2d19ae3 [4/20] x86/kexec: Use RIP relative addressing
config: x86_64-randconfig-s0-20200322 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
        git checkout b74c79de9b7b82a1f0270a8b3b6f5f26b2d19ae3
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/relocate_kernel_64.o: warning: objtool: .text+0x0: unreachable instruction

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29492 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [peterz-queue:x86/objtool 4/20] arch/x86/kernel/relocate_kernel_64.o: warning: objtool: .text+0x0: unreachable instruction
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2020-03-22 10:39 UTC (permalink / raw)
  To: kbuild-all

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-22 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.