OSDN Git Service

objtool: Support pv_opsindirect calls for noinstr
authorPeter Zijlstra <peterz@infradead.org>
Thu, 24 Jun 2021 09:41:23 +0000 (11:41 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 17 Sep 2021 11:20:26 +0000 (13:20 +0200)
commitdb2b0c5d7b6f19b3c2cab08c531b65342eb5252b
tree68e20b1e3dbf761d76ea9e8dbdfe2b2677bd29b5
parent1462eb381b4c27576a3e818bc9f918765d327fdf
objtool: Support pv_opsindirect calls for noinstr

Normally objtool will now follow indirect calls; there is no need.

However, this becomes a problem with noinstr validation; if there's an
indirect call from noinstr code, we very much need to know it is to
another noinstr function. Luckily there aren't many indirect calls in
entry code with the obvious exception of paravirt. As such, noinstr
validation didn't work with paravirt kernels.

In order to track pv_ops[] call targets, objtool reads the static
pv_ops[] tables as well as direct assignments to the pv_ops[] array,
provided the compiler makes them a single instruction like:

  bf87:       48 c7 05 00 00 00 00 00 00 00 00        movq   $0x0,0x0(%rip)
    bf92 <xen_init_spinlocks+0x5f>
    bf8a: R_X86_64_PC32     pv_ops+0x268

There are, as of yet, no warnings for when this goes wrong :/

Using the functions found with the above means, all pv_ops[] calls are
now subject to noinstr validation.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210624095149.118815755@infradead.org
lib/Kconfig.debug
tools/objtool/arch/x86/decode.c
tools/objtool/check.c
tools/objtool/include/objtool/arch.h
tools/objtool/include/objtool/elf.h
tools/objtool/include/objtool/objtool.h
tools/objtool/objtool.c