|
Message-ID: <20181012152515.1d816906@alans-desktop> Date: Fri, 12 Oct 2018 15:25:15 +0100 From: Alan Cox <gnomes@...rguk.ukuu.org.uk> To: Andy Lutomirski <luto@...nel.org> Cc: Kees Cook <keescook@...omium.org>, Kristen Carlson Accardi <kristen@...ux.intel.com>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org> Subject: Re: [PATCH] x86: entry: flush the cache if syscall error > But this really needs to be clarified. Alan said that a bunch of the > "yet another Spectre variant" attacks would have been mitigated by > this patch. An explanation of *how* would be in order. Today you have the situation where something creates a speculative disclosure gadget. So we run around and we try and guess where to fix them all with lfence. If you miss one then it leaves a trace in the L1D cache, which is what you measure. In almost every case we have looked at when you leave a footprint in the L1D you resolve to an error path so the syscall errors. In other words every time we fail to find a if (foo < limit) { gadget(array[foo]); } else return -EINVAL; we turn that from being an easy to use gadget into something really tricky because by the time the code flow has gotten back to the caller the breadcrumbs have been eaten by the L1D flush. The current process of trying to find them all with smatch and the like is a game of whack-a-mole that will go on for a long long time. In the meantime (and until the tools get better) it's nice to have an option that takes a totally non-hot path (the fast path change is a single test for >= 0) and provides additional defence in depth. They are not hot paths: when I started playing with this idea I did indeed strace my entire desktop for a day. There are couple of other cases I would add to the pass list (EAGAIN, EWOULDBLOCK)). Tracing other stuff you see the same - real world workloads simply don't generate vast spews of erroring syscalls. Look just how many examples we are still committing like de916736aaaadddbd6061472969f667b14204aa9 7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1 46feb6b495f7628a6dbf36c4e6d80faf378372d4 55690c07b44a82cc3359ce0c233f4ba7d80ba145 This approach turns the ones we miss into if (type > = [speculatively create breadcrumb] condition resolves, return -EINVAL L1D flush No breadcrumbs At best you have a microscopic window to attack it on the SMT pair. Alan
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.