From patchwork Mon Jun 6 04:53:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12869973 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4227C43334 for ; Mon, 6 Jun 2022 05:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbiFFF1R (ORCPT ); Mon, 6 Jun 2022 01:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbiFFF1L (ORCPT ); Mon, 6 Jun 2022 01:27:11 -0400 X-Greylist: delayed 83 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 05 Jun 2022 22:04:29 PDT Received: from condef-04.nifty.com (condef-04.nifty.com [202.248.20.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 205BD762BF; Sun, 5 Jun 2022 22:04:28 -0700 (PDT) Received: from conuserg-10.nifty.com ([10.126.8.73])by condef-04.nifty.com with ESMTP id 2564uAao012761; Mon, 6 Jun 2022 13:56:30 +0900 Received: from grover.sesame (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-10.nifty.com with ESMTP id 2564rxU9026256; Mon, 6 Jun 2022 13:54:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 2564rxU9026256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654491242; bh=isf+a5aQ1y4P6QoSWZORn/o1CmARhw+dCDmlwB5MUhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/5LLpefrhB6ls7uUg5UnXmoqagKwB+mQiCQosf9QYbV5pNhS1Gd1Sid/GZWZxGLT vh+oA2onkm3RC6YMqE3CsQ8vU4ilcfWTvMf+W4U6MREze7eLHqRMoh6YXohU9IK6AF 0MHHFHQp0/1b54orxyALK6PMWmzo7jmkHdzFyvRaoAt7lOl6MzELTGlz4ZEgNSGfyL Mdwk4FJ1DCJ3j+fDouhxxcTvseXTgSBGHRJI9lTKmubL8WuSYLBJyGXAmCzHn5itxu pFmcu1h6/DfltJzelsuyJyJPDl+AdHL6bB+h3w00TFPKE6MUtu1qBA5+bkUc6aDn3Y pdafOyHgLu56w== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Eric Dumazet , Paolo Abeni , Masahiro Yamada , Stephen Rothwell , Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] net: mdio: unexport __init-annotated mdio_bus_init() Date: Mon, 6 Jun 2022 13:53:53 +0900 Message-Id: <20220606045355.4160711-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220606045355.4160711-1-masahiroy@kernel.org> References: <20220606045355.4160711-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic. modpost used to detect it, but it has been broken for a decade. Recently, I fixed modpost so it started to warn it again, then this showed up in linux-next builds. There are two ways to fix it: - Remove __init - Remove EXPORT_SYMBOL I chose the latter for this case because the only in-tree call-site, drivers/net/phy/phy_device.c is never compiled as modular. (CONFIG_PHYLIB is boolean) Fixes: 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada Reviewed-by: Florian Fainelli Reviewed-by: Russell King (Oracle) --- drivers/net/phy/mdio_bus.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 58d602985877..8a2dbe849866 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -1046,7 +1046,6 @@ int __init mdio_bus_init(void) return ret; } -EXPORT_SYMBOL_GPL(mdio_bus_init); #if IS_ENABLED(CONFIG_PHYLIB) void mdio_bus_exit(void) From patchwork Mon Jun 6 04:53:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12869979 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C753C433EF for ; Mon, 6 Jun 2022 05:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbiFFF1p (ORCPT ); Mon, 6 Jun 2022 01:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiFFF1k (ORCPT ); Mon, 6 Jun 2022 01:27:40 -0400 Received: from condef-07.nifty.com (condef-07.nifty.com [202.248.20.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE529119069; Sun, 5 Jun 2022 22:06:05 -0700 (PDT) Received: from conuserg-10.nifty.com ([10.126.8.73])by condef-07.nifty.com with ESMTP id 2564ttqF026112; Mon, 6 Jun 2022 13:56:15 +0900 Received: from grover.sesame (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-10.nifty.com with ESMTP id 2564rxUA026256; Mon, 6 Jun 2022 13:54:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 2564rxUA026256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654491243; bh=ziQR3Y2YVkVjwU2FN5ZC+RUigUk86AY6lP77BM69cbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YK9ljVsieM/Oe6LIGFVOj3act3Y+vtt/qbzrdfidezomn2THxtGDQwGpxvOTi+RZm pF6qs15bi0tyntc8Wl2uv9tH2cyTx1n1tjZBxaA7Qrlo/N+bRY7zTY6r2eMQ3aucBy qKx3ZvjyvPzBa0urhSQlaHECANtaYdh97M9CA1GDGnSa6nuzgE81NbhkbnNqY1mfKs AazrY8ger8oAZ/HhDmhCEIVwD/G2WRymdTVF5iixsIqcsRkckW3FVQ4TLXq5X5SgJk XK0lqGi8TpdbWNPWX/0Y21f68B5Gu3gNa8dTCk/FyDWtGaHASScGNl7Gm9EKZbSIb2 US58dmCjmgOsA== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Eric Dumazet , Paolo Abeni , Masahiro Yamada , Stephen Rothwell , David Ahern , Herbert Xu , Hideaki YOSHIFUJI , Steffen Klassert , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] net: xfrm: unexport __init-annotated xfrm4_protocol_init() Date: Mon, 6 Jun 2022 13:53:54 +0900 Message-Id: <20220606045355.4160711-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220606045355.4160711-1-masahiroy@kernel.org> References: <20220606045355.4160711-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic. modpost used to detect it, but it has been broken for a decade. Recently, I fixed modpost so it started to warn it again, then this showed up in linux-next builds. There are two ways to fix it: - Remove __init - Remove EXPORT_SYMBOL I chose the latter for this case because the only in-tree call-site, net/ipv4/xfrm4_policy.c is never compiled as modular. (CONFIG_XFRM is boolean) Fixes: 2f32b51b609f ("xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada Acked-by: Steffen Klassert --- net/ipv4/xfrm4_protocol.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c index 2fe5860c21d6..b146ce88c5d0 100644 --- a/net/ipv4/xfrm4_protocol.c +++ b/net/ipv4/xfrm4_protocol.c @@ -304,4 +304,3 @@ void __init xfrm4_protocol_init(void) { xfrm_input_register_afinfo(&xfrm4_input_afinfo); } -EXPORT_SYMBOL(xfrm4_protocol_init); From patchwork Mon Jun 6 04:53:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12869980 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B283BC43334 for ; Mon, 6 Jun 2022 05:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229578AbiFFF3c (ORCPT ); Mon, 6 Jun 2022 01:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiFFF2F (ORCPT ); Mon, 6 Jun 2022 01:28:05 -0400 Received: from condef-08.nifty.com (condef-08.nifty.com [202.248.20.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B65713A2E2; Sun, 5 Jun 2022 22:07:59 -0700 (PDT) Received: from conuserg-10.nifty.com ([10.126.8.73])by condef-08.nifty.com with ESMTP id 2564tuC1017874; Mon, 6 Jun 2022 13:56:17 +0900 Received: from grover.sesame (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-10.nifty.com with ESMTP id 2564rxUB026256; Mon, 6 Jun 2022 13:54:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 2564rxUB026256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654491244; bh=8DsFZaGELYB7JvwytYb5vfoaMr6TS1NLhkVqZf+4BBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJ/D8hXjFIh+wPt+yETn7vdGZzNYq1/3hzgsf0g1WYd5EvNUKb7sFe09qxQP3X6gY LxIASv+ka9fQHrDIPDpxMsTAaO+AlqlWnhFLkNWI+uEk/r6yTEorleWfqnhh/kdpAs KwCsXgpyVxeFWbadM7lVp0wWLOmjLNGcHHyzDhgztK56+fJKLq72cUvYqKOcIbWCGA ZDOFibDqFM4sFQCLqQk+ahSkZcBIpEzZRNhjqiJ2X/3NhdrYp0EOIPVBNW47lG6xNt uGDsC0txo+64CJXCY3FbmnCGOFOV93uRPyVqejSorqsP8z3Z3k2oxDW4ZvKOAT4Frj eu9G5Y/Yl4MSw== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Eric Dumazet , Paolo Abeni , Masahiro Yamada , Stephen Rothwell , David Ahern , David Lebrun , Hideaki YOSHIFUJI , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] net: ipv6: unexport __init-annotated seg6_hmac_init() Date: Mon, 6 Jun 2022 13:53:55 +0900 Message-Id: <20220606045355.4160711-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220606045355.4160711-1-masahiroy@kernel.org> References: <20220606045355.4160711-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic. modpost used to detect it, but it has been broken for a decade. Recently, I fixed modpost so it started to warn it again, then this showed up in linux-next builds. There are two ways to fix it: - Remove __init - Remove EXPORT_SYMBOL I chose the latter for this case because the caller (net/ipv6/seg6.c) and the callee (net/ipv6/seg6_hmac.c) belong to the same module. It seems an internal function call in ipv6.ko. Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada --- net/ipv6/seg6_hmac.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index 29bc4e7c3046..6de01185cc68 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c @@ -399,7 +399,6 @@ int __init seg6_hmac_init(void) { return seg6_hmac_init_algo(); } -EXPORT_SYMBOL(seg6_hmac_init); int __net_init seg6_hmac_net_init(struct net *net) {