From patchwork Mon Feb 19 10:13:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 128785 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3330077ljc; Mon, 19 Feb 2018 02:14:24 -0800 (PST) X-Google-Smtp-Source: AH8x2265lthc5IUPfTLZ6HrJAOlggS21AVZUSg6X6bdx/dlJfDoWDmV02U7ghK29cVkYWq7pSVHC X-Received: by 2002:a17:902:74c3:: with SMTP id f3-v6mr13835745plt.444.1519035264369; Mon, 19 Feb 2018 02:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519035264; cv=none; d=google.com; s=arc-20160816; b=E1z3Lp5ekkAH0qyg1e8u+0EfCarhLle6NRwuCBHhqDLk2wpa1kQaWXD0mexRio9KXe hdy2kEx9sPIdRPvplgDaIA0HtFIteabKiBWYPXe23J58NWFigBnDwE/M+8MvptOmimQJ 2LpB7EAC1FPUpktn+O7p0xOjzxqrPwY2q4nqUf73ZJBvoKXxG8HqbcKbyJKaSQk2V0L/ KPxNIXe6vciX7sJ323q5YmUjP/rISNjrp3YAE7mY/DT/ePqOTZs7B8PSSHiw2TNYB4xE 0o8WKn86R8PT0mr6mJMJeomayYJI1D0JI58Fvq696quR2gSKrWkt/9ZTq1AIHwi99HVh n7zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=YFWtT77g5ALI0menvTm90EKyKYJB1aPpo7vFfSVSVIA=; b=lzpyfGrAwlZBczWwojpltkp7UATc+ZJNm6wGAtooLKTkhyvFC+z3zUWBGkME/gzXju mPbX5Sef6mUlh4y0EwyMYUIpjeulV9cfQ8qZEno39ZTJ42RVn7hvQMecbitVrzFTjN19 6tvz5UHVHdN6alITzceI41PTZAcYDBMcRBjMu93Iyz/vGO6BBSyEK/rageB3V3SLyG3w kcmcYhY/PO6qGKRLsNsOpXr4ffUrrQPfHPAIWoud68/2tSI47zTimTKCOjeootAZI6ow Vj7y6TGwAwmpb12DJZuunzZ5hqLyUXVEXEpPY0Waf1qe4Cf9XAGcq9PhwTNRXXMytnb8 ei1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 f6si596686pfe.188.2018.02.19.02.14.24; Mon, 19 Feb 2018 02:14:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbeBSKOX (ORCPT + 10 others); Mon, 19 Feb 2018 05:14:23 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:39357 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752474AbeBSKOW (ORCPT ); Mon, 19 Feb 2018 05:14:22 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0MW4Oi-1fGNFS1qe0-00X4NC; Mon, 19 Feb 2018 11:14:10 +0100 From: Arnd Bergmann To: stable@vger.kernel.org Cc: Greg KH , linux-kernel@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrey Konovalov , Andrew Morton , Linus Torvalds , Sasha Levin , Sudip Mukherjee Subject: [4.9-stable 1/9] kasan: rework Kconfig settings Date: Mon, 19 Feb 2018 11:13:20 +0100 Message-Id: <20180219101343.2922561-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180219101343.2922561-1-arnd@arndb.de> References: <20180219101343.2922561-1-arnd@arndb.de> X-Provags-ID: V03:K0:wKI57U609WKa1lDv4jC1sGo6PKTYdkxXbFOocblHPrnST6aXqia 3vfTiOzqVrJr7lCxOKSzyGapmNvi2xwhz+LHaHuR/Wtpk9K2wZ+doFDpG1jdyUk/BdvTFmM att7ca/Zby8GvqoYrVscTw7CmhI2AL2ciLXGmhbbpiR3JC+DxU+5wOoW2PCp8UooyBA7kMw hesnrWvd0XBA3IDktCPzw== X-UI-Out-Filterresults: notjunk:1; V01:K0:W5+vt5H1TxQ=:Jqwb5FSaeF7MD+wKzSjBJ4 EtaIYwYSy7EsOobPB7IXEUGvto4u71CSsi25+5Tm5kfayRyu9LNE+fDqVBonoQ1LTSXQJABcn ZQw+AtudpCZzps0oM07Q/zWnlMuKpqXzuPjoFTp7ZwhszjOeXcSviqggRktM96vousqiaN9xS n37vZW8vzQUk2RQtwNI2+NbvtZcz7shyMF2njWOlonXFQNI88nM+QWZe42prs8kcnovcXdJX9 ZL7xS8D5Ncv2tKYoR+Hjcx+7+SrdqiowQne0cjcn+GJZeQSW/sCtAbyj/+nsNzDEZm+ces8EX w6YWdQsuyR+8stZz0/uxHvJPVCqpo9WesC4DL0UTQNt0bDd0e5/6kBYPfvBJ6VviBxUH5w2Vv whw+HoGbcWQ0zMaCi5IS0Z10/h644nJczGOeaLctfdwA9H2MqXBapW8CJQG6uaI93GJM5U1ux EMFcW1X+nyel8vwdBS3wm6JG5RtXh1D7O+b77ycXxjsaqRMFUyoWLn0nKwnfIiyMHgMyHsBOD VtrMi25Gte8tak94aVH+l0nB64N7fOXTMeQjDhefg8l6i+Zi4RBa+0yjRdxZWYc1xjzkQ8BaV NAPxwbkZsGnKGok1hCeXUGoKwuUoH4WiP3NO/unp0wFOS9FUaKKlQyuiwohSKe9eO66Dofcte 87NEc0IICmyJjyHGhq9BAJoYwZ+cmFiDupr+nRwk5/pBfAhBGIDybHBzSLoHQkW1XTN5MENY3 bDwja4qB5QpHYMo2zV6CcjXKONyz+Y3b9s6oTw== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org We get a lot of very large stack frames using gcc-7.0.1 with the default -fsanitize-address-use-after-scope --param asan-stack=1 options, which can easily cause an overflow of the kernel stack, e.g. drivers/gpu/drm/i915/gvt/handlers.c:2434:1: warning: the frame size of 46176 bytes is larger than 3072 bytes drivers/net/wireless/ralink/rt2x00/rt2800lib.c:5650:1: warning: the frame size of 23632 bytes is larger than 3072 bytes lib/atomic64_test.c:250:1: warning: the frame size of 11200 bytes is larger than 3072 bytes drivers/gpu/drm/i915/gvt/handlers.c:2621:1: warning: the frame size of 9208 bytes is larger than 3072 bytes drivers/media/dvb-frontends/stv090x.c:3431:1: warning: the frame size of 6816 bytes is larger than 3072 bytes fs/fscache/stats.c:287:1: warning: the frame size of 6536 bytes is larger than 3072 bytes To reduce this risk, -fsanitize-address-use-after-scope is now split out into a separate CONFIG_KASAN_EXTRA Kconfig option, leading to stack frames that are smaller than 2 kilobytes most of the time on x86_64. An earlier version of this patch also prevented combining KASAN_EXTRA with KASAN_INLINE, but that is no longer necessary with gcc-7.0.1. All patches to get the frame size below 2048 bytes with CONFIG_KASAN=y and CONFIG_KASAN_EXTRA=n have been merged by maintainers now, so we can bring back that default now. KASAN_EXTRA=y still causes lots of warnings but now defaults to !COMPILE_TEST to disable it in allmodconfig, and it remains disabled in all other defconfigs since it is a new option. I arbitrarily raise the warning limit for KASAN_EXTRA to 3072 to reduce the noise, but an allmodconfig kernel still has around 50 warnings on gcc-7. I experimented a bit more with smaller stack frames and have another follow-up series that reduces the warning limit for 64-bit architectures to 1280 bytes (without CONFIG_KASAN). With earlier versions of this patch series, I also had patches to address the warnings we get with KASAN and/or KASAN_EXTRA, using a "noinline_if_stackbloat" annotation. That annotation now got replaced with a gcc-8 bugfix (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715) and a workaround for older compilers, which means that KASAN_EXTRA is now just as bad as before and will lead to an instant stack overflow in a few extreme cases. This reverts parts of commit 3f181b4d8652 ("lib/Kconfig.debug: disable -Wframe-larger-than warnings with KASAN=y"). Two patches in linux-next should be merged first to avoid introducing warnings in an allmodconfig build: 3cd890dbe2a4 ("media: dvb-frontends: fix i2c access helpers for KASAN") 16c3ada89cff ("media: r820t: fix r820t_write_reg for KASAN") Do we really need to backport this? I think we do: without this patch, enabling KASAN will lead to unavoidable kernel stack overflow in certain device drivers when built with gcc-7 or higher on linux-4.10+ or any version that contains a backport of commit c5caf21ab0cf8. Most people are probably still on older compilers, but it will get worse over time as they upgrade their distros. The warnings we get on kernels older than this should all be for code that uses dangerously large stack frames, though most of them do not cause an actual stack overflow by themselves.The asan-stack option was added in linux-4.0, and commit 3f181b4d8652 ("lib/Kconfig.debug: disable -Wframe-larger-than warnings with KASAN=y") effectively turned off the warning for allmodconfig kernels, so I would like to see this fix backported to any kernels later than 4.0. I have done dozens of fixes for individual functions with stack frames larger than 2048 bytes with asan-stack, and I plan to make sure that all those fixes make it into the stable kernels as well (most are already there). Part of the complication here is that asan-stack (from 4.0) was originally assumed to always require much larger stacks, but that turned out to be a combination of multiple gcc bugs that we have now worked around and fixed, but sanitize-address-use-after-scope (from v4.10) has a much higher inherent stack usage and also suffers from at least three other problems that we have analyzed but not yet fixed upstream, each of them makes the stack usage more severe than it should be. Link: http://lkml.kernel.org/r/20171221134744.2295529-1-arnd@arndb.de Signed-off-by: Arnd Bergmann Acked-by: Andrey Ryabinin Cc: Mauro Carvalho Chehab Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Konovalov Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [arnd: rebase to v4.9; only re-enable warning] Signed-off-by: Arnd Bergmann --- lib/Kconfig.debug | 1 - 1 file changed, 1 deletion(-) -- 2.9.0 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f60e67217f18..58a22ca10f33 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -197,7 +197,6 @@ config ENABLE_MUST_CHECK config FRAME_WARN int "Warn for stack frames larger than (needs gcc 4.4)" range 0 8192 - default 0 if KASAN default 2048 if GCC_PLUGIN_LATENT_ENTROPY default 1024 if !64BIT default 2048 if 64BIT From patchwork Mon Feb 19 10:13:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 128787 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3330403ljc; Mon, 19 Feb 2018 02:14:49 -0800 (PST) X-Google-Smtp-Source: AH8x227M5B6F4K99xO8qCwKKeCwYzZWm6DsG3TTERDbkGbtW1ZdaLC8q+axYlPn+Ex5nstv84uzu X-Received: by 2002:a17:902:e65:: with SMTP id 92-v6mr341497plw.268.1519035289009; Mon, 19 Feb 2018 02:14:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519035289; cv=none; d=google.com; s=arc-20160816; b=ePxV90q63bCYmo8YmUDJns7n2TZs8yBq14n7vXgIOSFGqYjfzyk0CWuspx/O3/cBLE yvdCnWEcOoWhjEA9Fnng6jTVAAh7x7SymDpJejUn5OfDSplrs/HsICZ1BQSVo4vDerHX Q5APSZHlp8y9kij8pGJg6VzvGy7CCSZau4HmfqfIQxWmTIlvS4EEFAXo0oobmRmHOhly Wq8moEH0xUwH6ubTYZgSWZw64upbZQSSWElPCu0O2UOrgp2Fr30VuRyXeiIQPrxQ/Sar hpfklhRfHSgd2oCS96de5JL0aOThHgInp9dmEQkQVZEH6MzPafjMoj0s/Uj43kB1dJ8x aadQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=YypF0AsCEGINYErsUqxl6taiwphy9R62gNPfwBm3g2s=; b=FlYBA1IFqXMBiBxWxfmFUx9S30571KYSPDZ2Pk8qifdizOa/Hgwyek4YxKGSyG+8ZQ 8EUX9vlWP5ADo0q8QzPvp1rDx0sUPHlLwcqNhr0uUsDdHKV3QwNo9dKDDOGGONPV02lz pa5gDRpPTThnwFzz89tT6Oo2jteSOIWuBtSB29kgzmOjKgs6IDTWZggH7IhtpAzk+TO9 ROjxhrkod/HZLTQcGIWjgsicbOxMqG8TjwWymGYFgxFQlG27Urhc4HyXInkwxw2K+QPJ SpxxXSwGUnM/qxqzpnaiGjX6x0iUBNU9Rs0K3tXvSzqdL6mMTgzuzWiKb7a+N7IBiUzF z0lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 l11-v6si645433pln.323.2018.02.19.02.14.48; Mon, 19 Feb 2018 02:14:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752474AbeBSKOr (ORCPT + 10 others); Mon, 19 Feb 2018 05:14:47 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:51893 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580AbeBSKOq (ORCPT ); Mon, 19 Feb 2018 05:14:46 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0MK8g5-1ep5uO2TZd-001RQh; Mon, 19 Feb 2018 11:14:25 +0100 From: Arnd Bergmann To: stable@vger.kernel.org Cc: Greg KH , linux-kernel@vger.kernel.org, Arnd Bergmann , Catalin Marinas , Will Deacon , Maxime Ripard , linux-arm-kernel@lists.infradead.org Subject: [4.9-stable 3/9] arm64: sunxi: always enable reset controller Date: Mon, 19 Feb 2018 11:13:22 +0100 Message-Id: <20180219101343.2922561-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180219101343.2922561-1-arnd@arndb.de> References: <20180219101343.2922561-1-arnd@arndb.de> X-Provags-ID: V03:K0:tMCeZj4ZxRzuXKk+bs225PbrCm1K75mbKhfmWB6ArkiQeGAn+S9 CJXPaDoBa7BcmNUrUy+eC9EHtDa/8tpoMoAgiJjPU/L3WUlLJwuUV+Yt9pbvrml3cnAKYwJ MMw/Fd4b4jZpeu+cNLtIWVlU+NlHzPpEr0qBsExUIj3lXa2RbEfqpbKdyi5+n/6Vxkd4/ns O5yvh609TJLk2PPd0O98w== X-UI-Out-Filterresults: notjunk:1; V01:K0:2Tny1puwKZI=:Efxnl/p8rvwDrebzszd8/u Xh/n+Sia56i4+Gr2kzOr8bgMoFOwwsvZdEIChnaXR8gL/2KM9wHdGQTXGDUXlFvlBZWiFJk1c UuNGxyE7J4sdXGu3X6vTrc1u4bwPzVaUr6lIZpaBHXxEas5OqKYKPrBNmOiO7PunYu4qrC1EF KhB3zPbf1RHR9+3r3EpCu1PWtBx1YQlkCN2Kt9QxJ8neN0pes4S1+b7FXlO0+GMmq9gYzza6W 5J5ddzufaRvTzeHFV0D8BJX+HWCXjWlIYOAuaKl3RN9m2qr/URWZPviB34UEPalcNIMyYvOdW L8UlBaw5gthWp5SPrfIYuXT0dnCcOocGBckc2kPCzvJxFH09Xv+SOXtVEtyPWaGkXY/V9n9U3 ZafvkcYlNd4TYc7YVnX6YCXX3KAUIq3TMKO6uJl0FN9cIavqbufWjB8aukE4RpMLP9L8xxdMc UUZFRIZMF14yOTtCUwGE7m5766Y66qXDEeiviU9Tni9H/0Kif56bIzvYBzeoq3T7JqYlYCYYp Yh3oeMswB97NwluwGv84oe+yE/NTSszZt28Lajc9TX07F/oYMWw+g6Y+ChLrjxkUYbiBfvdAd aK77x7BO37nGaXlO3r8jXnpDn0nonSbfsRFoqbGrzRUt/4PRUIwdI7NXV8Z3ETJY6Hb9yBoT/ /NqnKAz/7rS/Qr2AeGpKk+cJfdWODW486z5zRygQg7tpC5IYAoR6H1daz03EceGvbKyFf5KNX ogzlth8vonxfx1KHAcrY2gorvc1JCcuY4ofd1g== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit 900a9020af7a023f9b64c919fddf8a7486108962 upstream. The sunxi clk driver causes a link error when the reset controller subsystem is disabled: drivers/clk/built-in.o: In function `sun4i_ve_clk_setup': :(.init.text+0xd040): undefined reference to `reset_controller_register' drivers/clk/built-in.o: In function `sun4i_a10_display_init': :(.init.text+0xe5e0): undefined reference to `reset_controller_register' drivers/clk/built-in.o: In function `sunxi_usb_clk_setup': :(.init.text+0x10074): undefined reference to `reset_controller_register' We already force it to be enabled on arm32 and some other arm64 platforms, but not on arm64/sunxi. This adds the respective Kconfig statements to also select it here. Signed-off-by: Arnd Bergmann Acked-by: Maxime Ripard [arnd: manually rebased to 4.9] Signed-off-by: Arnd Bergmann --- arch/arm64/Kconfig.platforms | 2 ++ 1 file changed, 2 insertions(+) -- 2.9.0 diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 101794f5ce10..08a4497f70a6 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -2,9 +2,11 @@ menu "Platform selection" config ARCH_SUNXI bool "Allwinner sunxi 64-bit SoC Family" + select ARCH_HAS_RESET_CONTROLLER select GENERIC_IRQ_CHIP select PINCTRL select PINCTRL_SUN50I_A64 + select RESET_CONTROLLER help This enables support for Allwinner sunxi based SoCs like the A64.