From mboxrd@z Thu Jan 1 00:00:00 1970 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 E054BC433F5 for ; Mon, 18 Apr 2022 10:18:09 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NpHN3I27rxkLd0Z9Jmkz40gIYScAs8Tc0ENziiCpxKQ=; b=G5KkPkdqRBQwIC tAjo3cVhDXwuMgvPHgRLTgGRtaYYvUyddTmeYAtjpmcq41JT2T6u2/di7ctTb9MNRtZBETuwDcUsB 3q/exdJ598Dmp0Io0PQD0VgCoNC8XlX4zJmH226TgjQr7h0qKsYE3oV4SeWvt9Rthrs9rG1zHOyu9 xGqLaeRfVrkLYgtzV2XuH1EUPN2doBiBEVUSqeyWBWdOV45oqNJGrTNZh7et5/Y4JLzn4+7hLAngD IT+KgvoXgmKAHHTyukaZMTZMkFiFw0D06K5Z5cKBw7ShnTqULuiG7i6wE0iSY6kkAT8n3WhixmSBd C1yqrhkWyf2aUibsxvFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngORJ-00GGiz-Gi; Mon, 18 Apr 2022 10:17:01 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngORF-00GGi8-Lc for linux-arm-kernel@lists.infradead.org; Mon, 18 Apr 2022 10:16:59 +0000 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 1EFABB80E6C; Mon, 18 Apr 2022 10:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC422C385A1; Mon, 18 Apr 2022 10:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650277014; bh=sn8LtADJr/kuHONig4ALQa+jzV9bRZPgGffWgVWEgOw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UWd35W7euxaP8Y9oD7A4JbjYyeF2p+ai9Z11MtDfn9Ua/l0kgpuBuhJdif2nXWWNg pMCEBHklHFjAYX6QEsZWZfEX3nXhxIlbqtTkF2BTl+WRqIocpo8chDAf0RNI9yxxF1 tyYvU+ZDAjaH8CmyHEy/zY00q3kA1fvfGsPUv73ZDed6f62mcwc3OC2bvErxzcIdyB 8V2x6/A+V7Gl4c9xo/CgTtXEOR/j1ckisKjETdJqoy3oNEv2PtJPFwDPyr8wxeTGU4 ruEiWyRdGSM2rrB/zpBsPA1fuwsIiZQ14fSwQDzZDHRHJOfK4SQVSGVfQQhrfXcqM7 JdOdgJfFTV81A== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ngOR8-004yl0-Eg; Mon, 18 Apr 2022 11:16:51 +0100 Date: Mon, 18 Apr 2022 11:16:50 +0100 Message-ID: <87tuaqae7h.wl-maz@kernel.org> From: Marc Zyngier To: Kalesh Singh Cc: will@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, kernel-team@android.com, James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Andrew Walbran , Mark Rutland , Ard Biesheuvel , Andrew Jones , Nathan Chancellor , Masahiro Yamada , Nick Desaulniers , Changbin Du , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 6/6] KVM: arm64: Symbolize the nVHE HYP addresses In-Reply-To: <20220408200349.1529080-7-kaleshsingh@google.com> References: <20220408200349.1529080-1-kaleshsingh@google.com> <20220408200349.1529080-7-kaleshsingh@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kaleshsingh@google.com, will@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, kernel-team@android.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, qwandor@google.com, mark.rutland@arm.com, ardb@kernel.org, drjones@redhat.com, nathan@kernel.org, masahiroy@kernel.org, ndesaulniers@google.com, changbin.du@intel.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220418_031658_041665_61E97B9E X-CRM114-Status: GOOD ( 29.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 08 Apr 2022 21:03:29 +0100, Kalesh Singh wrote: > > Reintroduce the __kvm_nvhe_ symbols in kallsyms, ignoring the local > symbols in this namespace. The local symbols are not informative and > can cause aliasing issues when symbolizing the addresses. > > With the necessary symbols now in kallsyms we can symbolize nVHE > addresses using the %p print format specifier: > > [ 98.916444][ T426] kvm [426]: nVHE hyp panic at: [] __kvm_nvhe_overflow_stack+0x8/0x34! > > Signed-off-by: Kalesh Singh > Tested-by: Fuad Tabba > Reviewed-by: Fuad Tabba > --- > > Changes in v6: > - Add Fuad's Reviewed-by and Tested-by tags. > > Changes in v2: > - Fix printk warnings - %p expects (void *) > > > arch/arm64/kvm/handle_exit.c | 13 +++++-------- > scripts/kallsyms.c | 2 +- > 2 files changed, 6 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > index 97fe14aab1a3..a377b871bf58 100644 > --- a/arch/arm64/kvm/handle_exit.c > +++ b/arch/arm64/kvm/handle_exit.c > @@ -295,13 +295,8 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr, > u64 elr_in_kimg = __phys_to_kimg(elr_phys); > u64 hyp_offset = elr_in_kimg - kaslr_offset() - elr_virt; > u64 mode = spsr & PSR_MODE_MASK; > + u64 panic_addr = elr_virt + hyp_offset; > > - /* > - * The nVHE hyp symbols are not included by kallsyms to avoid issues > - * with aliasing. That means that the symbols cannot be printed with the > - * "%pS" format specifier, so fall back to the vmlinux address if > - * there's no better option. > - */ > if (mode != PSR_MODE_EL2t && mode != PSR_MODE_EL2h) { > kvm_err("Invalid host exception to nVHE hyp!\n"); > } else if (ESR_ELx_EC(esr) == ESR_ELx_EC_BRK64 && > @@ -321,9 +316,11 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr, > if (file) > kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line); > else > - kvm_err("nVHE hyp BUG at: %016llx!\n", elr_virt + hyp_offset); > + kvm_err("nVHE hyp BUG at: [<%016llx>] %pB!\n", panic_addr, > + (void *)panic_addr); > } else { > - kvm_err("nVHE hyp panic at: %016llx!\n", elr_virt + hyp_offset); > + kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_addr, > + (void *)panic_addr); > } > > /* > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > index 8caabddf817c..ad2c93640a92 100644 > --- a/scripts/kallsyms.c > +++ b/scripts/kallsyms.c > @@ -111,7 +111,7 @@ static bool is_ignored_symbol(const char *name, char type) > ".L", /* local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. */ > "__crc_", /* modversions */ > "__efistub_", /* arm64 EFI stub namespace */ > - "__kvm_nvhe_", /* arm64 non-VHE KVM namespace */ > + "__kvm_nvhe_$", /* arm64 local symbols in non-VHE KVM namespace */ > "__AArch64ADRPThunk_", /* arm64 lld */ > "__ARMV5PILongThunk_", /* arm lld */ > "__ARMV7PILongThunk_", If you are sanitising this, shouldn'tt you also apply the same rules as the rest of the kernel for non-'__-kvm_nvhe_' symbols? For example, I see a long list of .L* symbols: 0000000000000000 r __kvm_nvhe_.L144721 0000000000000090 r __kvm_nvhe_.L144721 00000000000000b4 r __kvm_nvhe_.L144721 00000000000004b0 r __kvm_nvhe_.L144721 000000000000051c r __kvm_nvhe_.L144721 0000000000000650 r __kvm_nvhe_.L144721 0000000000000694 r __kvm_nvhe_.L144721 0000000000000761 r __kvm_nvhe_.L144721 00000000000007a7 r __kvm_nvhe_.L144721 00000000000007c7 r __kvm_nvhe_.L144721 0000000000000814 r __kvm_nvhe_.L144721 0000000000000b08 r __kvm_nvhe_.L144721 0000000000003200 r __kvm_nvhe_.L144721 (83 of them in total on a local build) that I think should also be trimmed. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel