Re: [PATCH] x86/bugs: protect against userspace-userspace spectreRSB

From: Jiri Kosina
Date: Wed Jul 25 2018 - 19:18:44 EST


On Wed, 25 Jul 2018, Linus Torvalds wrote:

> > Mitigate userspace-userspace attacks by always unconditionally filling RSB on
> > context switch when generic spectrev2 mitigation has been enabled.
>
> Shouldn't this also do something like
>
> x86_spec_ctrl_base |= x86_spec_ctrl_mask & SPEC_CTRL_STIBP;
>
> if we have HT enabled?

So IIUC your comment is not really tightly related to spectreRSB, is it?

If you're making a more general remark about things that we'd also have to
do in order to improve userspace-userspace spectrev2 prevention, then I
agree.

It probably wouldn't be as simple as adding it to x86_spec_ctrl_base I
think though, as the VM switching also has to save/restore it properly
(the same way we handle SSBD). So I'd rather handle this separately, as it
really is in principle a completely different protection.

STIBP is plugging much smaller hole than spectreRSB (as the bigger part is
already plugged by IBPB), so I'd rather have that one in first, and look
at improving STIBP later if noone beats me to it.

Thanks,

--
Jiri Kosina
SUSE Labs