Re: [RFC PATCH] asm/generic: introduce if_nospec and nospec_barrier

From: Linus Torvalds
Date: Wed Jan 03 2018 - 19:39:37 EST


On Wed, Jan 3, 2018 at 4:15 PM, Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
> The 'if_nospec' primitive marks locations where the kernel is disabling
> speculative execution that could potentially access privileged data. It
> is expected to be paired with a 'nospec_{ptr,load}' where the user
> controlled value is actually consumed.

I'm much less worried about these "nospec_load/if" macros, than I am
about having a sane way to determine when they should be needed.

Is there such a sane model right now, or are we talking "people will
randomly add these based on strong feelings"?

Linus