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

From: Borislav Petkov
Date: Tue Oct 24 2023 - 16:19:39 EST


On Thu, Oct 19, 2023 at 08:20:51AM -0700, Josh Poimboeuf wrote:
> GCC doesn't read asm. Even if it did that wouldn't fix things for
> callers of custom-ABI return-thunk-using functions.
>
> The below seems to work.

Right, I guess we can do something like that. Linker is not happy here
about that symbol, tho:

ld: arch/x86/lib/retpoline.o:(.altinstr_replacement+0x95): undefined reference to `warn_thunk_thunk'
make[2]: *** [scripts/Makefile.vmlinux:37: vmlinux] Error 1
make[1]: *** [/mnt/kernel/kernel/5th/linux/Makefile:1165: vmlinux] Error 2
make: *** [Makefile:234: __sub-make] Error 2

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette