Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4145171imj; Tue, 19 Feb 2019 16:34:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IY/RBA8dvjuFcFrZQDSG8kS42AWKg9OHOAQRgzJxwQUeI+a1rb5YIPE7yDaO+Bi8kw5yB7P X-Received: by 2002:a17:902:28e9:: with SMTP id f96mr33847304plb.169.1550622879062; Tue, 19 Feb 2019 16:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550622879; cv=none; d=google.com; s=arc-20160816; b=K8sg3zIiyWYzjsivZjZ4T+Xr6AVn/yq3msFRG1FCoPFdgkZfDxH8f20MIDqeWM5TDa P2x5MV/Ex68CziioUy5hZK28g7qfBAJtyWVgA3kZOYeZ473m3nlqjxxTRavBiyBa2J9B d4ATCe8hFFfs1BYIaNiWdinmvai3Gct6mKLoG4UCCzlUorYjCU3U6jlVf5WFNB/i+0rS HZ+JVxOWyoc5TYAYRMAKyLJHVNKVD8tOvnXwxdslFiFIcInhPckxYKN4cusePwCnrNDU h69nHs2xcKSttG9WJLDgRxj+ajU2I0UpT6BOc7VahkDjzYo+rUidCCJj6Q2iWk9QgoWD ZBDQ== 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:dkim-signature; bh=NwN+Jt3ZZakNJms1dHXa2loufk0avXwMpkKjY/EeVZA=; b=jp7PBRSPPTLbZSQyoxalF77ILXtUStd6K+8CbvKSHGPfwUSA6mjBfwHFkoL15irxKV 1abvAf5feZOoGIAVMuzu915yxV7tKT4nSwh9skCGPdSTkeqok4F05QYTI2U7q9QJTbx5 rMwc3O8vn7lKQ6Z/kfxswYtlWWNWcsafy5hfiXQgzSZEHr/EG6YakMJzeDrBnTjeUQ/r Yz+B3bSnXrNPptJghrwaMbNOs2TGmEpSwHNqTJJu01GiivDPEe8oBmFmTZyBKscwpwdi KxtUJjXk4MRoZqRDGHiXtDU4z8yj3E1IaynIGC/G2qB53o7HaScoUxApZF0SgP+Y2TSk 8d/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MPn8+etu; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si16002494pgw.142.2019.02.19.16.34.23; Tue, 19 Feb 2019 16:34:39 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=MPn8+etu; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729673AbfBTAeC (ORCPT + 99 others); Tue, 19 Feb 2019 19:34:02 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:37140 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbfBTAeC (ORCPT ); Tue, 19 Feb 2019 19:34:02 -0500 Received: by mail-it1-f196.google.com with SMTP id z124so11416754itc.2 for ; Tue, 19 Feb 2019 16:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NwN+Jt3ZZakNJms1dHXa2loufk0avXwMpkKjY/EeVZA=; b=MPn8+etuUTJv5FFBQby0PnBuwu94H+4a+fQy8mkiiOR2r4Ssf6X819hZBpxcWhYVs0 GzgGs8PAC6f71u+HtvJQL0WsOhSjoaowxwUrgzqypAt8HT3jmD3onb0c6Zvx4w2jfVOo hmd4eXtN2oR++9PLjOf94TTjHGFaKFF0jocbDAokssm9yyJ2nQRKoFh5gk9PH1qUSOwH /mlpihm8rH49AJN0kTyJPvJBAEjp8t6qFT9+GdIGBCR3jfqJd8zO6oWol1aWSDitvVyv fVu+vcb2A4f4XISGBZKynttSDJgggFsVxBf+hWrJiJaumKQ5j6M4FBwtcAJLhjiFLhyA bJlA== 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=NwN+Jt3ZZakNJms1dHXa2loufk0avXwMpkKjY/EeVZA=; b=n+FHkKqbHWh7ZOCq/qWyVURQXgZBmoJ4dD4JsdVFF62l4XGGKAFTREmsUr8Zot5whP F3T+bdyN3fAiPqmdZil1tYk3MrVvGw4lC2S4k4OcjBj0H9rKmzihJzuXcxMfOdC47TnA yLHjkpp45oufamcKQbq2+dWFhE706EorV4pXJtJ7nwepPX0Vir7LQ3PBMo6zRFxVHK2V LoBjYGFln29BGZAxCQ03iozIxbil42cOVHUZfrFfsOnJxV52MCkO6Ncsm06uNMAR3+J6 +WWDeeLLQt0PXN0EYcJcG9vaCxwdw/T7huirsdmz3m9A4jFfW7WUznTuq/DV4XrrzYZm pL1A== X-Gm-Message-State: AHQUAuZG1ivWWEJua6117qyAQlT8ec3haTpnbhj4ARN0MdTOcoz+fq8H 4SmFeJxbOHGcnFXPL1mEf77sKG3nwW2YpKLzZWe9eQ== X-Received: by 2002:a5e:870c:: with SMTP id y12mr16675590ioj.280.1550622840900; Tue, 19 Feb 2019 16:34:00 -0800 (PST) MIME-Version: 1.0 References: <20190219214940.391081-1-arnd@arndb.de> <1550614664.6911.45.camel@lca.pw> In-Reply-To: From: Kostya Serebryany Date: Tue, 19 Feb 2019 16:33:49 -0800 Message-ID: Subject: Re: [PATCH] kasan: turn off asan-stack for clang-8 and earlier To: Nick Desaulniers Cc: Qian Cai , Arnd Bergmann , Andrey Ryabinin , Masahiro Yamada , Michal Marek , Andrew Morton , Dmitry Vyukov , Mark Brown , Alexander Potapenko , Martin Schwidefsky , Christoph Lameter , Andrey Konovalov , LKML , Linux Kbuild mailing list , kasan-dev , Evgenii Stepanov 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 Tue, Feb 19, 2019 at 2:43 PM Nick Desaulniers wrote: > > + Evgenii, Kostya for KASAN > > On Tue, Feb 19, 2019 at 2:17 PM Qian Cai wrote: > > > > On Tue, 2019-02-19 at 22:49 +0100, Arnd Bergmann wrote: > > > Building an arm64 allmodconfig kernel with clang results in over 140 warnings > > > about overly large stack frames, the worst ones being: > > > > > > drivers/gpu/drm/panel/panel-sitronix-st7789v.c:196:12: error: stack frame size > > > of 20224 bytes in function 'st7789v_prepare' > > > drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c:196:12: > > > error: stack frame size of 13120 bytes in function 'td028ttec1_panel_enable' > > > drivers/usb/host/max3421-hcd.c:1395:1: error: stack frame size of 10048 bytes > > > in function 'max3421_spi_thread' > > > drivers/net/wan/slic_ds26522.c:209:12: error: stack frame size of 9664 bytes > > > in function 'slic_ds26522_probe' > > > drivers/crypto/ccp/ccp-ops.c:2434:5: error: stack frame size of 8832 bytes in > > > function 'ccp_run_cmd' > > > drivers/media/dvb-frontends/stv0367.c:1005:12: error: stack frame size of 7840 > > > bytes in function 'stv0367ter_algo' > > > > > > None of these happen with gcc today, and almost all of these are the result > > > of a single known bug in llvm. Hopefully it will eventually get fixed with > > > the > > > clang-9 release. I am not confident we can fix this in clang. The difference between gcc and clang, AFAICT, is not in the asan instrumentation, but in inining. Looking at the reproducer from https://bugs.llvm.org/show_bug.cgi?id=38809#c4, if I change ltv350qv_write_reg to always inline, gcc also produces a huge 10K stack frame, and making it noinline fixes the stack frame for both gcc and clang. > > Would it be better to disable outright if CC_IS_CLANG, then go back > and adjust it once we know explicitly which version it lands in? > (Maybe I'm being too pessimistic about when it may be fixed). > > > > > > > In the meantime, the best idea I have is to turn off asan-stack for clang-8 > > > and earlier, so we can produce a kernel that is safe to run. > > > > > > I have posted three patches that address the frame overflow warnings that are > > > not addressed by turning off asan-stack, so in combination with this change, > > > we get much closer to a clean allmodconfig build, which in turn is necessary > > > to do meaningful build regression testing. > > > > Well, I am using clang 8.0 on arm64 and running the kernel just fine for a few > > weeks now and never trigger a single stack overflow (THREAD_SHIFT = 15) because > > I never use any of those drivers you mentioned above. I don't think it is a good > > idea to blankly remove the testing coverage here and affect people don't use all > > those offensive functions at all. > > Thanks for the patch, Arnd! Hopefully we can fix that up in Clang > soon. Qian, I guess the alternative would be to add `-mllvm > -asan-stack=0` on potentially up to 140 Makefiles? > > -- > Thanks, > ~Nick Desaulniers