Re: [PATCH 4/9] x86/alternative: Implement .retpoline_sites support

From: Josh Poimboeuf
Date: Wed Oct 13 2021 - 16:53:07 EST


On Wed, Oct 13, 2021 at 02:22:21PM +0200, Peter Zijlstra wrote:
> /*
> + * Rewrite the retpolines, must be done before alternatives since
> + * those can rewrite the retpoline thunks.
> + */

Why exactly is that a problem? This code doesn't read the thunks.

BTW, CALL_NOSPEC results in a retpoline site in .altinstr_replacement:

Relocation section [40] '.rela.retpoline_sites' for section [39] '.retpoline_sites' at offset 0x8d28 contains 1 entry:
Offset Type Value Addend Name
000000000000000000 X86_64_PC32 000000000000000000 +10 .altinstr_replacement

Which I assume we don't want.

--
Josh