From patchwork Wed Jul 3 20:54:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11030309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2653814C0 for ; Wed, 3 Jul 2019 20:55:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11387286A8 for ; Wed, 3 Jul 2019 20:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0180828682; Wed, 3 Jul 2019 20:55:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B41628682 for ; Wed, 3 Jul 2019 20:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=RIJ3NX/42UjGuGPjo272P+iS+KZHOttE+O/nK4l9HoM=; b=eruWy3K03baCeO s7E7l6o1PNeIeC7Rpr1NXYTobOHB8JIsFP4toy+DCoG5vMRTLw3ze1+4MGiToZk2h1OFovsiTE8aP 2D3dM0Ln1uD9GHT+Tw51UBipYEhx4MtxKtQI0X85GGqeKSOJoLSwPFJ025Mz/GI+B/7OvGcXXVPzy G3XcTGkF3DnQK4mvawVGIvgLmnZYwnbyal/09KOYdk9U5ovXGnlLtoNS0Kcxqr5/uxiEPPRaSpppE BZzeaiTMU64CaFEj+6co81LK3CyoZ7Ym1lgQj5jxDXUgUHyLzGTfQGXlTAQIHm6lUWxmRnaCZtgSe FUwJT6JuZXpcbnDuz/qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1himIH-0005OI-TW; Wed, 03 Jul 2019 20:55:57 +0000 Received: from mout.kundenserver.de ([212.227.126.134]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1himIE-0005Nl-2c for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2019 20:55:55 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1M27Bp-1hgJRq2Gin-002TZ9; Wed, 03 Jul 2019 22:55:31 +0200 From: Arnd Bergmann To: Florian Fainelli Subject: [PATCH 1/3] ARM: fix kasan link failures Date: Wed, 3 Jul 2019 22:54:36 +0200 Message-Id: <20190703205527.955320-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:N0nhNH56c4bAPUvE+lb81hmqvGKzvYovB1gWPnLR0wVZb6l2Cus VlcxdC8pK77LU32vdSY3Hh7JVCF2Dn86C7mE5dWcn3mW4hOXnlPLCso1Cp9anA4gdrDrzo5 Ut7QKtxvDcquKr7d9Bv/USwELBGTW65u6iuQdfFdQsgx+VYAxaDSI2S8DskzTjruoWUa2ES iWji7SQpVNS6kv9tSkXzg== X-UI-Out-Filterresults: notjunk:1;V03:K0:kkc3pKM7JBI=:7SfM19cEIrMeD+akm/v6F2 a7GlFineaNLRR0bDHAg64d4H8VDDp7Z9+1z0wPu6ycgl2veXYMIYLK3ymKqKG4KsWypouYG9r mtCXBQ4VLnNmtTGxxFuxJdpI3h2zw4v1U8tAUn4YrVtxSPTXfdIvp75IvfpBXX/UvFQyZ1dp3 U/VKYT/72+IpBEt1wioAoWf3LlbQGf9SBTdADJK+a4xjGSe3fKWyWBteSoLXu6ryzobEgrfT/ H00WLhhVLscWXXo5mo/pjrrFTjO/7XZo+uTlJcuSiqSfdPcxYtMHz12+C9S/Z+2HGLOq5uVEg DQhJ/O0i8wws7dtN346JYXJBuU/miXvgasyL26bSAp6kAWdEvGPuQv4kdmfMsj2Rw9lg5Y0t7 R3R01XUVVi1aq89YlWjRoLzbt5hAlFIAd9ilTc+/+QVxtDzzPpenqcaqMjFQubTYDYkRT5SOm 2tnPirJJacaRkDbQ5bTGJ3Ul32o6ej09+cOCaH0aWrQYPlKKbkU5SGLBNU7s4LARIsVt2Hw4s Ii7qWkUVDiwx+d52CbaSbjqmAtNjS+r0w7ri4LGuUhZvHPf08gKYO/WCR80f/kRyUbqfwxENo IhhjA/hQkMP7YWhi+VCHHS49JyodFnSForBRio4snDdEmhFwCJpwTHCqNH15yPzgwWJt5lz3z AZS6ncqMjqWtz5QOMSnp3u12Dp15VIpniGDr/zVGGmfL/6EJFRba+9xAe2ivD9P0FL/W7RCuG awSwZR/Uu8glWMOfQlXU3FQt8a2h94oDitdTGg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190703_135554_414237_9266DFBF X-CRM114-Status: GOOD ( 14.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-efi@vger.kernel.org, Arnd Bergmann , Ard Biesheuvel , Abbott Liu , Linus Walleij , Nicolas Pitre , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Masahiro Yamada , Stefan Agner , Andrey Ryabinin , Nathan Chancellor , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Getting the redirects for memcpy/memmove/memset functions right in the decompressor and the efi stub is a bit tricky. Originally these were meant to prevent the kasan code from calling itself recursively. The decompressor is built without kasan but uses the same redirects when CONFIG_KASAN is enabled, except in a few cases that now cause link failures: arch/arm/boot/compressed/fdt_rw.o: In function `fdt_set_name': fdt_rw.c:(.text+0x3d4): undefined reference to `memcpy' arch/arm/boot/compressed/fdt_rw.o: In function `fdt_add_property_': fdt_rw.c:(.text+0x121c): undefined reference to `memmove' arch/arm/boot/compressed/fdt_rw.o: In function `fdt_splice_': fdt_rw.c:(.text+0x1460): undefined reference to `memmove' arch/arm/boot/compressed/fdt_ro.o: In function `fdt_get_path': fdt_ro.c:(.text+0x1384): undefined reference to `memcpy' arch/arm/boot/compressed/fdt_wip.o: In function `fdt_setprop_inplace_namelen_partial': fdt_wip.c:(.text+0x48): undefined reference to `memcpy' arch/arm/boot/compressed/fdt_wip.o: In function `fdt_setprop_inplace': fdt_wip.c:(.text+0x100): undefined reference to `memcpy' arch/arm/boot/compressed/fdt.o: In function `fdt_move': fdt.c:(.text+0xa04): undefined reference to `memmove' arch/arm/boot/compressed/atags_to_fdt.o: In function `atags_to_fdt': atags_to_fdt.c:(.text+0x404): undefined reference to `memcpy' atags_to_fdt.c:(.text+0x450): undefined reference to `memcpy' I tried to make everything use them, but ran into other problems: drivers/firmware/efi/libstub/lib-fdt_sw.stub.o: In function `fdt_create_with_flags': fdt_sw.c:(.text+0x34): undefined reference to `__memset' arch/arm/boot/compressed/decompress.o: In function `lzo1x_decompress_safe': decompress.c:(.text+0x290): undefined reference to `__memset' This makes all the early boot code not use the redirects, which works because we don't sanitize that code. Setting -D__SANITIZE_ADDRESS__ is a bit confusing here, but it does the trick. Signed-off-by: Arnd Bergmann --- arch/arm/boot/compressed/Makefile | 1 + arch/arm/boot/compressed/decompress.c | 2 -- arch/arm/boot/compressed/libfdt_env.h | 2 -- drivers/firmware/efi/libstub/Makefile | 3 ++- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index dcc27fb24fbb..d91c2ded0e3d 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -25,6 +25,7 @@ endif GCOV_PROFILE := n KASAN_SANITIZE := n +CFLAGS_KERNEL += -D__SANITIZE_ADDRESS__ # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. KCOV_INSTRUMENT := n diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c index 3794fae5f818..aa075d8372ea 100644 --- a/arch/arm/boot/compressed/decompress.c +++ b/arch/arm/boot/compressed/decompress.c @@ -47,10 +47,8 @@ extern char * strchrnul(const char *, int); #endif #ifdef CONFIG_KERNEL_XZ -#ifndef CONFIG_KASAN #define memmove memmove #define memcpy memcpy -#endif #include "../../../../lib/decompress_unxz.c" #endif diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h index 8091efc21407..b36c0289a308 100644 --- a/arch/arm/boot/compressed/libfdt_env.h +++ b/arch/arm/boot/compressed/libfdt_env.h @@ -19,6 +19,4 @@ typedef __be64 fdt64_t; #define fdt64_to_cpu(x) be64_to_cpu(x) #define cpu_to_fdt64(x) cpu_to_be64(x) -#undef memset - #endif diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 0460c7581220..fd1d72ea04dd 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -20,7 +20,8 @@ cflags-$(CONFIG_ARM64) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ -fpie $(DISABLE_STACKLEAK_PLUGIN) cflags-$(CONFIG_ARM) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ -fno-builtin -fpic \ - $(call cc-option,-mno-single-pic-base) + $(call cc-option,-mno-single-pic-base) \ + -D__SANITIZE_ADDRESS__ cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt From patchwork Wed Jul 3 20:54:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11030311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F72B1398 for ; Wed, 3 Jul 2019 20:56:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CEAC28A1A for ; Wed, 3 Jul 2019 20:56:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F99728A20; Wed, 3 Jul 2019 20:56:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 22F7228A1A for ; Wed, 3 Jul 2019 20:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hHb2tvASRpdHLEnDJ0Fw/qaWEGClLxa+++0oUIar2LI=; b=eS7Rnom72WeNnT HK27XEJkfJcKURw5Y0e6tVyO0FP3VB9v+fHbdNJvejNWv1ddlx211llBov4jxsAtoY+HWxngq1DPl by3ath286z+XXzjOhOJS2Ju4Y4hkiwrJPtjiC2SjaqENrg8+icpN2ETdp4ZZ4dpJgCDWjccvKt7F9 hQOrmURKak9YvEvrJwr0OhOW55wSpqKFGEQnyK3cj2zLN4c2KGStgwcT6Z0hrtEn+VFV7mQCjOelK bLw8BDg1Uz/+O1JTyWtOjr84QaVomoh2m20PdVy7FJzayRikgiOdWz4sdZV6jRcmzqw5LS/Xyuv4G KjVtjOgqHHidQ3dauNFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1himIj-0005eM-OW; Wed, 03 Jul 2019 20:56:25 +0000 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1himIg-0005dc-6i for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2019 20:56:23 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MqbDs-1iMWxP2do8-00masw; Wed, 03 Jul 2019 22:56:03 +0200 From: Arnd Bergmann To: Florian Fainelli , Andrey Ryabinin Subject: [PATCH 2/3] kasan: disable CONFIG_KASAN_STACK with clang on arm32 Date: Wed, 3 Jul 2019 22:54:37 +0200 Message-Id: <20190703205527.955320-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190703205527.955320-1-arnd@arndb.de> References: <20190703205527.955320-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dVu6TB6bK7PiXC0nWCBWTtH4+VmEpXav81wxunH7qxb9O8LK6xY 9t1OBqgcoNKISokDJOGEmpsK9Olw4WiYxv3R4Yk0VHCPHCwbE5CfGGDvCGKORzYaTcZzpMZ m0fJ4OWUu8fhsgmIFep0j6SXmG5L3NTwAgbpxGDx8Qj04BISYNu2I01zggQ4J9AyAUBAt5n camESeoPyJjNiAUdUlgtA== X-UI-Out-Filterresults: notjunk:1;V03:K0:BtQ+/a+4hxk=:BXsO/jIoni0w1uZ5xMb/V6 h3BmSvC14FIsrbv1u2lvwtgR132tDDF864k1Mm0/o1613vabZUA4IFS/P8E4jRRI6wzptV5lM jniEHTkB7qHeV/3lCntpeY7GYB4gr9Vvv+AKKRatXz3x21fZBGm2/fGSYXAXY+ZYcmSlQRb0Z 3uc+P/LLZG12LdSV4N+0Jdl/ijlnTXia0VndfpbgkK0UMbzs9GaMSjIuFE72esecJiyh9QXlC jNr2Bequ/b5BgqDk6YfU+QnZsfElwGyaURabVnt6B5C4Ohxqk07JXMFYf1RDOphcRy1RG3a7g cX1kSgnBkWa6c7lXaA5Hp4HJ+c0RNNy3WS5G15hdnR29brBeN7LGOMTBv+bUvZj2fKB9A8rcd xDU4aHuOfToN3Mi0jKRBJbkqfK4pL2GQiLvrctVa9OboD57iyUbUJJQxSc64DPWyyv/TwAWg+ 4rlCQYskxhnYiA1upHe0T38dZpE4V+pDZ9UUdpPEEC+JaKy0Z7hPP3gDh8UQUk7wDeMlx43Ma Nj2f2RvuW0zBufN7CCC1gzXZZ7yj6LKcva/a4KeZ+T9LAHp/QTc4vBkJmaBeQePNHF7pDF9ty lgByqBiJ5vNeyY0IYOTYOX5SjHBdj73WL+AOjE6+yMAAfu05z4cLAPM2ewhkYRfsv/UNbfGFL 1jdoMMETbefmQEsOxl2/ok8E/gLyIPPUwGrnjqGFE8jZCT2/J0FOdGzP9k7kfPWx7NIPnmgMn vIN90lJ0ZDhmHtW8bJnYoKFXqd3tUJdj5FcRRA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190703_135622_535551_26AF4BA8 X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Marek , clang-built-linux@googlegroups.com, Arnd Bergmann , linux-kbuild@vger.kernel.org, Abbott Liu , Linus Walleij , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Masahiro Yamada , Alexander Potapenko , Dmitry Vyukov , Andrey Konovalov , Andrew Morton , Will Deacon , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The CONFIG_KASAN_STACK symbol tells us whether we should be using the asan-stack=1 parameter. On clang-8, this causes explosive kernel stack frame growth, so it is currently disabled, hopefully to be turned back on when a future clang version is fixed. Examples include drivers/media/dvb-frontends/mb86a20s.c:1942:12: error: stack frame size of 4128 bytes in function drivers/net/wireless/atmel/atmel.c:1307:5: error: stack frame size of 4928 bytes in function 'atmel_open' drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c:1521:1: error: stack frame size of 5440 bytes in function drivers/media/i2c/mt9t112.c:670:12: error: stack frame size of 9344 bytes in function 'mt9t112_init_camera' drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c:185:12: error: stack frame size of 10048 bytes For the 32-bit ARM build, the logic I introduced earlier does not work because $(CFLAGS_KASAN_SHADOW) is empty, and we don't add those flags. Moving the asan-stack= parameter down fixes this. No idea of any of the other parameters should also be moved though. Signed-off-by: Arnd Bergmann --- scripts/Makefile.kasan | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan index 6410bd22fe38..fc57fcf49722 100644 --- a/scripts/Makefile.kasan +++ b/scripts/Makefile.kasan @@ -26,10 +26,11 @@ else CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ $(call cc-param,asan-globals=1) \ $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ - $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \ $(call cc-param,asan-instrument-allocas=1) endif +CFLAGS_KASAN += $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) + endif # CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_SW_TAGS From patchwork Wed Jul 3 20:54:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11030315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65EF11398 for ; Wed, 3 Jul 2019 20:56:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5384B28A20 for ; Wed, 3 Jul 2019 20:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46E8328A22; Wed, 3 Jul 2019 20:56:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E330428A20 for ; Wed, 3 Jul 2019 20:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uVcQtQLtxs/4YXNu4ZrsOFdP3hQzqfh8SAW7Q0kLz+Y=; b=Pdvsp0vruiUN2V n6Bn9o62kEDZiy9EEi98lS3ipYiQUTJsEkNSduzoBu4edAKQjV7sqzRDeK3HuVqRF12HWH1F7MDny X/irDnlovsBrQd4gY9Bd/o1oScREs0J7Ye8UGNfTzjn47bx9NiAEHqiuz+vymq/+ToLZM61g7cmnB oncest0datz+RvbuehN6JRfz1otwsoRKUAgTaE6PGVd/KzOQYjTJOX+/WBTvlC6pI8aSfydMagarV ATopba1ASQ4jMa1+I3TJH3TH1P+aLuOuJqJ76mYmCNb5mN6TKt9HpiEG56DqLNVIQ/m+elVwEvHKE 7gag8W/iHi4je7Sc5CHg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1himJC-0005vH-FH; Wed, 03 Jul 2019 20:56:54 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1himJ8-0005uW-D0 for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2019 20:56:52 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MCbZL-1hrszW1Wi3-009fcz; Wed, 03 Jul 2019 22:56:37 +0200 From: Arnd Bergmann To: Florian Fainelli Subject: [PATCH 3/3] kasan: increase 32-bit stack frame warning limit Date: Wed, 3 Jul 2019 22:54:38 +0200 Message-Id: <20190703205527.955320-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190703205527.955320-1-arnd@arndb.de> References: <20190703205527.955320-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:8pSJiH+6Agod8nzM29uheH50kgOrBaKHZzl6ndhrvPiQDTdiHui W5pteQ/meterbUyb16uPXBdh/bTTq2+X7Dk5d7PAcip6R5BCBPu9tNJQGkCbISINyzxc4E3 ufLi+uJnI/JUTqJcROzbiTnzXM5lLSFjTSMLV+q7duZFqGKVqJd+NvheDVswutkffm0UA2T TfDWqX7IhnITKKyiWsxrA== X-UI-Out-Filterresults: notjunk:1;V03:K0:3Ix8Jf1u9lw=:pjqfTjTFLOmjIDonH9fhGO mHR6MCXiiA+Fcqph4cAytscXm6iAv/rKcr/9/TiHbHVVsjckLsemrX4ckG9DSoruNNgcyJZU6 iOh8oppdJ0CmQLWMXd9XwgOkCOhnP9vSEcCbJv0xxPSh5jCSx9DuUzhZyzfxwQUQSPTD8ZZ2i t8FXl40rX/HMeA4I13WzDKH/5A2FNnIENm7M9rUTO700Bd7uTcBKAa7mlM+VdnwpaYWJ2RRtA WfqrTrQsGfObU4oOpKitmyB50dNiiNQMY56Dn6Dsh76mVyRlLUnc6QHQ4N0elrylTNwYj/ihI 61Ox5FaGZmJDnXmnGoFY2sD2hny0rzusVuk5DpRThYWLJ5aatwd+B3ce7oeeO9NJRExGDIni4 BHuWsm+m/eCraU0WPVTSM87vm1asD/ayohcM1+LdMTcoMzb9LlWx0ALq9MJu/CKgV9De8/3b9 d3/VN94DYA9jeePRDe7XPFDTNj2Tn+7KpCruJu15FS9qth6rpir7mcXY3UcNbIiiAW0gMe7w+ /OOpsa7lPMhg8f39gUMxhnjD6EufdR5k/B56MNvwwXPkkoRSgsJHf6gc9m7CmmxVLAsNOqOJm hN2h21mCFCGBXsyB5O/KCiZHxoEKeC65vGSjC034oyin5/vtkSzw+IjuYpdEELk2rIyJOnRgX zFxLbriBO8AJIvgkUiCOqFp7zMO5cjWvACRnImwP8b5VHSmDtbyQA6vmdcyt/fVyBlbr/1b48 GyzK0D05aGULm/4LZ3MsFTAW2SkdaJZmX220Qg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190703_135650_729230_F991F1F6 X-CRM114-Status: GOOD ( 14.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , Arnd Bergmann , Abbott Liu , Linus Walleij , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Masahiro Yamada , Andrey Ryabinin , Andrew Morton , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Enabling kasan on 32-bit ARM introduces some new warnings in the allmodconfig build due to mildly increased kernel stack usage, even when asan-stack is disabled: fs/select.c:621:5: error: stack frame size of 1032 bytes in function 'core_sys_select' net/mac80211/mlme.c:4047:6: error: stack frame size of 1032 bytes in function 'ieee80211_sta_rx_queued_mgmt' drivers/infiniband/sw/rxe/rxe_req.c:583:5: error: stack frame size of 1152 bytes in function 'rxe_requester' fs/ubifs/replay.c:1193:5: error: stack frame size of 1152 bytes in function 'ubifs_replay_journal' drivers/mtd/chips/cfi_cmdset_0001.c:1868:12: error: stack frame size of 1104 bytes in function 'cfi_intelext_writev' drivers/ntb/hw/idt/ntb_hw_idt.c:1041:27: error: stack frame size of 1032 bytes in function 'idt_scan_mws' drivers/mtd/nftlcore.c:674:12: error: stack frame size of 1120 bytes in function 'nftl_writeblock' drivers/net/wireless/cisco/airo.c:3793:12: error: stack frame size of 1040 bytes in function 'setup_card' drivers/staging/fbtft/fbtft-core.c:989:5: error: stack frame size of 1232 bytes in function 'fbtft_init_display' drivers/staging/fbtft/fbtft-core.c:907:12: error: stack frame size of 1072 bytes in function 'fbtft_init_display_dt' drivers/staging/wlan-ng/cfg80211.c:272:12: error: stack frame size of 1040 bytes in function 'prism2_scan' Some of these are intentionally high, others are from sloppy coding practice and should perhaps be reduced a lot. For 64-bit, the limit is currently much higher at 2048 bytes, which does not cause many warnings and could even be reduced. Changing the limit to 1280 bytes with KASAN also takes care of all cases I see. If we go beyond that with KASAN, or over the normal 1024 byte limit without it, that is however something we should definitely address in the code. Signed-off-by: Arnd Bergmann --- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6d2799190fba..41b0ae9d05d9 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -251,7 +251,7 @@ config FRAME_WARN int "Warn for stack frames larger than (needs gcc 4.4)" range 0 8192 default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1280 if (!64BIT && PARISC) + default 1280 if (!64BIT && (PARISC || KASAN)) default 1024 if (!64BIT && !PARISC) default 2048 if 64BIT help