From: Ard Biesheuvel Subject: Re: [PATCH net-next v5 02/20] zinc: introduce minimal cryptography library Date: Thu, 20 Sep 2018 21:30:26 -0700 Message-ID: References: <20180918161646.19105-1-Jason@zx2c4.com> <20180918161646.19105-3-Jason@zx2c4.com> <20180921031255.GB11109@lunn.ch> <8FA361E3-FBCB-469E-88DC-F4085BD91175@amacapital.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: Andy Lutomirski , Andrew Lunn , Arnd Bergmann , Eric Biggers , LKML , Netdev , Linux Crypto Mailing List , David Miller , Greg Kroah-Hartman , Samuel Neves , Andrew Lutomirski , Jean-Philippe Aumasson To: "Jason A. Donenfeld" Return-path: In-Reply-To: Sender: netdev-owner@vger.kernel.org List-Id: linux-crypto.vger.kernel.org On 20 September 2018 at 21:15, Jason A. Donenfeld wrote: > Hi Andy, > > On Fri, Sep 21, 2018 at 5:23 AM Andy Lutomirski wro= te: >> At the risk on suggesting something awful: on x86_64, since we turn pree= mption off for simd, it wouldn=E2=80=99t be *completely* insane to do the c= rypto on the irq stack. It would look like: >> >> kernel_fpu_call(func, arg); >> >> And this helper would disable preemption, enable FPU, switch to the irq = stack, call func(arg), disable FPU, enable preemption, and return. And we c= an have large IRQ stacks. >> >> I refuse to touch this with a ten-foot pole until the lazy FPU restore p= atches land. > > Haha. That's fun, and maybe we'll do that at some point, but I have > some other reasons too for being on a workqueue now. > Kernel mode crypto is callable from any context, and SIMD can be used in softirq context on arm64 (and on x86, even from hardirq context IIRC if the interrupt is taken from userland), in which case we'd already be on the irq stack. >> >> All that being said, why are these frames so large? It sounds like some= thing may be spilling that ought not to. > > They're not. Well, they're not anymore. I had a silly thing before > like "u8 buffer[1 << 12]" in some debugging code, which is what > prompted the ccflag-y addition. I cleaned up the mistakes like that > and frames are now reasonable everywhere. Non-issue. > Did any of the fuzzing/testing you mention in the cover letter occur on the kernel versions of these algorithms?