summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-imx-4.14.98/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-imx-4.14.98/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch')
-rw-r--r--recipes-kernel/linux/linux-imx-4.14.98/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch139
1 files changed, 0 insertions, 139 deletions
diff --git a/recipes-kernel/linux/linux-imx-4.14.98/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch b/recipes-kernel/linux/linux-imx-4.14.98/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch
deleted file mode 100644
index e30d9425..00000000
--- a/recipes-kernel/linux/linux-imx-4.14.98/0002-include-linux-module.h-copy-init-exit-attrs-to-.patch
+++ /dev/null
@@ -1,139 +0,0 @@
1From mboxrd@z Thu Jan 1 00:00:00 1970
2Return-Path: <SRS0=AQQw=UD=vger.kernel.org=stable-owner@kernel.org>
3X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
4 aws-us-west-2-korg-lkml-1.web.codeaurora.org
5X-Spam-Level:
6X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,
7 DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,
8 SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT
9 autolearn=ham autolearn_force=no version=3.4.0
10Received: from mail.kernel.org (mail.kernel.org [198.145.29.99])
11 by smtp.lore.kernel.org (Postfix) with ESMTP id 63BF0C46470
12 for <stable@archiver.kernel.org>; Tue, 4 Jun 2019 13:25:01 +0000 (UTC)
13Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
14 by mail.kernel.org (Postfix) with ESMTP id 3D9B223D29
15 for <stable@archiver.kernel.org>; Tue, 4 Jun 2019 13:25:01 +0000 (UTC)
16Authentication-Results: mail.kernel.org;
17 dkim=pass (1024-bit key) header.d=agner.ch header.i=@agner.ch header.b="QWkQ/3jN"
18Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
19 id S1727340AbfFDNZA (ORCPT <rfc822;stable@archiver.kernel.org>);
20 Tue, 4 Jun 2019 09:25:00 -0400
21Received: from mail.kmu-office.ch ([178.209.48.109]:48348 "EHLO
22 mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
23 with ESMTP id S1727343AbfFDNZA (ORCPT
24 <rfc822;stable@vger.kernel.org>); Tue, 4 Jun 2019 09:25:00 -0400
25Received: from trochilidae.toradex.int (unknown [46.140.72.82])
26 by mail.kmu-office.ch (Postfix) with ESMTPSA id A3CC45C1F29;
27 Tue, 4 Jun 2019 15:24:57 +0200 (CEST)
28DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim;
29 t=1559654697;
30 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
31 to:to:cc:cc:mime-version:mime-version:content-type:
32 content-transfer-encoding:content-transfer-encoding:
33 in-reply-to:in-reply-to:references:references;
34 bh=tc6JvYRo2QJoJQVnFd/oGDG0/z6TF30OxAP+nBfruDc=;
35 b=QWkQ/3jNBkysiiD5SMb2UF+0YtSMCbOyP2/dUXeDQChYIal8jUex+QvYHjBh6l4Gff6WwG
36 3Zd44X6jE/KqxygBkoglOSb/dHwZ5AS8B8vpUM8vh2CzhrW4fD9eguoEIImOJJZ9RHgx0b
37 Gwno+ZPPhuPOcFbSrBwNsKK6mZLGttY=
38From: Stefan Agner <stefan@agner.ch>
39To: gregkh@linuxfoundation.org
40Cc: stable@vger.kernel.org,
41 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
42 Martin Sebor <msebor@gcc.gnu.org>,
43 Jessica Yu <jeyu@kernel.org>, Stefan Agner <stefan@agner.ch>
44Subject: [PATCH BACKPORT 4.19 2/2] include/linux/module.h: copy __init/__exit attrs to init/cleanup_module
45Date: Tue, 4 Jun 2019 15:24:41 +0200
46Message-Id: <20190604132441.15383-2-stefan@agner.ch>
47X-Mailer: git-send-email 2.21.0
48In-Reply-To: <20190604132441.15383-1-stefan@agner.ch>
49References: <20190604132441.15383-1-stefan@agner.ch>
50MIME-Version: 1.0
51Content-Transfer-Encoding: 8bit
52Sender: stable-owner@vger.kernel.org
53Precedence: bulk
54List-ID: <stable.vger.kernel.org>
55X-Mailing-List: stable@vger.kernel.org
56Archived-At: <https://lore.kernel.org/stable/20190604132441.15383-2-stefan@agner.ch/>
57List-Archive: <https://lore.kernel.org/stable/>
58List-Post: <mailto:stable@vger.kernel.org>
59
60From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
61
62[ Upstream commit a6e60d84989fa0e91db7f236eda40453b0e44afa ]
63
64The upcoming GCC 9 release extends the -Wmissing-attributes warnings
65(enabled by -Wall) to C and aliases: it warns when particular function
66attributes are missing in the aliases but not in their target.
67
68In particular, it triggers for all the init/cleanup_module
69aliases in the kernel (defined by the module_init/exit macros),
70ending up being very noisy.
71
72These aliases point to the __init/__exit functions of a module,
73which are defined as __cold (among other attributes). However,
74the aliases themselves do not have the __cold attribute.
75
76Since the compiler behaves differently when compiling a __cold
77function as well as when compiling paths leading to calls
78to __cold functions, the warning is trying to point out
79the possibly-forgotten attribute in the alias.
80
81In order to keep the warning enabled, we decided to silence
82this case. Ideally, we would mark the aliases directly
83as __init/__exit. However, there are currently around 132 modules
84in the kernel which are missing __init/__exit in their init/cleanup
85functions (either because they are missing, or for other reasons,
86e.g. the functions being called from somewhere else); and
87a section mismatch is a hard error.
88
89A conservative alternative was to mark the aliases as __cold only.
90However, since we would like to eventually enforce __init/__exit
91to be always marked, we chose to use the new __copy function
92attribute (introduced by GCC 9 as well to deal with this).
93With it, we copy the attributes used by the target functions
94into the aliases. This way, functions that were not marked
95as __init/__exit won't have their aliases marked either,
96and therefore there won't be a section mismatch.
97
98Note that the warning would go away marking either the extern
99declaration, the definition, or both. However, we only mark
100the definition of the alias, since we do not want callers
101(which only see the declaration) to be compiled as if the function
102was __cold (and therefore the paths leading to those calls
103would be assumed to be unlikely).
104
105Cc: <stable@vger.kernel.org> # 4.14+
106Link: https://lore.kernel.org/lkml/20190123173707.GA16603@gmail.com/
107Link: https://lore.kernel.org/lkml/20190206175627.GA20399@gmail.com/
108Suggested-by: Martin Sebor <msebor@gcc.gnu.org>
109Acked-by: Jessica Yu <jeyu@kernel.org>
110Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
111Signed-off-by: Stefan Agner <stefan@agner.ch>
112---
113 include/linux/module.h | 4 ++--
114 1 file changed, 2 insertions(+), 2 deletions(-)
115
116diff --git a/include/linux/module.h b/include/linux/module.h
117index c71044644979..9915397715fc 100644
118--- a/include/linux/module.h
119+++ b/include/linux/module.h
120@@ -130,13 +130,13 @@ extern void cleanup_module(void);
121 #define module_init(initfn) \
122 static inline initcall_t __maybe_unused __inittest(void) \
123 { return initfn; } \
124- int init_module(void) __attribute__((alias(#initfn)));
125+ int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
126
127 /* This is only required if you want to be unloadable. */
128 #define module_exit(exitfn) \
129 static inline exitcall_t __maybe_unused __exittest(void) \
130 { return exitfn; } \
131- void cleanup_module(void) __attribute__((alias(#exitfn)));
132+ void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
133
134 #endif
135
136--
1372.21.0
138
139