Date: Thu, 7 Mar 2019 12:02:13 -0800 From: Andy Lutomirski <luto@...nel.org> To: Borislav Petkov <bp@...en8.de> Cc: "H. Peter Anvin" <hpa@...or.com>, Nadav Amit <nadav.amit@...il.com>, Rick Edgecombe <rick.p.edgecombe@...el.com>, Andy Lutomirski <luto@...nel.org>, Ingo Molnar <mingo@...hat.com>, LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Dave Hansen <dave.hansen@...ux.intel.com>, Peter Zijlstra <peterz@...radead.org>, Damian Tometzki <linux_dti@...oud.com>, linux-integrity <linux-integrity@...r.kernel.org>, LSM List <linux-security-module@...r.kernel.org>, Andrew Morton <akpm@...ux-foundation.org>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, Linux-MM <linux-mm@...ck.org>, Will Deacon <will.deacon@....com>, Ard Biesheuvel <ard.biesheuvel@...aro.org>, Kristen Carlson Accardi <kristen@...ux.intel.com>, "Dock, Deneen T" <deneen.t.dock@...el.com>, Kees Cook <keescook@...omium.org>, Dave Hansen <dave.hansen@...el.com>, Masami Hiramatsu <mhiramat@...nel.org> Subject: Re: [PATCH v2 10/20] x86: avoid W^X being broken during modules loading On Thu, Mar 7, 2019 at 9:06 AM Borislav Petkov <bp@...en8.de> wrote: > > On Thu, Mar 07, 2019 at 08:53:34AM -0800, hpa@...or.com wrote: > > If we *do*, what is the issue here? Although boot_cpu_has() isn't > > slow (it should in general be possible to reduce to one testb > > instruction followed by a conditional jump) it seems that "avoiding an > > alternatives slot" *should* be a *very* weak reason, and seems to me > > to look like papering over some other problem. > > Forget the current thread: this is simply trying to document when to use > static_cpu_has() and when to use boot_cpu_has(). I get asked about it at > least once a month. > > And then it is replacing clear slow paths using static_cpu_has() with > boot_cpu_has() because there's purely no need to patch there. And having > a RIP-relative MOV and a JMP is good enough for slow paths. > Should we maybe rename these functions? static_cpu_has() is at least reasonably obvious. But cpu_feature_enabled() is different for reasons I've never understood, and boot_cpu_has() is IMO terribly named. It's not about the boot cpu -- it's about doing the same thing but with less bloat and less performance. (And can we maybe collapse cpu_feature_enabled() and static_cpu_has() into the same function?) --Andy
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.