Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime

From: Josh Poimboeuf
Date: Fri Feb 16 2024 - 00:42:43 EST


On Thu, Feb 15, 2024 at 04:53:49PM +0100, Borislav Petkov wrote:
> I'd tend to look in Josh's direction as to say what would be the right
> thing to do here and more specifically, where?
>
> We need to run objtool on the vdso objects which are *kernel* code.
> I.e., that initcall thing. The vdso-image-64.c gets generated by vdso2c
> and lands in arch/x86/entry/vdso/vdso-image-64.c, that's why objtool
> hasn't seen it yet.
>
> I mean, it is one initcall in the vdso, probably not that important and
> if its return hasn't been patched, it won't be the end of the world but
> still...
>
> In any case, the patch works as advertized! :-)

Right, the good news is this isn't a regression and the warning is
working as designed.

This should tell the build to invoke objtool on that file:

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index b1b8dd1608f7..92d67379f570 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -36,6 +36,7 @@ UBSAN_SANITIZE_vma.o := y
KCSAN_SANITIZE_vma.o := y
OBJECT_FILES_NON_STANDARD_vma.o := n
OBJECT_FILES_NON_STANDARD_extable.o := n
+OBJECT_FILES_NON_STANDARD_vdso-image-64.o := n

# vDSO images to build
vdso_img-$(VDSO64-y) += 64