Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4690656iob; Sun, 8 May 2022 22:08:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD840Ji/k7ETO5DhIGSbjo+zsUJoVZtqizdya4csJjXPwyB6PbiXLhxuz3uyJ8gKnnrrP8 X-Received: by 2002:a17:90b:1bd1:b0:1dc:7118:cf28 with SMTP id oa17-20020a17090b1bd100b001dc7118cf28mr16430691pjb.3.1652072908569; Sun, 08 May 2022 22:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652072908; cv=none; d=google.com; s=arc-20160816; b=HKf11xZ2EnpL3rZ/MeWZzWCmwDueeqGdbda5K5TfEcwbefaoRh8q4eRzlgSzAyjc5z AZzEM1GiTceAopsyvizx6IvQ2YYKH9M19AYj+VOj9ziP8sWQiWOmc5TpZPMCqUv2D0sC E37fNipfB3RiAFDdMCnzdvbJdjV9xt7x4G4AAcoRzhjYWu/Qtmd+BMeElO2uvlIyid5b /3gQRk4H4ykJe8So556KMgR6Z8XAn5+gyTZbaHeKLg/oSfA352LtEl4THc7yMToXXKos 514W8zgZdN+1uL70IdfCJF2Kz+R7ti8WP8u4u4rsUDcAINTgwCc+eIlc+2EtIO7+E2Y+ s+Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FVScnPA/eiOlyElgt2ZBciechAaBIYhmF7yO/xczcX4=; b=DaBLK5EbtHD/LniGdEDTu+AGcwJpdNPcjM9yonRXHY5IbeoZrYIQggpbEOY4zXPE+g CQrW0vgDcOX0zN9VlQPWy1OCelCIN5yT4JAJ5EvBOKmYR/3qIUj2+BbqlQnbNBTf0Pob xRFreCn7HYwUhNCNAxtGCDoefVgtAWjyGsWCKiXWEiaDX+05m8S4kTVhNGuG/uP/BgEK 0rVDwOqH6QCIgTlJ7iTIp45kngkdVGwK4o1/KlzZkyQ6aFoiuKuMpypa98DTJA97Qq70 zpxKrcKQymmcF5QSkAD9ZdDe48ATE3UnmzqQ2lqFWFEUSMlojv72JU8i7GOOcS3Jz4VC PadA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Emm3X/cz"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l8-20020a170902f68800b0015d1f1c9235si11753287plg.561.2022.05.08.22.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:08:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Emm3X/cz"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F23B817E3B; Sun, 8 May 2022 22:01:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442603AbiEGNBW (ORCPT + 99 others); Sat, 7 May 2022 09:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446424AbiEGNBQ (ORCPT ); Sat, 7 May 2022 09:01:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8468F3A7; Sat, 7 May 2022 05:57:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3BF88B803F1; Sat, 7 May 2022 12:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC6DDC385A6; Sat, 7 May 2022 12:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651928246; bh=F63i/UybQIYmNwjxZiAXyorD/ESnTlN0vrhzUE7HszQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Emm3X/czRLA+YN2QTT1i5Fmuf7RpvIzKXerTbR9XGCsG14C+TFjwJKZ9Uyd+CZM/E AvpA1SoTqdpPM41aytBNFFo+IvWbHzkN6IwgYLw9D2dF+NT8kS3PrURKPG3H8CoTJB AKAeqNU9oraomQCYGF+MA6xtvz9fnKL3Fzvtg7LQyeylhsAxasKgNMJQXaI7Qd+FMf YkY3NIisPDhNr1uvTOVFX8Z+ObN8bAPloQtAAFEyLXVmHjOGRbuN43FrkZWdX/mcy6 15YRSYgdAXgaWQl5l0X4FlhP8sISqUMPrxukf9iYz+cakeDVif9ndA8ZRQ7TyUstxb BuE9LqRVvW0jg== From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu Cc: Christoph Hellwig , netdev@vger.kernel.org, bpf@vger.kernel.org, lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt Subject: [PATCHv5 bpf-next 1/5] kallsyms: Fully export kallsyms_on_each_symbol function Date: Sat, 7 May 2022 14:57:07 +0200 Message-Id: <20220507125711.2022238-2-jolsa@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507125711.2022238-1-jolsa@kernel.org> References: <20220507125711.2022238-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fully exporting kallsyms_on_each_symbol function, so it can be used in following changes. Rather than adding another ifdef option let's export the function completely (when CONFIG_KALLSYMS option is defined). Cc: Christoph Hellwig Reviewed-by: Masami Hiramatsu Signed-off-by: Jiri Olsa --- include/linux/kallsyms.h | 7 ++++++- kernel/kallsyms.c | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index ce1bd2fbf23e..89f063651192 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -65,11 +65,11 @@ static inline void *dereference_symbol_descriptor(void *ptr) return ptr; } +#ifdef CONFIG_KALLSYMS int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); -#ifdef CONFIG_KALLSYMS /* Lookup the address for a symbol. Returns 0 if not found. */ unsigned long kallsyms_lookup_name(const char *name); @@ -163,6 +163,11 @@ static inline bool kallsyms_show_value(const struct cred *cred) return false; } +static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), + void *data) +{ + return -EOPNOTSUPP; +} #endif /*CONFIG_KALLSYMS*/ static inline void print_ip_sym(const char *loglvl, unsigned long ip) diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 79f2eb617a62..fdfd308bebc4 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -228,7 +228,6 @@ unsigned long kallsyms_lookup_name(const char *name) return module_kallsyms_lookup_name(name); } -#ifdef CONFIG_LIVEPATCH /* * Iterate over all symbols in vmlinux. For symbols from modules use * module_kallsyms_on_each_symbol instead. @@ -251,7 +250,6 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, } return 0; } -#endif /* CONFIG_LIVEPATCH */ static unsigned long get_symbol_pos(unsigned long addr, unsigned long *symbolsize, -- 2.35.1