From patchwork Thu Jun 22 17:13:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 106228 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp232799qgd; Thu, 22 Jun 2017 10:16:35 -0700 (PDT) X-Received: by 10.84.245.2 with SMTP id i2mr4149435pll.284.1498151795268; Thu, 22 Jun 2017 10:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498151795; cv=none; d=google.com; s=arc-20160816; b=uib7gKPUBNm4kesBgjklhZ6vHTrxhPDexDp3esZ/CdSWZ8PkCNyQoj4J6uQTo6JIsY c2qEl83KxdEHKyDLQK7VkPz/OahltX7Pp0arbUEFZ+N6TQxUVXaY67gAfS+CAX3XBDxZ ThdMdXlvODIBVXUJNlptvL2j6GxFzexvps9kzdQ6GSCxpPLrMoNk36IhGnfaAnhLCzDY U0DQoMNRMCkP/FGULm9shKT85Vd0eI7pWCssauOz3t3OKa/LteDInUWclpdeLvtaAN65 MVJBkqIq7eh1MoKylYFanlAk1YX6gmL+W9kN7KEg4EZyEa7Sfnkaf9JZ9GudO8mFVkrZ QImQ== 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=LaO6Zq2xNUP2w7ZF09cjqllunx1ce2Wt9axwes0HIBM=; b=Jxphu6UMysGbaRcT4kPAsiCzpP68OnUHFgDZT5Od4AXmAs2SB30g52kZUEzjMtkIrt VojURGKZf+1dokDoz75YLoakJwBN0I4L8TZDi6/oKllPYTIC6HelRF9iEClpTqg7GZL6 ctPONfGg/xtxaGFo1Mz4td8limGxHt4o2f90VY7uAWGVL/lNH/9CZ3Z3KerLoMRHie1H 7ttM5WlzR/z1z57Zc+S+jHC+NqfnlZx6YouLdajPI5do4hyY2wm1e601wam1e7i2kXWb xO9WF7MkBIdYgjSkESKkvrUdcqqCx8U/iW05vfZn1+aHP3FWvzX8i8RQ+aFTMllbM+24 2+uA== 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 e6si1653354plk.0.2017.06.22.10.16.34; Thu, 22 Jun 2017 10:16:35 -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 S1753786AbdFVRQP (ORCPT + 25 others); Thu, 22 Jun 2017 13:16:15 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:63366 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752253AbdFVRPz (ORCPT ); Thu, 22 Jun 2017 13:15:55 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LeS5t-1e8v5f0tSP-00qBDa; Thu, 22 Jun 2017 19:14:06 +0200 From: Arnd Bergmann To: Andrew Morton Cc: kasan-dev@googlegroups.com, Dmitry Vyukov , Alexander Potapenko , Andrey Ryabinin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Arend van Spriel , Arnd Bergmann , Masahiro Yamada , Michal Marek , Kees Cook , Ingo Molnar , "David S . Miller" , linux-kbuild@vger.kernel.org, Samuel Thibault , Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v3 04/11] mtd: cfi: reduce stack size with KASAN Date: Thu, 22 Jun 2017 19:13:48 +0200 Message-Id: <20170622171355.267192-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170622171355.267192-1-arnd@arndb.de> References: <20170622171355.267192-1-arnd@arndb.de> X-Provags-ID: V03:K0:/QGq6j8aH1mLNrf9v7fi/+aq3abPwSQJkYp3qEL1ZKsL5XuM/Ox KXRVDtvaRdxIYuWt2A/gYZOJn2DcG/gH5LDPsNxBIDWl7oBXa7ocT2mBgKYqil4xSpJ2Ef/ E6VPof/sTNRjeMP5RNqaEI6+QrodHSr+K8Myew5Ag4iML31Y/lAdB2c9IgLt+VaZ1igKpvl cmAf42dz93Kn8VqeJHfBw== X-UI-Out-Filterresults: notjunk:1; V01:K0:LlIRQJlIX2w=:jxx4TidXCPFUggyAjxrd7i Hq5HpIkChb5ZEhuV+loLQNlMuI9W41ECC4wLB445DQKNE5XlqQpEiSI01unJMf5gxy9GTCLbM v88uv7wKqvhfR7UyQn4YwMv+5jA6pO6AZxcDzUWHn+SebTS3mQM++Bxbp7TSPUXr7b8ECixXA 7kX7f+HMsjtPzKmSTDn4/jlNrhyNJZ7GWQujsCrDCXQyhabS2yJv/2xS1bRLZMf5mxdgeiPC8 0ElEuiI/sX3+G9GSceGQWY+nlbWCCN3Bx64sai1lzqlAjPUnTBZZuJ1N5MnV3xyXtx1p0IFRA /9ZLAvDNX/fIwkYT9MyU6zXp3momuzdGHmn7vaVtavPdfT86sEtQ+hj5rekHzmDRKvdal84WT fOEeHsZpl2GIq6FDOjyXQp6ZzRporlidexpmXpU7qc0OBQvmdph8kMxGk/OwLyb8A6I9SZpms d84W1yE4ofn9o/uYGpLTV+BLty8jDNg+fjgmO8G2CEM2HgpDbgmgvehzdzB5PBELWCWoH1dRp YXkJ5lZgym3ruegswFZDfIMhv5eFGrwbGbmFZUeH1uISJ9h9ZNZSnNv2cF6WaW2hxB4Qg6B4b X9bdaonhlU9TetRRZzO6BirLtTXX96xlXmAEKk5toEL0sBH/KmnKRL/CsNsOsPufpaYfONHwi AcbBe0tKIr9GKK3OBU0weZZBXX+9v4hP2CW8Vi3uDnAg6NndUUt+EC/U1DrPl679Z61E= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_KASAN is used, we consume a lot of extra stack space: drivers/mtd/chips/cfi_cmdset_0020.c: In function 'do_write_buffer': drivers/mtd/chips/cfi_cmdset_0020.c:603:1: error: the frame size of 2184 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_erase_varsize': drivers/mtd/chips/cfi_cmdset_0020.c:972:1: error: the frame size of 1936 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer': drivers/mtd/chips/cfi_cmdset_0001.c:1841:1: error: the frame size of 1776 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] This marks some functions as noinline_if_stackbloat to keep reduce the overall stack size. Signed-off-by: Arnd Bergmann --- drivers/mtd/chips/cfi_cmdset_0020.c | 8 ++++---- include/linux/mtd/map.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) -- 2.9.0 diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index 7d342965f392..5eee5e883f55 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c @@ -244,7 +244,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map) } -static inline int do_read_onechip(struct map_info *map, struct flchip *chip, loff_t adr, size_t len, u_char *buf) +static noinline_if_stackbloat int do_read_onechip(struct map_info *map, struct flchip *chip, loff_t adr, size_t len, u_char *buf) { map_word status, status_OK; unsigned long timeo; @@ -728,7 +728,7 @@ cfi_staa_writev(struct mtd_info *mtd, const struct kvec *vecs, } -static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +static noinline_if_stackbloat int do_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) { struct cfi_private *cfi = map->fldrv_priv; map_word status, status_OK; @@ -1029,7 +1029,7 @@ static void cfi_staa_sync (struct mtd_info *mtd) } } -static inline int do_lock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +static noinline_if_stackbloat int do_lock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) { struct cfi_private *cfi = map->fldrv_priv; map_word status, status_OK; @@ -1175,7 +1175,7 @@ static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) } return 0; } -static inline int do_unlock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +static noinline_if_stackbloat int do_unlock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) { struct cfi_private *cfi = map->fldrv_priv; map_word status, status_OK; diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index 3aa56e3104bb..29db74314db8 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h @@ -316,7 +316,7 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word return r; } -static inline int map_word_andequal(struct map_info *map, map_word val1, map_word val2, map_word val3) +static noinline_if_stackbloat int map_word_andequal(struct map_info *map, map_word val1, map_word val2, map_word val3) { int i; @@ -328,7 +328,7 @@ static inline int map_word_andequal(struct map_info *map, map_word val1, map_wor return 1; } -static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) +static noinline_if_stackbloat int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) { int i; @@ -362,7 +362,7 @@ static inline map_word map_word_load(struct map_info *map, const void *ptr) return r; } -static inline map_word map_word_load_partial(struct map_info *map, map_word orig, const unsigned char *buf, int start, int len) +static noinline_if_stackbloat map_word map_word_load_partial(struct map_info *map, map_word orig, const unsigned char *buf, int start, int len) { int i; @@ -392,7 +392,7 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig #define MAP_FF_LIMIT 8 #endif -static inline map_word map_word_ff(struct map_info *map) +static noinline_if_stackbloat map_word map_word_ff(struct map_info *map) { map_word r; int i;