Re: [GIT PULL] livepatching for 5.9-rc5

From: Josh Poimboeuf
Date: Tue Sep 08 2020 - 16:59:58 EST


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@xxxxxxxxxx> 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,