Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6677027iob; Wed, 11 May 2022 02:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/6+9MYwbIwtA5RD/oIXVsBv35A22kW9xt7+rCigdwy1pkBtL/KD9Sd7hRje1RdGE0vlRN X-Received: by 2002:a17:902:758a:b0:15e:ef4f:fed5 with SMTP id j10-20020a170902758a00b0015eef4ffed5mr23092391pll.1.1652263081318; Wed, 11 May 2022 02:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652263081; cv=none; d=google.com; s=arc-20160816; b=WnWQVk7Gfom5Z8u4X+ZAqLAwAxqD8vngxecdWoFqKxMXRqFrXUBhXGxSO9WHETbfc7 q50NBF1E5fDyWCl4LxOC9rdouLoPewYeynpMPY/Fc6WTHo2fb69Zwg5V145Nhakw2e/4 YvhLKCJHwZhBqFokHfDqAR2A5yclp4xXmnZqU+pIcUqCa57H3BLv6JotC3WUiBGUjFGO Lhf8FTEC/odqkoFGz2sQ3c53glkxfBwiwAGBuT3OgFR04WE5EuRJNvFdIYVWCvnDQKYT QUoHRu9fvQzB5ZeEAnASyhnY9BkR8POiBiJ0d9WTmjeOY/fg+tkRRLiqCc0aStqtMHDr HPiA== 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=hYuYJE8BwycrFmnXxWX4i3trO1jS9jYV/ZuxbJi1tKQ=; b=jnkqjpe0kTYHfIm845nLDotjTt/QGuYh/grBI6ChcpRJZKscitMQ05yDf5/iWfWfmn 2W9v27AjLW2TFztyRYz0uOwaFGnabe7LqqZHBNULBLOTsKvxfvlL/vyMl2avQMNghPtw a0Bbr5VXfb915VUY0kH/k6Vb8p9KpScLUwDgzX6leEJURYr+Cag2mNd2eY8nG2MPZxmI ItBrtAr2atbYTb7iomRRDTW7SMG3JL4NPNeM2ytxi5bDze1W4ZOAzQzTG24jF/ce/a6s 8/JQUVEKGx9iHtZSLos+z8b8WsoHl44VHm39B5HVXotMmT0pO8qylFFUN1RPS1nDxdNE U7GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=pNqJVx0b; 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 19-20020a170902e9d300b0015c87c872c9si1891811plk.347.2022.05.11.02.57.47; Wed, 11 May 2022 02:58:01 -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=pNqJVx0b; 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 S243412AbiEKILR (ORCPT + 99 others); Wed, 11 May 2022 04:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243328AbiEKIKw (ORCPT ); Wed, 11 May 2022 04:10:52 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B4365EE for ; Wed, 11 May 2022 01:10:46 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220511081044epoutp01117225d24c89e0e9f62e207d3c362153~t-qoDf8eY3126831268epoutp01E for ; Wed, 11 May 2022 08:10:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220511081044epoutp01117225d24c89e0e9f62e207d3c362153~t-qoDf8eY3126831268epoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1652256644; bh=hYuYJE8BwycrFmnXxWX4i3trO1jS9jYV/ZuxbJi1tKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNqJVx0bFor6YxZSH+CH5q+KunN2n6yqFFwr+hL5akzubYpefwfz2kRoCqraGT6ru 7n7NAYbVmZjT8Fr3nqpF9hh+BJhMh/oTXB0k9gs3Sgad0u3DgA9EhV3glQcV15zPVw s/e2Qdgqu2Cco7gOWb7vYXziaEZ9lxfoRjNglGF4= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20220511081043epcas5p10f5e3b2a3f8855ff9749d9e7de865b90~t-qnWbudH1267712677epcas5p1L; Wed, 11 May 2022 08:10:43 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 73.47.09827.38F6B726; Wed, 11 May 2022 17:10:43 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220511080728epcas5p2e377c38aba2e93dccc7fe8958e4724c2~t-nx_sb8M2058020580epcas5p2f; Wed, 11 May 2022 08:07:28 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220511080728epsmtrp131b4e7949cc848bea730c9146e648d1a~t-nx9cZEl1662516625epsmtrp1d; Wed, 11 May 2022 08:07:28 +0000 (GMT) X-AuditID: b6c32a4a-b3bff70000002663-b1-627b6f83abf8 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 4A.23.08924.0CE6B726; Wed, 11 May 2022 17:07:28 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220511080724epsmtip1865254a99dca147d491a5b07d63ed55b~t-ntr2NO31048910489epsmtip1v; Wed, 11 May 2022 08:07:24 +0000 (GMT) From: Maninder Singh To: mcgrof@kernel.org, avimalin@gmail.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, pmladek@suse.com, rostedt@goodmis.org, senozhatsky@chromium.org, andriy.shevchenko@linux.intel.com, naveen.n.rao@linux.ibm.com, davem@davemloft.net, mhiramat@kernel.org, anil.s.keshavamurthy@intel.com, linux@rasmusvillemoes.dk, akpm@linux-foundation.org, keescook@chromium.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, v.narang@samsung.com, Maninder Singh , Onkarnath Subject: [PATCH 2/2] kallsyms: move sprint_module_info to kallsyms_tiny.c Date: Wed, 11 May 2022 13:36:57 +0530 Message-Id: <20220511080657.3996053-2-maninder1.s@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220511080657.3996053-1-maninder1.s@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUxTVxjHc+69vfe2S9nlJXoGSJWBBrPBxtScxAamIeRKWBQ+LHHMzAJ3 wCgvaxXdXAZCx6QMKQhaS8d4cRsWBGzKhALFFSyjOhVhk4654AAtJlsodJjKxka5kPnt/zzP 7/+8nBwa92skA+ms3GOcIlcmDyVFxHeDETteLck7lfra6Rs7kL6jjURPl+twVFF8AUO9zkkC uT2TFJr6/j6FmhuXcKS/oyJQcXcLhpzzMwDdKs9Bjy0VGBoz60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WpXNPj/fsgaJODNE zjOYMFEq3WDT5Xs28WliIXfXzlq3kLkrTomlOCPRUIu5qDgRAMVlb3VmAwAA X-CMS-MailID: 20220511080728epcas5p2e377c38aba2e93dccc7fe8958e4724c2 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20220511080728epcas5p2e377c38aba2e93dccc7fe8958e4724c2 References: <20220511080657.3996053-1-maninder1.s@samsung.com> X-Spam-Status: No, score=-5.0 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 As previous patch makes new file for generic kallsyms (always compilable), move sprint_module_info module to new file kallsyms_tiny.c no functional change with this commit Co-developed-by: Onkarnath Signed-off-by: Onkarnath Signed-off-by: Maninder Singh --- include/linux/kallsyms.h | 11 +++++++++ kernel/kallsyms_tiny.c | 47 +++++++++++++++++++++++++++++++++++ lib/vsprintf.c | 53 ---------------------------------------- 3 files changed, 58 insertions(+), 53 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index c5e63a217404..95a2f4ade996 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -27,6 +27,17 @@ struct module; /* How and when do we show kallsyms values? */ extern bool kallsyms_show_value(const struct cred *cred); +#if !defined(CONFIG_KALLSYMS) && defined(CONFIG_MODULES) +extern int sprint_module_info(char *buf, unsigned long value, + int modbuildid, int backtrace, int symbol); +#else +static inline int sprint_module_info(char *buf, unsigned long value, + int modbuildid, int backtrace, int symbol) +{ + return 0; +} +#endif + static inline int is_kernel_text(unsigned long addr) { if (__is_kernel_text(addr)) diff --git a/kernel/kallsyms_tiny.c b/kernel/kallsyms_tiny.c index 96ad06836126..8ed9fdd7d9f7 100644 --- a/kernel/kallsyms_tiny.c +++ b/kernel/kallsyms_tiny.c @@ -49,3 +49,50 @@ bool kallsyms_show_value(const struct cred *cred) return false; } } + +#if !defined(CONFIG_KALLSYMS) && defined(CONFIG_MODULES) +int sprint_module_info(char *buf, unsigned long value, + int modbuildid, int backtrace, int symbol) +{ + struct module *mod; + unsigned long offset; + void *base; + char *modname; + int len; + const unsigned char *buildid = NULL; + bool add_offset; + + if (is_ksym_addr(value)) + return 0; + + if (backtrace || symbol) + add_offset = true; + else + add_offset = false; + + preempt_disable(); + mod = __module_address(value); + if (mod) { + modname = mod->name; +#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) + if (modbuildid) + buildid = mod->build_id; +#endif + if (add_offset) { + base = mod->core_layout.base; + offset = value - (unsigned long)base; + } + } + preempt_enable(); + if (!mod) + return 0; + + /* address belongs to module */ + if (add_offset) + len = sprintf(buf, "0x%p+0x%lx", base, offset); + else + len = sprintf(buf, "0x%lx", value); + + return len + fill_name_build_id(buf, modname, modbuildid, buildid, len); +} +#endif diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 799fccca4a2d..983fdb02543c 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -999,59 +999,6 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev, } #endif -#if !defined(CONFIG_KALLSYMS) && defined(CONFIG_MODULES) -static int sprint_module_info(char *buf, unsigned long value, - int modbuildid, int backtrace, int symbol) -{ - struct module *mod; - unsigned long offset; - void *base; - char *modname; - int len; - const unsigned char *buildid = NULL; - bool add_offset; - - if (is_ksym_addr(value)) - return 0; - - if (backtrace || symbol) - add_offset = true; - else - add_offset = false; - - preempt_disable(); - mod = __module_address(value); - if (mod) { - modname = mod->name; -#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) - if (modbuildid) - buildid = mod->build_id; -#endif - if (add_offset) { - base = mod->core_layout.base; - offset = value - (unsigned long)base; - } - } - preempt_enable(); - if (!mod) - return 0; - - /* address belongs to module */ - if (add_offset) - len = sprintf(buf, "0x%p+0x%lx", base, offset); - else - len = sprintf(buf, "0x%lx", value); - - return len + fill_name_build_id(buf, modname, modbuildid, buildid, len); -} -#else -static inline int sprint_module_info(char *buf, unsigned long value, - int modbuildid, int backtrace, int symbol) -{ - return 0; -} -#endif - static noinline_for_stack char *symbol_string(char *buf, char *end, void *ptr, struct printf_spec spec, const char *fmt) -- 2.17.1