Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2805978pxb; Mon, 18 Apr 2022 08:37:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlRNTPZSEg0wsEOTneFuxoIU8GltTd3UZbcmnZYjstyZ4Q/DHpebrbKysbhonwzZTzoHff X-Received: by 2002:a17:90b:4b84:b0:1d2:add6:804c with SMTP id lr4-20020a17090b4b8400b001d2add6804cmr3464990pjb.107.1650296227435; Mon, 18 Apr 2022 08:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650296227; cv=none; d=google.com; s=arc-20160816; b=Ah2vTfLTC/B+oU9rhvL+Ei4EaYFbriGH/Q+hRcI4jGNinS9KJRo/gwg20gn+KUf26L ejvBQkRYw45WJH0DHsf3DkxflFDErsZS+486OOyNHJlMvsutMqhcjslo08z9lQOFmIjy wmlMK18chS2Xed9ZC4/wosxCYSFBdpmbP1xnfwh+saSgTsTi6gm1Y5K9RKB9Qdmtr73c YOC3ZQ8zYlWUSzzW1+Uecg8t9starJcyR7fmMxmwdvI7gNNI0dRTARnYtl3lgva1moKX RiSB6rOn3JCpcNYDM1bAqxgToF8+97de+R9n3XY/wFGznAUUIS407mIb3k6CvEjghdXY 8jhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=8pWAN1FTUiiqrDCn0q89HLVwHaehfODq7kFZ2Zqufnw=; b=kupXFTdb+w3t7ESYXhDw+WeVEd2O4Rpz2tbI/k3dfGJtFvW0KCbv9jRkkD0NccKhbS evIzKwYgTlspxI0kfKACR0PXL7GJXmcZfzo+YFgVBZnYhjG5yfnndu/a0/XGfK1obyXU gYC31/ytxII053Sq57aQQFvD5kuGS7AJiEIq3xAM+KW3uqveNgeMjR7URafem7xGgPtB /1VkI9lT6Bm5sx/zmieFuZqOhMyabPcIgd3T9CqWFzAcLFP0f1Ue1zVvh5Q0XfJMYGIn BwQ+jsp9ENWJMvjxWTAh/rGl2i3VFLEn13Y6LukpEjgkeFAWdXhHyRQbO51qYKEYxiPP m2hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UWd35W7e; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a170902aa9500b00158d1f2d451si8419811plr.45.2022.04.18.08.36.49; Mon, 18 Apr 2022 08:37:07 -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=@kernel.org header.s=k20201202 header.b=UWd35W7e; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237622AbiDRKTf (ORCPT + 99 others); Mon, 18 Apr 2022 06:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbiDRKTe (ORCPT ); Mon, 18 Apr 2022 06:19:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BD118E14 for ; Mon, 18 Apr 2022 03:16:55 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 63479611CC for ; Mon, 18 Apr 2022 10:16:55 +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") Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 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.