From patchwork Sun Jul 17 04:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianting Tian X-Patchwork-Id: 12920428 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA652C43334 for ; Sun, 17 Jul 2022 04:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oyXsHUMyZ4ne63CUqUIBlxmsnVNnSzgYPrT2FDhwjWU=; b=w8QLixee3RkPHw gv9OswWq/m6QT9BTTXrXSyMkMeMzoylgQHdtoLCcv1AlWawapkeBI84li0E5pBFA5RLiP5F7o8jEM MWVGEp4cvjKU6VuRAmWdfjU6KMOT2zjRVcm7qIB9rnDYrUu9aDDGPnEWAsZhB3mO5G9fZcS/fYcim dYxAYymE154imvWP1hi9PNLqdkgwo/jLS1WLvvnUj8yd7cAcr+O5DPP5IRYc0aikS/1Ftb2fQvWch kwm5t/Vv4a7PRuTRo+kafYB2JnTMT+Xj20IEKKfsR81VWCyOoFicm1phIzfcUghgqdGqX22JEB5az 9lJ+yudNF6nxHarF8TIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCvuk-0040Et-5u; Sun, 17 Jul 2022 04:29:54 +0000 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCvub-004090-Po for linux-riscv@lists.infradead.org; Sun, 17 Jul 2022 04:29:48 +0000 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0VJWzCBC_1658032180; Received: from localhost(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0VJWzCBC_1658032180) by smtp.aliyun-inc.com; Sun, 17 Jul 2022 12:29:40 +0800 From: Xianting Tian To: crash-utility@redhat.com, mick@ics.forth.gr, heinrich.schuchardt@canonical.com, guoren@kernel.org, k-hagio-ab@nec.com Cc: linux-riscv@lists.infradead.org, hschauhan@nulltrace.org, huanyi.xj@alibaba-inc.com, Xianting Tian Subject: [PATCH 8/8] RISCV64: Add the implementation of symbol verify Date: Sun, 17 Jul 2022 12:29:29 +0800 Message-Id: <20220717042929.370022-9-xianting.tian@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220717042929.370022-1-xianting.tian@linux.alibaba.com> References: <20220717042929.370022-1-xianting.tian@linux.alibaba.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220716_212946_449004_FC6287BA X-CRM114-Status: UNSURE ( 7.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Verify the symbol to accept or reject a symbol from the kernel namelist. Signed-off-by: Xianting Tian --- riscv64.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/riscv64.c b/riscv64.c index cbf75cf..04064df 100644 --- a/riscv64.c +++ b/riscv64.c @@ -188,11 +188,20 @@ riscv64_cmd_mach(void) riscv64_display_machine_stats(); } +/* + * Accept or reject a symbol from the kernel namelist. + */ static int riscv64_verify_symbol(const char *name, ulong value, char type) { - /* TODO: */ - return TRUE; + if (CRASHDEBUG(8) && name && strlen(name)) + fprintf(fp, "%08lx %s\n", value, name); + + if (STREQ(name, "_text") || STREQ(name, "_stext")) + machdep->flags |= KSYMS_START; + + return (name && strlen(name) && (machdep->flags & KSYMS_START) && + !STRNEQ(name, "__func__.") && !STRNEQ(name, "__crc_")); } void