[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25fa3975-a686-94bc-6a95-297b6b66de5b@linux.intel.com>
Date: Wed, 21 Nov 2018 10:16:40 -0800
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Jiri Kosina <jikos@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Tom Lendacky <thomas.lendacky@....com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Andi Kleen <ak@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>,
Casey Schaufler <casey.schaufler@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Jon Masters <jcm@...hat.com>,
Waiman Long <longman9394@...il.com>,
Greg KH <gregkh@...uxfoundation.org>,
Dave Stewart <david.c.stewart@...el.com>,
linux-kernel@...r.kernel.org, x86@...nel.org,
stable@...r.kernel.org, Jiri Kosina <jkosina@...e.cz>
Subject: Re: [Patch v7 14/18] x86/speculation: Add 'seccomp' Spectre v2 app to
app protection mode
On 11/21/2018 05:52 AM, Thomas Gleixner wrote:
> On Tue, 20 Nov 2018, Tim Chen wrote:
>> According to software guidance:
>>
>> "Setting ... STIBP ... on a logical processor prevents the predicted
>> targets of indirect branches on any logical processor of that core
>> from being controlled by software that executes (or executed
>> previously) on another logical processor of the same core."
>>
>> https://software.intel.com/security-software-guidance/insights/deep-dive-single-thread-indirect-branch-predictors
>>
>> Hence setting STIBP on a sandboxed task will prevent the task
>> from attacking other sibling threads or getting attacked.
>
> That's not sufficient, because you need an IBPB when the sandboxed task is
> switched out.
>
Right. Which means this change is also needed:
Tim
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 616694c..de31438 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -202,7 +202,8 @@ static bool ibpb_needed(struct task_struct *tsk, u64 last_ctx_id)
*/
if (static_branch_unlikely(&spectre_v2_app_lite))
- return test_tsk_thread_flag(tsk, TIF_SPEC_INDIR_BRANCH);
+ return test_tsk_thread_flag(tsk, TIF_SPEC_INDIR_BRANCH) ||
+ test_tsk_thread_flag(current, TIF_SPEC_INDIR_BRANCH);
else
return ptrace_may_access_sched(tsk, PTRACE_MODE_SPEC_IBPB);
}
Powered by blists - more mailing lists