]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/entry: Remove unwanted instrumentation in common_interrupt()
authorDmitry Vyukov <dvyukov@google.com>
Tue, 11 Jun 2024 07:50:30 +0000 (09:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:58 +0000 (16:29 +0200)
commit32e93cae4dc456ad731ff9cd8b29bc8e9716ad5f
tree3de625a5b2aa6ef4f5b9fb9fde7e7c4695bcefc9
parentd5c5afdb9e1efe7e7061e3688356bdae50bfd174
x86/entry: Remove unwanted instrumentation in common_interrupt()

[ Upstream commit 477d81a1c47a1b79b9c08fc92b5dea3c5143800b ]

common_interrupt() and related variants call kvm_set_cpu_l1tf_flush_l1d(),
which is neither marked noinstr nor __always_inline.

So compiler puts it out of line and adds instrumentation to it.  Since the
call is inside of instrumentation_begin/end(), objtool does not warn about
it.

The manifestation is that KCOV produces spurious coverage in
kvm_set_cpu_l1tf_flush_l1d() in random places because the call happens when
preempt count is not yet updated to say that the kernel is in an interrupt.

Mark kvm_set_cpu_l1tf_flush_l1d() as __always_inline and move it out of the
instrumentation_begin/end() section.  It only calls __this_cpu_write()
which is already safe to call in noinstr contexts.

Fixes: 6368558c3710 ("x86/entry: Provide IDTENTRY_SYSVEC")
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexander Potapenko <glider@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/3f9a1de9e415fcb53d07dc9e19fa8481bb021b1b.1718092070.git.dvyukov@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/idtentry.h