Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp15192imp; Wed, 20 Feb 2019 13:14:24 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib79O1Tj/p1o049zYjp/H8mBhB3Q3wckNeNhbFnpUzp8UntLs17qMQktBjkyWbGf5p54TdY X-Received: by 2002:a63:5a42:: with SMTP id k2mr17300006pgm.333.1550697263964; Wed, 20 Feb 2019 13:14:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550697263; cv=none; d=google.com; s=arc-20160816; b=EmSjlj4hQZKsPCaUgg/R/R52j5xIA6gqY9ZcElT3ilYsyO+5LHWwrOs0h/oxeEgQzf G7kwRqtTqIUXqJwon3nF5zspBUFlzr0/5vevWI/A40e7FaU1F1hGSrGPzShELys1aghd fao0B8bNzh6hdvfuw9B8Qjkd/NigyQz9hTAAirbKVyQbANiQqBOtV0gtT/46gx804qRM cinbTXTkYCRWKPtBevT+vytr0tZ0HpiSdWiZc6aq+NtjH+p5bktLH+VVCMUJRnocggHV LRbCcA18YZt2OaK70ymQL5FNM1cwoDlXHs5Ue8ucnLgyW5xwvvAf3xkVJIRBCz9heFmP Qe3w== 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=xYAM8803DgMBsb+plIT908312TQzSVQLnERb5Qtg750=; b=CmjKaH2g0b8uBqs0I1RM2X3zFyF8FdpCGBeCf6Xt7mHmNIUBbccbGL2v21P1Xuesun g7IMjGBOTAX2kSWPauOjb2iFa+YZM9Fk0hX7VcuTVrGpNZ+gpPB69bvAZTlaAxLFiYfC uuaNueyC8lGuEMnCMBhZCpsF3LL12RR+1k+ZjBXlpdgHs/h6WIoGS8+PWWEek5JZ+zTU oEeCqfBxyRDxbDiXcPhKNW3mMiXIFMdqcKUeY815VHxKDG/z9eaZltmK1OQgFZ/RGz3n gkA+Eddng1aW7gPVCki5bK6w6cXwtBKEezltRxOaHr6lxIPm1p7avKBiV/lVavV2yTE6 GdFA== 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 l63si4200391pfj.53.2019.02.20.13.14.07; Wed, 20 Feb 2019 13:14:23 -0800 (PST) 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 S1727084AbfBTVNl (ORCPT + 99 others); Wed, 20 Feb 2019 16:13:41 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:43136 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbfBTVNl (ORCPT ); Wed, 20 Feb 2019 16:13:41 -0500 Received: by mail-qt1-f193.google.com with SMTP id y4so28990644qtc.10; Wed, 20 Feb 2019 13:13:40 -0800 (PST) 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=xYAM8803DgMBsb+plIT908312TQzSVQLnERb5Qtg750=; b=XjUOsRuxe8B1+rOcfoJGFXb1vZmTNNqDa+HABT0DZk65GhLT5q5EQXNQb1WFaXTuYe pw2dHDfsEmmOj1O1uaSKiNSIEcpGaYE37C5tBvXeD5q050kwB5H+uXguvDtRqXxGqJun MNDlPhZp2WpQJlS1+HsXTj6IYiYbkU233z0vORs12jhNkMcUTFZdYK17kk8kK++1/xH6 dlJgpjQOXN3qkLPAmWb4WhS2XSGgJWyxYQ42N5bwmkgRDxjc2naJZ3RRAVrP2uTtAWdd em5LNzOA67emRRS4wBekWxEPSvIiAB0YGmxKQWlMuCB+OmfgmnHMTma5ezWvVXHh2jAR u/Kw== X-Gm-Message-State: AHQUAuaFl/x+uaP7l4T1nUUAVkhWhg4XEO2EjzxcCVDLaOieGYONu4CT Ga5lNpLWSKBU9FR2R7oObybra+jcBi7q4JnkW4I= X-Received: by 2002:ac8:2c34:: with SMTP id d49mr29107490qta.152.1550697219940; Wed, 20 Feb 2019 13:13:39 -0800 (PST) MIME-Version: 1.0 References: <20190219214940.391081-1-arnd@arndb.de> <20190220184408.GG9878@sirena.org.uk> In-Reply-To: From: Arnd Bergmann Date: Wed, 20 Feb 2019 22:13:22 +0100 Message-ID: Subject: Re: [PATCH] kasan: turn off asan-stack for clang-8 and earlier To: Nick Desaulniers Cc: Mark Brown , Kostya Serebryany , Evgenii Stepanov , Andrey Ryabinin , Andrey Konovalov , Masahiro Yamada , Michal Marek , Andrew Morton , Dmitry Vyukov , Qian Cai , Alexander Potapenko , Martin Schwidefsky , Christoph Lameter , LKML , Linux Kbuild mailing list , kasan-dev 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 Wed, Feb 20, 2019 at 9:02 PM Nick Desaulniers wrote: > > On Wed, Feb 20, 2019 at 10:44 AM Mark Brown wrote: > > > > On Wed, Feb 20, 2019 at 10:07:36AM -0800, Nick Desaulniers wrote: > > > > > I like Evgenii's idea: > > > https://bugs.llvm.org/show_bug.cgi?id=38809#c10 > > > > That's a suggestion to tune the inlining heuristics. > > Yes; but it will also improve KASAN (if feasible). From my experiments that I cited in the bug report, very few cases seem to actually be the result of different inlining decisions, and those that are tend to be kernel bugs (e.g. in drivers/scsi/bfa/bfa_fcs_lport.c clang reports a larger stack than gcc because it combines two functions that individually use 800 bytes each, but if one calls the other, we use even more stack than the combined function). In the example in https://bugs.llvm.org/show_bug.cgi?id=38809#c12 (https://godbolt.org/z/ylsGSQ) there is no inlining, yet clang uses over ten times as much stack space as gcc, for reasons I still can't explain. My assumption right now is that the underlying bug causes most of the problems with excessive stack usage in allmodconfig kernels. > > > While I myself share Arnd's goal of driving compiler warnings to zero, > > > in general I'd prefer not to disable warning-producing-features or > > > disable warnings outright for cases where we have some ideas of > > > changes we can make to the compiler. There's probably a list now of > > > false warnings produced by old versions of Clang from bugs in Clang > > > that we fixed. I'm not interested in additionally trying to work > > > around those somehow in kernel sources. > > > > We do have infrastructure in the kernel for managing warnings based on > > compiler version (Arnd was looking at some improvements to that IIRC), > > if we've got a kernel that builds with a given compiler it's worth > > looking at tuning what we do with that compiler. If newer versions of > > the compiler work better or have new options we can turn things on for > > them. > > so maybe something like (pseudocode): > if kasan && clang && clang_version < 9: > disable -Wframe-larger-than= > > If you overrun the stack with KASAN, a warning would be nice, but > you'll hopefully find out the hard way at runtime. And that doesn't > require up to 114 Makefile changes, which would be kind of obnoxious > for this papercut. That would mean that build testing allmodconfig with clang would ignore all the interesting stack overflow bugs that happen in real user systems without KASAN. Arnd