From mboxrd@z Thu Jan 1 00:00:00 1970 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 51137C38A2D for ; Tue, 25 Oct 2022 13:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbiJYNmH (ORCPT ); Tue, 25 Oct 2022 09:42:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbiJYNmG (ORCPT ); Tue, 25 Oct 2022 09:42:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3AE3182C68 for ; Tue, 25 Oct 2022 06:42:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9137E6195F for ; Tue, 25 Oct 2022 13:42:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93D8EC433D6; Tue, 25 Oct 2022 13:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666705325; bh=U46pkV1bbPWWYFOdwlin4B8T0zosTNgp+rtNpOzHJHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIuVqhsEcNdYVB0+6tYCN+nwCqjYCxRPs8lkaLBEuRKG/RvolahJjsFypc4C7KkUz BL2FAzsNI2Fp6WH8Cy8e04iC1BbOwKKvYHaOpDBWxNOq+p3gkEI7brKCxBRn24vweP sbVwIuCnryPcvZxey4KiNtFueyZFMQ1N2/hQl3Cd38RjhGvCZzecgr42/6puCo+sHI hyMJ7J8BJuez8ZvCBMgJnMq83LiUFg/YSk+wCIq3qrGYSnfegms8gB/6xOxRgzuUi0 zEWKmD5oTgYdCrG3AC+dH3DzJTCiUMTnHgN7uUFw4/RF+vElrlDrFn3PTkHCM8Jzh2 fEr+vOyObFoFA== From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Christoph Hellwig , Song Liu , bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Masami Hiramatsu , Martynas Pumputis Subject: [PATCHv3 bpf-next 1/8] kallsyms: Make module_kallsyms_on_each_symbol generally available Date: Tue, 25 Oct 2022 15:41:41 +0200 Message-Id: <20221025134148.3300700-2-jolsa@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221025134148.3300700-1-jolsa@kernel.org> References: <20221025134148.3300700-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Making module_kallsyms_on_each_symbol generally available, so it can be used outside CONFIG_LIVEPATCH option in following changes. Rather than adding another ifdef option let's make the function generally available (when CONFIG_KALLSYMS and CONFIG_MODULES options are defined). Cc: Christoph Hellwig Acked-by: Song Liu Signed-off-by: Jiri Olsa --- include/linux/module.h | 9 +++++++++ kernel/module/kallsyms.c | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index ec61fb53979a..35876e89eb93 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -879,8 +879,17 @@ static inline bool module_sig_ok(struct module *module) } #endif /* CONFIG_MODULE_SIG */ +#if defined(CONFIG_MODULES) && defined(CONFIG_KALLSYMS) int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); +#else +static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + struct module *, unsigned long), + void *data) +{ + return -EOPNOTSUPP; +} +#endif /* CONFIG_MODULES && CONFIG_KALLSYMS */ #endif /* _LINUX_MODULE_H */ diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c index f5c5c9175333..4523f99b0358 100644 --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -494,7 +494,6 @@ unsigned long module_kallsyms_lookup_name(const char *name) return ret; } -#ifdef CONFIG_LIVEPATCH int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data) @@ -531,4 +530,3 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, mutex_unlock(&module_mutex); return ret; } -#endif /* CONFIG_LIVEPATCH */ -- 2.37.3