Re: [Patch v4 17/18] x86/speculation: Update SPEC_CTRL MSRs of remote CPUs

From: Tim Chen
Date: Mon Nov 05 2018 - 18:59:49 EST


Thomas,

>
>
> Aside of the condition being pointless in that case, that issues an IPI
> whether the task is running or not. So this allows a task to issue tons of
> async IPIs disturbing others by toggling the control.

I'm not crazy about sending IPIs too. Hence the original implementation
using TIF_UPDATE_SPEC_CTRL flag.

I've thought a bit about the options you suggested and was unclear
on a few things.

> 1) Restrict the PRCTL control so it is only possible to modify it at the
> point where the application is still single threaded.
>

My understanding is PRCTL applied on the task only. Should it be extended
to other task threads? In that case, it seems like we didn't do that for SSBD?

> 2) Add _TIF_UPDATE_SPEC_CTRL to the SYSCALL_EXIT_WORK_FLAGS and handle it
> in the slow work path.

There can be tasks that don't do any syscalls, and it seems like we can have MSRs getting
out of sync?

>
> I'm less and less convinced that piggybacking this on dumpable is a good
> idea.

There are daemons like sshd that are non-dumpable. So I think protecting
them is desired. Otherwise all those daemons will need to be updated to
use PRCTL. In the original implementation, IBPB is issued for
non-dumpable task. It will be nice to retain that.

Thanks.

Tim