From patchwork Thu Jun 22 17:13:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 106227 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp232552qgd; Thu, 22 Jun 2017 10:16:04 -0700 (PDT) X-Received: by 10.84.232.134 with SMTP id i6mr4107789plk.248.1498151763945; Thu, 22 Jun 2017 10:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498151763; cv=none; d=google.com; s=arc-20160816; b=lrBXbaX7sKNp8i3kXVprygAw/sYD5Ie7x/eF2AVlS6rjwTlDXqCpSrZYUFSSE5AfR7 ZmZ8FvVQJEDTqFwwR29hZJ2CwWU/fUPHbYMU558r+tpG9ijS8V6b3xm98LTRa/rnQ9yq OcQbWq4mskrejhr5wyyL4MRqTtC1wzVCsf2mDRVUeDkvEcfgyq4oDIDEvSge+nqAIq5x fCRKamTy5IrC/1VW1PSvqpVvhJuvQdhTndlRExK7EI0MQczLc26Mss/gYZcjBvN6ZLnk NXVKrlUdNco5SlGDxJNEyUObGwf5XLZLQC0ipeXtyU4a9CT9vSr8a5qjwSwNiA7iUyxA eX/g== 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=10B0P9CK356snv41bf1z4MNmIwoWz/pAi1ycHzvQ3v8=; b=NmTbORZ7Wq7VCxE0Nqk+lWFnyaB1tJbDcOmE5SrrhhMETbso5W3WPyWDXfw2eboR+z x8+2qwoNhZ/0y6PSs4UMaf9MPiTmN0/fB0mOBCPHub/r2rIWEqT+rTL+jIcbPOP07sVa jM8bFOkzpJUYrPnaG4Ow4P7DMrt5w/ksRB4VsBdIiVy8LHb9zzQIxgAZ91+lTwICw2Fy yX3hX9IE01/q3PmMWv7nz+xhE00tjlm4bu8OufsY/LKdYscytmiHeLR8aHiiL+XvrIur 9KcR/Xdl+H4WFhtf1A+1OExYx3lzLM3Q+rNhHJqUuOfLjvOQHamwAcaYOMgYl/nOtTbc d9eQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 h3si1649178plk.237.2017.06.22.10.16.03; Thu, 22 Jun 2017 10:16:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809AbdFVRP4 (ORCPT + 6 others); Thu, 22 Jun 2017 13:15:56 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:58841 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753601AbdFVRPl (ORCPT ); Thu, 22 Jun 2017 13:15:41 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LaJMk-1e4G82403K-00m4Tl; Thu, 22 Jun 2017 19:14:05 +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 02/11] netlink: mark nla_put_{u8, u16, u32} noinline_if_stackbloat Date: Thu, 22 Jun 2017 19:13:46 +0200 Message-Id: <20170622171355.267192-3-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:qo6uJdU0EbqTZJBV7y/RKQ/EcBQsDhlexNQjUmi27MH7c6XVHS8 2MlOYeGEcNDitTxgOyjRjuS6AFvf0ewjETK/ObQuJFEjgGd6yWprXcVuT3tHK5KNhfWtv/G 0T71RDsR8uPJBWHVRjH+P3Q74W8f9/i9VbgCTdOoG+vrPSSNOWvDyyZtbVaoxn1c0qLuQCK 8HWg6DR/Su/QQ20H1zi9A== X-UI-Out-Filterresults: notjunk:1; V01:K0:g99Qty/9J7E=:p7pKGOFkwPLEwUADMkv52X Inln4cHk/WH0xbgGbVdz20rKYwxroFPF9sVEBxF0xBcx896ouy/XzX88WYWNbT7T5O3ZhWnzU nyPEsPEZYVKOC6d+asNVFzFEqzsoHyyjXwoiJ0SX1Fz4APbhYQTIwnMF7nW/RJBTosm5Xjdj8 cQPS/zPzK7nDTTZsK/wl6ouAiK0/eIzLC5vnJWzfNk0M4MmxfIw+ndbteCI4FSInM/Emp1SMB WM+TsSqwXoW9tuSvrEYdD7b43OAnlQt/YkrtZNkwfmaY9vqEXB3yFNQYBPJ3PQ6zYJlV+fj2w 6cvvxqsMgOu4426DStDO+QDpIJ1ALM79WKl436MjufmZeMZnZ72gIdh7A/twyB6VBZzm7ELQv 8a9GVYRliBWWa6ER3YOT2rfWfeov3jnE7zujC3uN7TTny2TAzV+fUZzot5OpbQpMg/KXhiNo6 s4S+CCEfeeuoS2MgtkACHBNj/yYidIDvfifUIbwF+XKxQddOpOzQ28L/ka+k/+sIA0ExgJHC9 iy2lvbBrHyAHULXnk7FcsFWTs+LJwZ/OuUwFtAkC90cLaOuwvKz/p5YInmQmZvkccMvsTPOfu JvGfBC26OJPHdo0ZvRErEn7TQJoUEFAumFnH1G3SFmtHiI3/FQzBFjwo9bdlEcZQNueBlZb2E YViIBW2wjKviBEU62UzGicXfnZuvpHg4EArkpjrgXzrL1q3bJ0x7hSo2uA3xyL1Lbpjg= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When CONFIG_KASAN is enabled, the "--param asan-stack=1" causes rather large stack frames in some functions. This goes unnoticed normally because CONFIG_FRAME_WARN is disabled with CONFIG_KASAN by default as of commit 3f181b4d8652 ("lib/Kconfig.debug: disable -Wframe-larger-than warnings with KASAN=y"). The kernelci.org build bot however has the warning enabled and that led me to investigate it a little further, as every build produces these warnings: net/wireless/nl80211.c:4389:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-Wframe-larger-than=] net/wireless/nl80211.c:1895:1: warning: the frame size of 3776 bytes is larger than 2048 bytes [-Wframe-larger-than=] net/wireless/nl80211.c:1410:1: warning: the frame size of 2208 bytes is larger than 2048 bytes [-Wframe-larger-than=] net/bridge/br_netlink.c:1282:1: warning: the frame size of 2544 bytes is larger than 2048 bytes [-Wframe-larger-than=] With the new noinline_if_stackbloat annotation, we can avoid the problem when KASAN is enabled but not change anything otherwise. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: kasan-dev@googlegroups.com Signed-off-by: Arnd Bergmann --- include/net/netlink.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) -- 2.9.0 diff --git a/include/net/netlink.h b/include/net/netlink.h index 01709172b3d3..24b4badd6eaf 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -766,7 +766,7 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_u8(struct sk_buff *skb, int attrtype, u8 value) +static noinline_if_stackbloat int nla_put_u8(struct sk_buff *skb, int attrtype, u8 value) { return nla_put(skb, attrtype, sizeof(u8), &value); } @@ -777,7 +777,7 @@ static inline int nla_put_u8(struct sk_buff *skb, int attrtype, u8 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value) +static noinline_if_stackbloat int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value) { return nla_put(skb, attrtype, sizeof(u16), &value); } @@ -788,7 +788,7 @@ static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value) +static noinline_if_stackbloat int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value) { return nla_put(skb, attrtype, sizeof(__be16), &value); } @@ -799,7 +799,7 @@ static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value) +static noinline_if_stackbloat int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value) { return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value); } @@ -810,7 +810,7 @@ static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value) +static noinline_if_stackbloat int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value) { return nla_put(skb, attrtype, sizeof(__le16), &value); } @@ -821,7 +821,7 @@ static inline int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value) +static noinline_if_stackbloat int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value) { return nla_put(skb, attrtype, sizeof(u32), &value); } @@ -832,7 +832,7 @@ static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value) +static noinline_if_stackbloat int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value) { return nla_put(skb, attrtype, sizeof(__be32), &value); } @@ -843,7 +843,7 @@ static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value) +static noinline_if_stackbloat int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value) { return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value); } @@ -854,7 +854,7 @@ static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value) +static noinline_if_stackbloat int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value) { return nla_put(skb, attrtype, sizeof(__le32), &value); } @@ -866,7 +866,7 @@ static inline int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value) * @value: numeric value * @padattr: attribute type for the padding */ -static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype, +static noinline_if_stackbloat int nla_put_u64_64bit(struct sk_buff *skb, int attrtype, u64 value, int padattr) { return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr); @@ -879,7 +879,7 @@ static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype, * @value: numeric value * @padattr: attribute type for the padding */ -static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value, +static noinline_if_stackbloat int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value, int padattr) { return nla_put_64bit(skb, attrtype, sizeof(__be64), &value, padattr); @@ -892,7 +892,7 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value, * @value: numeric value * @padattr: attribute type for the padding */ -static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value, +static noinline_if_stackbloat int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value, int padattr) { return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value, @@ -906,7 +906,7 @@ static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value, * @value: numeric value * @padattr: attribute type for the padding */ -static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value, +static noinline_if_stackbloat int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value, int padattr) { return nla_put_64bit(skb, attrtype, sizeof(__le64), &value, padattr); @@ -918,7 +918,7 @@ static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value, * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value) +static noinline_if_stackbloat int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value) { return nla_put(skb, attrtype, sizeof(s8), &value); } @@ -929,7 +929,7 @@ static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value) +static noinline_if_stackbloat int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value) { return nla_put(skb, attrtype, sizeof(s16), &value); } @@ -940,7 +940,7 @@ static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value) * @attrtype: attribute type * @value: numeric value */ -static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value) +static noinline_if_stackbloat int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value) { return nla_put(skb, attrtype, sizeof(s32), &value); } @@ -952,7 +952,7 @@ static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value) * @value: numeric value * @padattr: attribute type for the padding */ -static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value, +static noinline_if_stackbloat int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value, int padattr) { return nla_put_64bit(skb, attrtype, sizeof(s64), &value, padattr); @@ -987,7 +987,7 @@ static inline int nla_put_flag(struct sk_buff *skb, int attrtype) * @njiffies: number of jiffies to convert to msecs * @padattr: attribute type for the padding */ -static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, +static noinline_if_stackbloat int nla_put_msecs(struct sk_buff *skb, int attrtype, unsigned long njiffies, int padattr) { u64 tmp = jiffies_to_msecs(njiffies);