live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] livepatching for 5.9-rc5
@ 2020-09-07  8:20 Petr Mladek
  2020-09-08 18:13 ` Linus Torvalds
  2020-09-08 18:16 ` pr-tracker-bot
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Mladek @ 2020-09-07  8:20 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, live-patching

Linus,

please pull the latest livepatching changes from

  git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching tags/livepatching-for-5.9-rc5

======================================

- Workaround "unreachable instruction" objtool warnings that happen
  with some compiler versions.

----------------------------------------------------------------
Josh Poimboeuf (1):
      Revert "kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled"

 Makefile | 4 ----
 1 file changed, 4 deletions(-)


Best Regards,
Petr

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

* Re: [GIT PULL] livepatching for 5.9-rc5
  2020-09-07  8:20 [GIT PULL] livepatching for 5.9-rc5 Petr Mladek
@ 2020-09-08 18:13 ` Linus Torvalds
  2020-09-08 18:32   ` Josh Poimboeuf
  2020-09-08 18:16 ` pr-tracker-bot
  1 sibling, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2020-09-08 18:13 UTC (permalink / raw)
  To: Petr Mladek, Josh Poimboeuf; +Cc: Linux Kernel Mailing List, live-patching

Josh,

On Mon, Sep 7, 2020 at 1:20 AM Petr Mladek <pmladek@suse.com> wrote:
>
> - Workaround "unreachable instruction" objtool warnings that happen
>   with some compiler versions.

I know I said this fixes things for me, but I just realized it doesn't entirely.

I wonder how I missed the remaining one:

   arch/x86/kvm/vmx/vmx.o: warning: objtool:
vmx_handle_exit_irqoff()+0x142: unreachable instruction

so apparently gcc and objtool can still disagree even without that
'-flive-patching'.

The unreachable code in question is after the call to
handle_external_interrupt_irqoff(), and while that function is a bit
odd, in this case I think it's objtool that is wrong.

I think that what happens is that the function doesn't have a 'ret'
instruction, and instead returns by doing a tail-call to
__sanitizer_cov_trace_pc with my config. And maybe that is what
confuses objtool.

This is current tip-of-git of my tree, with a allmodconfig build (but
the actual config will then depend on things like the gcc plugins
being there too, so you may not get exactly the same thing as I do)

Josh? Am I missing something, and the objtool warning is valid? But
yes, that code is doing some very very special stuff with that thunk
call asm, so it's hard to read the asm.

                  Linus

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

* Re: [GIT PULL] livepatching for 5.9-rc5
  2020-09-07  8:20 [GIT PULL] livepatching for 5.9-rc5 Petr Mladek
  2020-09-08 18:13 ` Linus Torvalds
@ 2020-09-08 18:16 ` pr-tracker-bot
  1 sibling, 0 replies; 6+ messages in thread
From: pr-tracker-bot @ 2020-09-08 18:16 UTC (permalink / raw)
  To: Petr Mladek; +Cc: Linus Torvalds, linux-kernel, live-patching

The pull request you sent on Mon, 7 Sep 2020 10:20:36 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching tags/livepatching-for-5.9-rc5

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/612ab8ad64140f0f291d7baae45982ce7119839a

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* Re: [GIT PULL] livepatching for 5.9-rc5
  2020-09-08 18:13 ` Linus Torvalds
@ 2020-09-08 18:32   ` Josh Poimboeuf
  2020-09-08 18:42     ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Josh Poimboeuf @ 2020-09-08 18:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Petr Mladek, Linux Kernel Mailing List, live-patching

On Tue, Sep 08, 2020 at 11:13:58AM -0700, Linus Torvalds wrote:
> Josh,
> 
> On Mon, Sep 7, 2020 at 1:20 AM Petr Mladek <pmladek@suse.com> wrote:
> >
> > - Workaround "unreachable instruction" objtool warnings that happen
> >   with some compiler versions.
> 
> I know I said this fixes things for me, but I just realized it doesn't entirely.
> 
> I wonder how I missed the remaining one:
> 
>    arch/x86/kvm/vmx/vmx.o: warning: objtool:
> vmx_handle_exit_irqoff()+0x142: unreachable instruction
> 
> so apparently gcc and objtool can still disagree even without that
> '-flive-patching'.
> 
> The unreachable code in question is after the call to
> handle_external_interrupt_irqoff(), and while that function is a bit
> odd, in this case I think it's objtool that is wrong.
> 
> I think that what happens is that the function doesn't have a 'ret'
> instruction, and instead returns by doing a tail-call to
> __sanitizer_cov_trace_pc with my config. And maybe that is what
> confuses objtool.
> 
> This is current tip-of-git of my tree, with a allmodconfig build (but
> the actual config will then depend on things like the gcc plugins
> being there too, so you may not get exactly the same thing as I do)
> 
> Josh? Am I missing something, and the objtool warning is valid? But
> yes, that code is doing some very very special stuff with that thunk
> call asm, so it's hard to read the asm.

Hm, I don't think I've seen that one.  We saw a similar warning in that
function before, but it was caused by the combination of
CONFIG_UBSAN_ALIGNMENT and CONFIG_UBSAN_TRAP, which I think Kees fixed.

Can you share the .o file?  At least I can't recreate with GCC 9.3.1,
which is all I have at the moment.

-- 
Josh


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

* Re: [GIT PULL] livepatching for 5.9-rc5
  2020-09-08 18:32   ` Josh Poimboeuf
@ 2020-09-08 18:42     ` Linus Torvalds
  2020-09-08 20:59       ` Josh Poimboeuf
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2020-09-08 18:42 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: Petr Mladek, Linux Kernel Mailing List, live-patching

On Tue, Sep 8, 2020 at 11:32 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> Can you share the .o file?  At least I can't recreate with GCC 9.3.1,
> which is all I have at the moment.

Done off-list in private, because I don't think anybody else wants
object files flying around on the mailing lists..

               Linus

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

* Re: [GIT PULL] livepatching for 5.9-rc5
  2020-09-08 18:42     ` Linus Torvalds
@ 2020-09-08 20:59       ` Josh Poimboeuf
  0 siblings, 0 replies; 6+ messages in thread
From: Josh Poimboeuf @ 2020-09-08 20:59 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Petr Mladek, Linux Kernel Mailing List, live-patching

On Tue, Sep 08, 2020 at 11:42:00AM -0700, Linus Torvalds wrote:
> On Tue, Sep 8, 2020 at 11:32 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > Can you share the .o file?  At least I can't recreate with GCC 9.3.1,
> > which is all I have at the moment.
> 
> Done off-list in private, because I don't think anybody else wants
> object files flying around on the mailing lists..

The problem is that objtool ignores handle_external_interrupt_irqoff()
(because it has the STACK_FRAME_NON_STANDARD annotation), and the
'ignore' logic is a bit crude.

Because that function is ignored, the tail call isn't detected (as you
pointed out).  Which confuses the static noreturn detection logic.

The proper fix would be to move that thunk call code to proper asm,
where we can add some unwind hints, and then get rid of the
STACK_FRAME_NON_STANDARD.

But, in the interest of being lazy, here's the easiest fix for now.
I'll need to run some builds to make sure it doesn't break anything.

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e034a8f24f46..90a66891441a 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -619,7 +619,7 @@ static int add_jump_destinations(struct objtool_file *file)
 		if (!is_static_jump(insn))
 			continue;
 
-		if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
+		if (insn->offset == FAKE_JUMP_OFFSET)
 			continue;
 
 		reloc = find_reloc_by_dest_range(file->elf, insn->sec,


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

end of thread, other threads:[~2020-09-08 20:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07  8:20 [GIT PULL] livepatching for 5.9-rc5 Petr Mladek
2020-09-08 18:13 ` Linus Torvalds
2020-09-08 18:32   ` Josh Poimboeuf
2020-09-08 18:42     ` Linus Torvalds
2020-09-08 20:59       ` Josh Poimboeuf
2020-09-08 18:16 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).