Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6577098rwd; Mon, 5 Jun 2023 21:49:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DauhacCgf2VHcM/vwJgrfF9Gg2lxJcRZvYET0BG8nPelMcQs0e6d78Mu9tuBTPQNXdr6h X-Received: by 2002:a05:6214:20ed:b0:625:99ee:3ad8 with SMTP id 13-20020a05621420ed00b0062599ee3ad8mr1283736qvk.31.1686026942808; Mon, 05 Jun 2023 21:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686026942; cv=none; d=google.com; s=arc-20160816; b=rh/ZKzGGky7LnFrwehJBCoUpjlcvzVhEXU92TaMWN2Tw9bziDAmK90+4WTFrf2u11c CAhOP5lV0jKmXmRabUNR0Ul5Yf2+J8E6X9SZMeUyOBnrhXeTFyBK3lzHNgmg2uXYTzom Xz3ntn42aBEP7q6E2D8fNHLpTFBe4hMyLBj3//E+ZknoqtW6cqB9x5AiZNeKsSm2UAoJ C1V+HwKjZWmI1LUK/8XWzB1JbT66z2zzlBwW6dsZa6yOcL1yGvu8Sc4ehKANKIglwJoM UyWQ1TtyxEj9DdPyGtAR4qo1pyU+0lnN/dygMpzPmb7Rf24yiEgJfeAxnuHz2QcgLDFf tuDw== 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=B13/GxW/aC+E0iS9akiMYysKoCOqpsq+pQ7ZEhjZXc8=; b=06vy6y5xQMQzs/333nvRmL56s7SItAnG/wGB6rvxh2pDW/L1727tqe3aA24mLVz1C8 WrA7lzVlEKtmH9wXo9MMkE6Ev0BWls4rXC/xRQWmBUIsjKeQCpBNPefLlt+/ETtyLOr2 wUqxeWqA07BX00nOQ8qOgtZ/zqd9dFKA//lHL0Yn1I5jT0eGspuhj9LrmOQdOKooEIyg pPt5Bdg84VRGsTrpMqonqCfR32mYDRPfr2x5tuZdxW6iDQDi2JBMM/yZEkqn8UkX+UW2 iPI+fxM7PG8hVOmWQqesAjr4vSDReoDLMpgwZc+dBblR6oC/qFvLm0lX2Dei2Y4ZJWLZ Q8ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=sBVG1IHZ; 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 g4-20020a0562140ac400b00625a2fc5e61si5970463qvi.418.2023.06.05.21.48.25; Mon, 05 Jun 2023 21:49:02 -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=sBVG1IHZ; 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 S234148AbjFFE3L (ORCPT + 99 others); Tue, 6 Jun 2023 00:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231853AbjFFE25 (ORCPT ); Tue, 6 Jun 2023 00:28:57 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6264F7 for ; Mon, 5 Jun 2023 21:28:55 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230606042854epoutp01dc87f932f06367242719606a06239769~l93jdTyOW3036330363epoutp01i for ; Tue, 6 Jun 2023 04:28:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230606042854epoutp01dc87f932f06367242719606a06239769~l93jdTyOW3036330363epoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686025734; bh=B13/GxW/aC+E0iS9akiMYysKoCOqpsq+pQ7ZEhjZXc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sBVG1IHZYx+UrHF+3gTruX9S0CbZHi68Gy6Zy6URVpBOg5fxg6CdNql0HsQJ1vb+j fgxpv4Qhm6rohCctRXMPXRm8htWZtit+uT2km3Mcud5Zzdl+ogQQG8LLAD3k7Djy3B l8e52ezt6Jzy3BD78+btuxSqT+AU70qJNN9F6VDQ= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20230606042853epcas5p1f01ceaf04307f1007ef8dd39a3190ee2~l93ixpDF71253112531epcas5p1C; Tue, 6 Jun 2023 04:28:53 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id C0.20.16380.506BE746; Tue, 6 Jun 2023 13:28:53 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20230606042825epcas5p13579e5999f3cc7d9d517e4c3040cf16a~l93I0AwP13091830918epcas5p1L; Tue, 6 Jun 2023 04:28:25 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230606042825epsmtrp2cb817c1a199f5c88475a67440fe32948~l93IyvrUk2695426954epsmtrp2D; Tue, 6 Jun 2023 04:28:25 +0000 (GMT) X-AuditID: b6c32a4b-7dffd70000013ffc-92-647eb6056101 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2A.13.28392.9E5BE746; Tue, 6 Jun 2023 13:28:25 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230606042820epsmtip16722489e7417b5f23335c78b840607b7~l93D9PBdA1823818238epsmtip1m; Tue, 6 Jun 2023 04:28:20 +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 v4 3/3] kallsyms: make kallsyms_show_value() as generic function Date: Tue, 6 Jun 2023 09:58:02 +0530 Message-Id: <20230606042802.508954-3-maninder1.s@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230606042802.508954-1-maninder1.s@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0yTZxTG8363li4ln9CFF8iYqXIpatl0y95dVGKc+5wxIWaZbppplS/A BCQtoNuSQbXBFMalDqZtuW44SmUDukJouUlb08BwCAsTBDemEBwFpQVUwM5RPsj87znn/J7z 5Lx5+XjANSqEn5SazspTZcliSkA02yWR28jmr+Nfs034oSGbkkBPlvU4ml8c4aE6sxJDcw4n hVx2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vpTydqZD6fo/KrZ1Z3nZjU1hvts6eeJTDJHy8ROfl2oekF6z6qrN8W3rNayPzZN1VH7mqv/ CjmjZX2coqrCSRMX567neWbkHdiTcsF25cf38edvOrhLK7EUZyQaajEXFScCAHYi7llwAwAA X-CMS-MailID: 20230606042825epcas5p13579e5999f3cc7d9d517e4c3040cf16a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20230606042825epcas5p13579e5999f3cc7d9d517e4c3040cf16a References: <20230606042802.508954-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,URIBL_BLOCKED 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/ksyms_common.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/ksyms_common.c b/kernel/ksyms_common.c index e776f12f0f5a..9603bbef095c 100644 --- a/kernel/ksyms_common.c +++ b/kernel/ksyms_common.c @@ -6,7 +6,6 @@ #include #include -#ifdef CONFIG_KALLSYMS static inline int kallsyms_for_perf(void) { #ifdef CONFIG_PERF_EVENTS @@ -42,4 +41,3 @@ bool kallsyms_show_value(const struct cred *cred) return false; } } -#endif -- 2.17.1