From patchwork Thu Feb 4 17:19:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vazquez X-Patchwork-Id: 12067999 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 X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B7CC433DB for ; Thu, 4 Feb 2021 17:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68BF164F65 for ; Thu, 4 Feb 2021 17:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238438AbhBDRVr (ORCPT ); Thu, 4 Feb 2021 12:21:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238350AbhBDRUZ (ORCPT ); Thu, 4 Feb 2021 12:20:25 -0500 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA409C061788 for ; Thu, 4 Feb 2021 09:19:45 -0800 (PST) Received: by mail-pf1-x449.google.com with SMTP id z3so2905900pfj.3 for ; Thu, 04 Feb 2021 09:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=jVxxi2FsPuJw4XM1jbb8exuFnk/zAFQh52OuUnL6x5c=; b=cBBH6E38w3ioyeFqsdVI637YfnFdofxvqmnPq3Agbtor84vP4DOwxc29ct1qwg1dTr k3Enyv1FSv3SKdG6Pyefp5vIiAPf0wtby8liexvP0SZTzpOAOdqRBCUjs7ByW54gJV+7 bHlUjZ2phzNhw7TpKljfGEcnDmNFE205AsM4pPwqBna8CnFmSsvK9Nm252VXdEP2KEam 4WqKIF3bUtfx1CHRgj6G4R2f8XVM2/fzMyeHR/4WRRY4MeabYJPNKaqjwf4bCqc6bnCT OEASH+3HzCato3ZPypgQvZv4Nf7U4DiHGHzsbE5/bCSUj3uY46G4fduPbEJ/LUoEaGz+ 1DLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=jVxxi2FsPuJw4XM1jbb8exuFnk/zAFQh52OuUnL6x5c=; b=Q79qx8MWLjZKTcEyCfDD8KitmkJDYExWGMQ2gYcPlKFDv/0kOg+gkrdGZfOjcORcy/ KJuPrQnJfgZtW4Zuw3DgKKXn9gdaqwKtTOQwHQEXyZcIZ/GyEFzUZ+S3SEMkQtWDGYfO 8dyZPXtqjPEpneECSAWkDiKXp940cT/wPb7J9r15P5tUJ8btWCgBC0S6X+wvl7Z5M5oD RMlfI3bzCvhNKufGUfPjyT6lnkW6CGLktTB94SSSQsCiW4tlBt6xX18hRP8SZwZIKfNY 74ofwPz++dX2aeX1O55p+3cynVufMPzSGWZEN9+OMjIO+E3QnXjQaMGGRY5zel9XUBaJ WYDQ== X-Gm-Message-State: AOAM532fXkIxU0l8ctENgD3/LtmJ6yHuuoc0m+2krAP/i3TJJqwjQKo9 EUXzDLYVln0K/oPXSgul2otdmB0hyowI X-Google-Smtp-Source: ABdhPJwt8i+WRWwmmTnVx/RZ4nFR8fm8Ym2VS8rcLwVe+ugJh6hHeS0ugCVuXanWYSPq2Q7tq4GodF5wZvGe Sender: "brianvv via sendgmr" X-Received: from brianvv.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:348]) (user=brianvv job=sendgmr) by 2002:a17:90a:7503:: with SMTP id q3mr480577pjk.79.1612459185194; Thu, 04 Feb 2021 09:19:45 -0800 (PST) Date: Thu, 4 Feb 2021 17:19:41 +0000 Message-Id: <20210204171942.469883-1-brianvv@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH net-next 1/2] net: add EXPORT_INDIRECT_CALLABLE wrapper From: Brian Vazquez To: Brian Vazquez , Brian Vazquez , Eric Dumazet , "David S . Miller" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stephen Rothwell Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When a static function is annotated with INDIRECT_CALLABLE_SCOPE and CONFIG_RETPOLINE is set, the static keyword is removed. Sometimes the function needs to be exported but EXPORT_SYMBOL can't be used because if CONFIG_RETPOLINE is not set, we will attempt to export a static symbol. This patch introduces a new indirect call wrapper: EXPORT_INDIRECT_CALLABLE. This basically does EXPORT_SYMBOL when CONFIG_RETPOLINE is set, but does nothing when it's not. Reported-by: Stephen Rothwell Signed-off-by: Brian Vazquez --- include/linux/indirect_call_wrapper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/indirect_call_wrapper.h b/include/linux/indirect_call_wrapper.h index 54c02c84906a..a8345c8a613d 100644 --- a/include/linux/indirect_call_wrapper.h +++ b/include/linux/indirect_call_wrapper.h @@ -36,6 +36,7 @@ #define INDIRECT_CALLABLE_DECLARE(f) f #define INDIRECT_CALLABLE_SCOPE +#define EXPORT_INDIRECT_CALLABLE(f) EXPORT_SYMBOL(f) #else #define INDIRECT_CALL_1(f, f1, ...) f(__VA_ARGS__) @@ -44,6 +45,7 @@ #define INDIRECT_CALL_4(f, f4, f3, f2, f1, ...) f(__VA_ARGS__) #define INDIRECT_CALLABLE_DECLARE(f) #define INDIRECT_CALLABLE_SCOPE static +#define EXPORT_INDIRECT_CALLABLE(f) #endif /* From patchwork Thu Feb 4 17:19:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vazquez X-Patchwork-Id: 12068299 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 X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EF63C433E0 for ; Thu, 4 Feb 2021 18:19:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 551DE64F45 for ; Thu, 4 Feb 2021 18:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238919AbhBDSSd (ORCPT ); Thu, 4 Feb 2021 13:18:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238374AbhBDRU2 (ORCPT ); Thu, 4 Feb 2021 12:20:28 -0500 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72730C06178A for ; Thu, 4 Feb 2021 09:19:47 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id 32so2614032plf.3 for ; Thu, 04 Feb 2021 09:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=GkV/UHW40ojQINSJGLSD5pRuP03bJ/Yv3/kf3sMMqUY=; b=cO/etlrrEAzH/g1dbDSHauc4EzO7fZ2R+6UmMcdpjUQej4vTfKrqsHKiRkmb4iK3ZW GtQk37rbrYe46Cdbulsuekq+yF2V0ZCBgqq+USJ4prDmtt2w5mJqItMEst8FW+U6cJom NBgsvmwUFUntRGhS+4iNmG6cgHvxhb43Ic6+jOr2AqQFfNriCikLrwXnFdrQmyYA2Rao Cl/BcoImBY71li6bW5mqQcY9CNEIOxbGPl1yqTXYsL0NmARWtAohBoiQ7MNSMMeaqxvR h09dSOPBRJ0LArGSc/u3oD59FIhQ07ZkmYvYqWajGzfICETSyVEMFxFoCL//DxvONIfJ Q0Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=GkV/UHW40ojQINSJGLSD5pRuP03bJ/Yv3/kf3sMMqUY=; b=DINj3NGo9xyzgMad8mxLOScDhJculX2cc61KtlgcY5cRRn5svBZQKaTjy8M7A50vMb xKpPbnqSv3qf7c/u3CywD/FWbfSQJGag9QBSB8ETTq+jAUa6f5Lsj+fEtZdtasAufmwW 4BfiOIqZs1DXu4yV9L3gbudNggNW/3jZq7g7yqPyLRjAaXpO0v8XW+M6ddj8R8p03v8x N4eilRqb7ZWqHW4qPGu3gpz3cU21lcVA7cfVChPSx4H9S7E8yFFYjqcn6uMIOHHT/w+o Cy3pgO3qhYs7yvbyWUevh8+Jdxpx455hagkenze+RC2uCEpoBI9j5LW0f72L8gGSfA+0 n9MQ== X-Gm-Message-State: AOAM531l+9RLfKuJJ1m+rgAwl2lcRgfXivaUp88GCR/qNiAqG/NlB33R p/AdGySXz0iVzFQrKEmmnQQy80T5d8Zt X-Google-Smtp-Source: ABdhPJwZaUPMg1NyBgDgtgmMlUvddCN80MhfXCBqI3DFZkywijVbuzNalDMOpxzEr6D7+EXxD41EvAbqHBiR Sender: "brianvv via sendgmr" X-Received: from brianvv.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:348]) (user=brianvv job=sendgmr) by 2002:a17:90a:6288:: with SMTP id d8mr494508pjj.49.1612459186925; Thu, 04 Feb 2021 09:19:46 -0800 (PST) Date: Thu, 4 Feb 2021 17:19:42 +0000 In-Reply-To: <20210204171942.469883-1-brianvv@google.com> Message-Id: <20210204171942.469883-2-brianvv@google.com> Mime-Version: 1.0 References: <20210204171942.469883-1-brianvv@google.com> X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH net-next 2/2] net: fix building errors on powerpc when CONFIG_RETPOLINE is not set From: Brian Vazquez To: Brian Vazquez , Brian Vazquez , Eric Dumazet , "David S . Miller" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stephen Rothwell Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This commit fixes the errores reported when building for powerpc: ERROR: modpost: "ip6_dst_check" [vmlinux] is a static EXPORT_SYMBOL ERROR: modpost: "ipv4_dst_check" [vmlinux] is a static EXPORT_SYMBOL ERROR: modpost: "ipv4_mtu" [vmlinux] is a static EXPORT_SYMBOL ERROR: modpost: "ip6_mtu" [vmlinux] is a static EXPORT_SYMBOL Fixes: f67fbeaebdc0 ("net: use indirect call helpers for dst_mtu") Fixes: bbd807dfbf20 ("net: indirect call helpers for ipv4/ipv6 dst_check functions") Reported-by: Stephen Rothwell Signed-off-by: Brian Vazquez --- net/ipv4/route.c | 4 ++-- net/ipv6/route.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 9e6537709794..be31e2446470 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1206,7 +1206,7 @@ INDIRECT_CALLABLE_SCOPE struct dst_entry *ipv4_dst_check(struct dst_entry *dst, return NULL; return dst; } -EXPORT_SYMBOL(ipv4_dst_check); +EXPORT_INDIRECT_CALLABLE(ipv4_dst_check); static void ipv4_send_dest_unreach(struct sk_buff *skb) { @@ -1337,7 +1337,7 @@ INDIRECT_CALLABLE_SCOPE unsigned int ipv4_mtu(const struct dst_entry *dst) return mtu - lwtunnel_headroom(dst->lwtstate, mtu); } -EXPORT_SYMBOL(ipv4_mtu); +EXPORT_INDIRECT_CALLABLE(ipv4_mtu); static void ip_del_fnhe(struct fib_nh_common *nhc, __be32 daddr) { diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8d9e053dc071..0d1784b0d65d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2644,7 +2644,7 @@ INDIRECT_CALLABLE_SCOPE struct dst_entry *ip6_dst_check(struct dst_entry *dst, return dst_ret; } -EXPORT_SYMBOL(ip6_dst_check); +EXPORT_INDIRECT_CALLABLE(ip6_dst_check); static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) { @@ -3115,7 +3115,7 @@ INDIRECT_CALLABLE_SCOPE unsigned int ip6_mtu(const struct dst_entry *dst) return mtu - lwtunnel_headroom(dst->lwtstate, mtu); } -EXPORT_SYMBOL(ip6_mtu); +EXPORT_INDIRECT_CALLABLE(ip6_mtu); /* MTU selection: * 1. mtu on route is locked - use it