From patchwork Thu Feb 4 18:18:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vazquez X-Patchwork-Id: 12068301 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 A6468C433E6 for ; Thu, 4 Feb 2021 18:20:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E48664F44 for ; Thu, 4 Feb 2021 18:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238990AbhBDSUM (ORCPT ); Thu, 4 Feb 2021 13:20:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238948AbhBDSTf (ORCPT ); Thu, 4 Feb 2021 13:19:35 -0500 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7707DC061786 for ; Thu, 4 Feb 2021 10:18:55 -0800 (PST) Received: by mail-qv1-xf4a.google.com with SMTP id k20so2857317qvm.16 for ; Thu, 04 Feb 2021 10:18:55 -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=eoiLv4Fjju3JEfXDuHbAba/lObCo1w6vbwyoS7MtecyRwqYnXpMFoZNAYuf+W6oplH gED96JwbPRY7jeChrEt5R+59xV+yLfGj24fcQAeQ3kg+O5aLSKHWIqNnkUhhZ+dn8Rq4 BSdC2ZaIBJTBtyH56RgpmICjqdLlGqg7bhCp5MvnfQftXNufcaTDf86YmN34tkYl8nUh E1TEXeKWOfc62QBEEL4iaICZJUqV2BK4Tg1pQtpDeOKiotE8p202ib96xqd5eEqoxJGm +lkG9dpS6gQ0YmtwBPKtO1zwA8TCpj/+Qfh0XPeMeyCRpOBP6XgHl3PnRK0X4FR79HSi HU0A== 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=QOB6uq5PPPJw/Iqpfthzny8wzXvbHFrcnyhAQU+7U8y+4mFHrLOQYz8keYcCSd4uPA TWQVFHUunxwSferVtMIy5NMIQtQgQv9nn3WX2inL9IIMjjmsJpUkb+sukpThR3HC8lUA JxCDthbJV44uU0yBfvtar+M1hg+Fm2jhd02VpDDV03LgZcv6fwnJgUn4Eav4PeCevW2z VA/Vv644hxZ3RGFyvgtbrFi9MpzaG44SMLdAPTQjlDwPvnEG6SEAwQjGOxinSgkkyfAJ 7PlpWkjz8DwIm3oKqreIN/FEScB0tZjTWYYlr7dPCoG0KlBWUmj6CG7hZVtACcEMnazU Vd6Q== X-Gm-Message-State: AOAM530O9qvJlc9QthaWCG26TY7NRtlrZaTKlhdzpL+hF342rKqBgRnc fsy5Xyvqmb7/vb7ytz31ogEUbtwFb0XB X-Google-Smtp-Source: ABdhPJyMx58OK+cTr24By73GqN8pUy8WYFcuOgVnb6Mlp/ZIQ5bdJXL9uXFa9JTBMZrMJ90CejS/EeyKo95s 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:a0c:e652:: with SMTP id c18mr436707qvn.59.1612462734464; Thu, 04 Feb 2021 10:18:54 -0800 (PST) Date: Thu, 4 Feb 2021 18:18:38 +0000 Message-Id: <20210204181839.558951-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 18:18:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vazquez X-Patchwork-Id: 12068323 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 CE874C433E0 for ; Thu, 4 Feb 2021 18:28:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DC5564E06 for ; Thu, 4 Feb 2021 18:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239101AbhBDS2t (ORCPT ); Thu, 4 Feb 2021 13:28:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238953AbhBDSTo (ORCPT ); Thu, 4 Feb 2021 13:19:44 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A2EAC06178A for ; Thu, 4 Feb 2021 10:19:04 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id z2so2691890pln.18 for ; Thu, 04 Feb 2021 10:19:04 -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=JWES8rpo4FSC6YxM08B3ne3WSE8mwOoe4YXK22ypOyIhZRXvmJtav1bew84WSu2he1 o5oTUWlif2TQQ6ePgIqh8RMnovA2hkvSifp7ohmwld/5FAlGsUqFjp3umWZQ8ry6Vvgt bmdrqAalBy3fjnn5ZB+2LdoKuiXdQjKnlpuDDp02oSdz1bVUG6r7drR4Y5yczWre7LJN pyuUu7KqqxlZOB/64y6nG0p/VCy3vx40h2+kK6qgiN59kRw34gOs0oPCkvjasFWMVrEi AX/7n9Hhs1w2NoAeUFG84NZxzCXroqpLRvQ/wTdc45/IAh74eK2h+lHZx7lsD9e8/zCU tExQ== 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=fLXnL/wXP98ASuRpQRhP8rN7ojcESzYB9ZBvdQZuwwyxUzx5pq1lyEMn1owMe3yAXk XuZ375aKpAH7d1AE0TQSP7SLRpb9+Aubzc6kuykgVPGP9B19IRNQB/RygPCOLvri9nmK EmZ+iEyTwLBtxucq/FLhU77yw9WmiglkFbRUyYZ0fVle9qR6dxJYjq14jqJwOEc3cyhC Y2qc69zvjcU9+MNp/z+FBnNLOxw9lBBWev3rhkIV7X1nOG+0Ya3Pexojs2vzfCIz7HiL hHOVdv0vWcoRmxw7KUwbWqP+40LJc2o5dX5Dhc7jF1LVjIDwaF+SdNlG6/JpGQVsXR5r E3lA== X-Gm-Message-State: AOAM533hCOt74b9QL+oFlxiiPSb0QTU92yrOzzQGSKNcaAxhv4hiZ9lJ 8Ldj/D6JS+pblbClFcE/YSzqGlRj0Typ X-Google-Smtp-Source: ABdhPJzx1vsXHznamTaYWa9MvvPa0WoOBCyUpAAEP3hDPxjBYVWTXkLnj/RR88J2ZNL7dmnhiy+DO9nElJFi 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:3b44:: with SMTP id t4mr64655pjf.1.1612462743645; Thu, 04 Feb 2021 10:19:03 -0800 (PST) Date: Thu, 4 Feb 2021 18:18:39 +0000 In-Reply-To: <20210204181839.558951-1-brianvv@google.com> Message-Id: <20210204181839.558951-2-brianvv@google.com> Mime-Version: 1.0 References: <20210204181839.558951-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