Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2186426imm; Thu, 20 Sep 2018 09:03:01 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb3IxO5zolKb1vA429ltXizowT7XHCvY4mIPcVrIXGFlyx9D90T5/leU3Heh3P8bhLC5ADE X-Received: by 2002:a17:902:5ac1:: with SMTP id g1-v6mr5116903plm.161.1537459381563; Thu, 20 Sep 2018 09:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537459381; cv=none; d=google.com; s=arc-20160816; b=p4ZVzWJyHseHsu/7b7tYfu+n/b9I0ppd6DNElpi9Cf+KRYQFs6y/TvLlieNBeZQ1Rm CCYXiK5PWeXLb+bba1P4OIyqeoie30H5j31gXJbrT+uLz394Y7iiLm88yshBLs+EwWcO gYVEzO8st/y3ZDkp9usJ4MkMlC/fZWSb9mB2AE+klLLYwN658lO3hGgRZ5R92/mhb9o8 OBBJdY36rrbk9qMajsdz/0mFIjeVX3dR3BIJdQl6je+EXSgN0HKrN0s4yAVnMXcGYO0c p8Z6+FxovGkAHH8g73EMnWeUS/xfP3Q64Jx+CSnkHkSGUMwPMDTflKW5YcuBLz3ERjdL mIqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=nytyfi0fTlhxOobRdAPgJCStcxil1PT8fPInJa34k8E=; b=lq6XcsLQDIxDPVjWfIYkx+Wt5gISNO72UfnrCK5n1xLQWUo9GjCbbo4XrVdET/0FCR Fj0ni3krueFktmWLWbRKQxsZHGzdZb7FIa63/XOiykk+2QRL3v3VH766KtecULYrdWoC 1eRGzmJJ2XnE2FgbY+kdE03lmpjTqR4FiANcceXWED8t/3E31Agm+Z3Pb89bgbYjt6n8 vzCkI0ajeBQr2eNfwzNg844U9b155122Sd23v+gqxVEO1wa7/nxWQfrNAPl/Hp0HOwgB KMSAnR+rv5ogbY/T/vh7wzZHhoxWf3kTlFad5C/mHGU7ZsvefGvHnZF0IgSGrSrO+Cno pyxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c15-v6si2325070plo.357.2018.09.20.09.02.38; Thu, 20 Sep 2018 09:03:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728005AbeITVqe (ORCPT + 99 others); Thu, 20 Sep 2018 17:46:34 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:33202 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726768AbeITVqe (ORCPT ); Thu, 20 Sep 2018 17:46:34 -0400 Received: by mail-qt0-f194.google.com with SMTP id r37-v6so9021973qtc.0; Thu, 20 Sep 2018 09:02:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nytyfi0fTlhxOobRdAPgJCStcxil1PT8fPInJa34k8E=; b=ZMdI7JaSIwpvs1jBhA5QSoFqfBb47fkOGieesF1nil1pSUeUbaoQkuAorGGCSI139/ xNQmX1tRqaaD8Fdm+jbUXyRCKzi1wAoVwmoAl0pRkkbSZ6DdgesjtkWeLkdnwr2je0vv B7IoXstwtj9qH9LfJ6OSN4a4WHUy0wi2e6Yj6jQ7w3SH+M5+Bkp3JIyF6BWXNPB40pJs 7vNez5dBGcfqbs/9z2T8r9qNKFXBoq2g9ekY2Y68KqofGkmMd3P+Bsl6Qi6HhDcTzitP 8Hj7TyaQysESVfalVxv7LYmFTmy/izLP1Ex0oE3FAi8VOy/QDAAP4M+VR7JH1sOh3aKJ ewkA== X-Gm-Message-State: APzg51CglTJw8Dn++Rj4YbkwAAYVwI0Ml2KTkg5RK+eQxVbZpbp16ldR 22ePopwoWaVX3j08WkBVEoA1qBJuTaTBhucW88I= X-Received: by 2002:a0c:c171:: with SMTP id i46-v6mr28666936qvh.40.1537459344431; Thu, 20 Sep 2018 09:02:24 -0700 (PDT) MIME-Version: 1.0 References: <20180918161646.19105-1-Jason@zx2c4.com> <20180918161646.19105-3-Jason@zx2c4.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 20 Sep 2018 09:02:07 -0700 Message-ID: Subject: Re: [PATCH net-next v5 02/20] zinc: introduce minimal cryptography library To: Ard Biesheuvel Cc: "Jason A. Donenfeld" , Eric Biggers , Linux Kernel Mailing List , Networking , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , David Miller , gregkh , sneves@dei.uc.pt, Andy Lutomirski , jeanphilippe.aumasson@gmail.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 20, 2018 at 8:41 AM Ard Biesheuvel wrote: > > (+ Arnd, Eric) > > On 18 September 2018 at 09:16, Jason A. Donenfeld wrote: > ... > > > diff --git a/lib/zinc/Makefile b/lib/zinc/Makefile > > new file mode 100644 > > index 000000000000..83dfd63988c0 > > --- /dev/null > > +++ b/lib/zinc/Makefile > > @@ -0,0 +1,4 @@ > > Apologies for not spotting these before: > > > +ccflags-y := -O3 > > -O3 optimization has been problematic in the past, at least on x86 but > I think on other architectures as well. Please stick with -O2. > > > +ccflags-y += -Wframe-larger-than=$(if (CONFIG_KASAN),16384,8192) > > There is no way we can support code in the kernel with that kind of > stack space requirements. I will let Arnd comment on what we typically > allow, since he deals with such issues on a regular basis. Right, if you hit a stack requirement like this, it's usually the compiler doing something bad, not just using too much stack but also generating rather slow object code in the process. It's better to fix the bug by optimizing the code to not spill registers to the stack. In the long run, I'd like to reduce the stack frame size further, so best assume that anything over 1024 bytes (on 32-bit) or 1280 bytes (on 64-bit) is a bug in the code, and stay below that. For prototyping, you can just mark the broken functions individually by setting the warning limit for a specific function that is known to be misoptimized by the compiler (with a comment about which compiler and architectures are affected), but not override the limit for the entire file. Arnd