Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5125685rwd; Sun, 4 Jun 2023 21:29:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Jgt6i5Fpk4KCAce88IDzUQm2kkY5qY5sG/JdqyuaLbdpETM3bl6klqbXGsGbFMbGuoXEr X-Received: by 2002:a05:6a00:1996:b0:652:a559:b2c5 with SMTP id d22-20020a056a00199600b00652a559b2c5mr11233910pfl.13.1685939369519; Sun, 04 Jun 2023 21:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685939369; cv=none; d=google.com; s=arc-20160816; b=RBBk03/ZuuBZfCcBik0s07OXfJWKmMVKzrDUxXAQuKB6ot06dpuP24Rg832BwMBXZ9 wDMY9OJYeNumfGfDjgWQ6ByANeNMAj2VQ17QQmR7m4B1aqGQXv2ONN8nBvZcZYel7sH5 nh0P+ldMhplbX9hwQCRQVScm4VdVCJczLlPykuO38qLJJFZQzya9W4LkCg+qvDhzjgSP fDpMms6Dh0sui/PSbKAG/GtEdVxZx3C1G8c78t/+lRXI/SgQ1idr4bWaa7L5Sy45AeFO Jg7iN4bv5clnfwvNhkYOENcT5YWr0/ju9XarfxpFBnlTjFiMthXM4kT/8JLhBzEepkDL dFHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=Fi1sOsiDHHx+gfQ29iwbhaaJETQZNbqv0f9OXt08XM0=; b=0NNntTX6RWmrVhIlsMYju7M5BcGjCBKptXJmiA8LyQL6qr6/HkbkMj9YPgnpnnAGct 1trHOYIs6AXSGUFpb35H21Fm7djIidB9Ar7cgOVjnj/3+soq6MeUxo8hb6HIv3igbTSK 0U0vePf0b2WWl5MXFBM6TRxABgcjkJXuynCMFi7ArcwRBbXbf+cUiPxN/MnyVJVFLFQd MGLBM0cC/81UQL0zQU+RvB/3Ltu06m+oW3gyNbNATCKBkN1PyIkiwLeV2pAXbmFcDnaD msu7u/iSVZbkpLHctvjiwP4IIpakebH9/FB+tFWcPp1o1EHD7z4SiHxc0mwiu2ctKrJq /VCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Kws1VDt5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m64-20020a625843000000b00624eb57b45dsi4755272pfb.74.2023.06.04.21.29.14; Sun, 04 Jun 2023 21:29:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Kws1VDt5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233086AbjFEELr (ORCPT + 99 others); Mon, 5 Jun 2023 00:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233069AbjFEELV (ORCPT ); Mon, 5 Jun 2023 00:11:21 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9582F199E for ; Sun, 4 Jun 2023 21:09:42 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230605040940epoutp04dfc7a5eee91265f2f9a8452c5e2f37d6~lp9e_tguh0569805698epoutp04G for ; Mon, 5 Jun 2023 04:09:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230605040940epoutp04dfc7a5eee91265f2f9a8452c5e2f37d6~lp9e_tguh0569805698epoutp04G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685938180; bh=Fi1sOsiDHHx+gfQ29iwbhaaJETQZNbqv0f9OXt08XM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kws1VDt51X+OMNgT5OucHo30omXmqACU6T1z0ACVrKrccqazi5cJv6SSMSMsuU+pM iXjLn9iMEZQsw462WBN8MncopDbbrkGzJAxwdh9DwHmw395cUCVGHH2gkozV1m6cLO zL+F+Y3wgRSu28Yo98Ra2zAC/NWfx4YMq5HR8jJc= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20230605040940epcas5p39a4865eeffa0c1cc19dce413c55ede44~lp9ee7ZCY1277312773epcas5p3W; Mon, 5 Jun 2023 04:09:40 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 4F.6B.04567.3006D746; Mon, 5 Jun 2023 13:09:39 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20230605040753epcas5p2640ca20e5fe0f628926d5cba16d8270a~lp77NakNH0082200822epcas5p26; Mon, 5 Jun 2023 04:07:53 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230605040753epsmtrp2a926e61806e40e3d526676a17dc217df~lp77MT7781080610806epsmtrp2h; Mon, 5 Jun 2023 04:07:53 +0000 (GMT) X-AuditID: b6c32a49-943ff700000011d7-e5-647d60034268 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id EA.B8.28392.99F5D746; Mon, 5 Jun 2023 13:07:53 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230605040748epsmtip23403b68277135b425da66ba075a17876~lp72SWoPg3106431064epsmtip25; Mon, 5 Jun 2023 04:07:48 +0000 (GMT) From: Maninder Singh To: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, thunder.leizhen@huawei.com, mcgrof@kernel.org, boqun.feng@gmail.com, vincenzopalazzodev@gmail.com, ojeda@kernel.org, jgross@suse.com, brauner@kernel.org, michael.christie@oracle.com, samitolvanen@google.com, glider@google.com, peterz@infradead.org, keescook@chromium.org, stephen.s.brennan@oracle.com, alan.maguire@oracle.com, pmladek@suse.com Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Maninder Singh , Onkarnath Subject: [PATCH v3 2/3] kallsyms: make kallsyms_show_value() as generic function Date: Mon, 5 Jun 2023 09:37:30 +0530 Message-Id: <20230605040731.13828-2-maninder1.s@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230605040731.13828-1-maninder1.s@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUxTVxjGc+5XS7Oyy8fCsUQhLIASLeCmOS4g0y3jOt1E9xGmS0Ynd8ig pbYwtzlj+QgOHJQZIFJAStzkYyBQitRuymiLDUPGYFvW0hGJVmA4GFAmYCWO9krmf7/3fZ4n 7/ueHD7u30KJ+OmybFYhk2SGUQLiqnlL5DY85XRqzI3ml5DNlEugJXc1jhZXHDzUos/FkMti pdB98wJAl+of4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0OfjWhdQw7b58uVn3EfO7xZ6vfr9bo62eBXbWd8K 7q7cKKfX/rpwhUx0zmpPn/slaUtcztv3XbhsfNE59cQCJZbijERDLeai4kQAWyqNp3ADAAA= X-CMS-MailID: 20230605040753epcas5p2640ca20e5fe0f628926d5cba16d8270a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20230605040753epcas5p2640ca20e5fe0f628926d5cba16d8270a References: <20230605040731.13828-1-maninder1.s@samsung.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 This change makes function kallsyms_show_value() as generic function without dependency on CONFIG_KALLSYMS. Now module address will be displayed with lsmod and /proc/modules. Earlier: ======= / # insmod test.ko / # lsmod test 12288 0 - Live 0x0000000000000000 (O) // No Module Load address / # With change: ========== / # insmod test.ko / # lsmod test 12288 0 - Live 0xffff800000fc0000 (O) // Module address / # cat /proc/modules test 12288 0 - Live 0xffff800000fc0000 (O) Co-developed-by: Onkarnath Signed-off-by: Onkarnath Signed-off-by: Maninder Singh --- include/linux/kallsyms.h | 11 +++-------- kernel/knosyms.c | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 1037f4957caa..c3f075e8f60c 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -65,6 +65,9 @@ static inline void *dereference_symbol_descriptor(void *ptr) return ptr; } +/* How and when do we show kallsyms values? */ +extern bool kallsyms_show_value(const struct cred *cred); + #ifdef CONFIG_KALLSYMS unsigned long kallsyms_sym_address(int idx); int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long), @@ -94,9 +97,6 @@ extern int sprint_backtrace_build_id(char *buffer, unsigned long address); int lookup_symbol_name(unsigned long addr, char *symname); -/* How and when do we show kallsyms values? */ -extern bool kallsyms_show_value(const struct cred *cred); - #else /* !CONFIG_KALLSYMS */ static inline unsigned long kallsyms_lookup_name(const char *name) @@ -154,11 +154,6 @@ static inline int lookup_symbol_name(unsigned long addr, char *symname) return -ERANGE; } -static inline bool kallsyms_show_value(const struct cred *cred) -{ - return false; -} - static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long), void *data) { diff --git a/kernel/knosyms.c b/kernel/knosyms.c index 9e2c72a89ea5..830905b0986a 100644 --- a/kernel/knosyms.c +++ b/kernel/knosyms.c @@ -9,7 +9,6 @@ #include #include -#ifdef CONFIG_KALLSYMS static inline int kallsyms_for_perf(void) { #ifdef CONFIG_PERF_EVENTS @@ -45,4 +44,3 @@ bool kallsyms_show_value(const struct cred *cred) return false; } } -#endif -- 2.17.1