Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 23 Jan 2019 01:35:29 -0000 Received: from mga11.intel.com ([192.55.52.93]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gm7Rw-0006X6-DK for speck@linutronix.de; Wed, 23 Jan 2019 02:35:28 +0100 Date: Tue, 22 Jan 2019 17:35:25 -0800 From: Andi Kleen Subject: [MODERATED] Re: [PATCH v5 14/27] MDSv5 3 Message-ID: <20190123013525.GX6118@tassilo.jf.intel.com> References: <8b89fce6dd87638a00078082141d3ce5fe13d0ea.1547858934.git.ak@linux.intel.com> MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: > Lets look at the different scenarios: > > process A -> process A Thread switch in same process, > do nothing > > process A -> process B Switches mm -> set percpu flush > > process A -> kernel Do nothing (rely on lazy mm) > kernel -> process B Switches mm -> set percpu flush > kernel -> kernel do nothing > kernel -> process A if lazy mm -> set percpu flush > > process A in syscall > interrupt handler touches sensitive data > -> set percpu flush > > softinterrupt handler touches sensitive data > -> set percpu flush Ok the drawback of the percpu flush is that the system exit code needs to check a new cache line. But it's probably not that bad. > > The percpu flush request is only cleared on sysexit, so once it is set it's > uninteresting what other stuff runs before the next sysexit. > > That covers everything from preemption to migration and whatever. > > The only thing which is not covered are functions in syscall context which > touch sensitive data which does not belong to the process. It's also cryptographic keys. > > Do they actually exist? If so, then and only then you need the full There is plenty crypto code in process context at least. > start/stop annotation and transfer the state on migration to be completely > correct. Migration is covered in my patchkit currently by setting the flag unconditionally on any kernel preemption. With that one just a per cpu flag is good enough, I don't think full annotation is needed. -Andi