Re: [PATCH] x86: Don't build vDSO with $(RETPOLINE_CFLAGS) -DRETPOLINE

From: David Woodhouse
Date: Tue Mar 20 2018 - 04:21:18 EST


On Mon, 2018-03-19 at 14:11 -0700, H.J. Lu wrote:
> vDSO code runs in userspace. Don't compile it with retpoline.
>
> Signed-off-by: H.J. Lu <hjl.tools@xxxxxxxxx>

There are cases where we might actually want userspace to be using
retpoline though. We still only do IBPB for *some* processes, and
haven't really even finished the argument about the heuristics we use
for that.

If this is only for the switch in __vdso_clock_gettime() then maybe we
turn that into a series of if/else instead of a switch. Or just write
it in asm.

Or better still, teach GCC that when it's using retpoline, a jump table
is *NOT* faster than a series of that many conditional branches. The
costs are higher, and I don't think we taught GCC that yet, did we?

Attachment: smime.p7s
Description: S/MIME cryptographic signature