Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3698044pxb; Tue, 19 Apr 2022 08:09:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2PtlwSynURhc9q4utor/+ei+hF8fgEVlyvYlIRlK+dTDbyspA2W/Zx3X2sbKXc8TRMNFC X-Received: by 2002:a62:6c6:0:b0:505:6713:d584 with SMTP id 189-20020a6206c6000000b005056713d584mr18156933pfg.24.1650380948294; Tue, 19 Apr 2022 08:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650380948; cv=none; d=google.com; s=arc-20160816; b=JYUk19uGmhnSckM2nG8LeIHGIBN8SU77D6Taxp0r86cwbKxdauu61sIC73Mir7tBZc 2gUz39K4/e54L+g7w7p2e2ylSJ0kbxXctX8CqPMqXHU5oEq9K9Ts+vA+b4cibzW3+b0W 1M9Yn2cdm91LOcJULMuO055r2kznOdkAeYy8hmIZsD8eQz+hD9VHHVetgBIlQxb+vZrR Q8RNCq09L4fVrpKM7zjUoL58BWiC8MI75fx9UotnpkASTjGoXNy2Vbl6j8ruzBscrqth VTJyfR5knNDYVVhiIn4DXr/S5kqzGMmjdyHFPsDcODJ2ZFImSo0qJOv8sGyyoTtut7O6 5V5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NaZKghXfb3DoOx4eVJC6+gBDrMqsAj++iAp6qrZ51XE=; b=uEA9KYiMHKfII+j0w1j4suhyTTnFrn2/pWhGd467BvBQnEp4XjkzwHNqgWxkt2DVRd SXF2O85yXIPTyhjG710cmYto/foa1HyUvEcxhLOLTBJHcyvd0L6y4f07m9XtSK9o+RTJ Sy1EWo0/iF2LvhZbLhGpJTkkVsC3BKTLFiGMjRXrhj5QTg3WPqhYHYfU7hWeA3Wxhogo a5iPjuk24Y2ukly9BCydRjsbl53QXmyijcq1jVP/VqbLJPT7Em5Jze4v483iNyQ+CChV 0Uf9KG7xMlDjrFTZE78KK9cWF7w9R/Dg98zIpBEVIICoV2vpTt7hRniMYCKs75e2SU/F pjrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IOIawwux; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a170902c94f00b00153b2d16657si12229451pla.607.2022.04.19.08.08.43; Tue, 19 Apr 2022 08:09:08 -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=@google.com header.s=20210112 header.b=IOIawwux; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345052AbiDSCp1 (ORCPT + 99 others); Mon, 18 Apr 2022 22:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiDSCpZ (ORCPT ); Mon, 18 Apr 2022 22:45:25 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD2041DA65 for ; Mon, 18 Apr 2022 19:42:43 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id b19so20548886wrh.11 for ; Mon, 18 Apr 2022 19:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NaZKghXfb3DoOx4eVJC6+gBDrMqsAj++iAp6qrZ51XE=; b=IOIawwuxeBpnPEW4muE+XmTP8tzJk+lOOZEPTVzGnnqkLERhpykUDERNuCeJW3dVWg F2fDXw4eW11ZRZ5O9TthYSN0mD67aAmgu8DVvp2E9JLQVJqa1jgm9s4vfF5w9amWFiWr s6v5e19V488KeCa61wXdMxsctCCtoRmaenKJKaPPlloMlSrxMXlwzDzmYDtQY5C2YsxM 4lW/gEU1+nWPyqqg0ks5HwcAeQj/MpcAdfDy4UUFPpvKuahhdYdPjab3mvGFWVEMK0ne kAKhEeDMA20ZxRhIwrufTTknIPRk3Qf+MDIXPC46uwTSUxq7HP/4e023CZey2PT8PFSp iLNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NaZKghXfb3DoOx4eVJC6+gBDrMqsAj++iAp6qrZ51XE=; b=E/TtAU9AwuMNeUxGuzvX0bujHqS4aC5AY5O3g0mykurQrhU5v3cYnuIRqgYOBi7x9J JXsfm21yXV8AEd7HdsUnlSwfMScocBKLy2NU2hO9WcKMHFLYsS57NDLNt+qKFuk/1HTp 2dpMU5uGSGfxX4/zPpKiBS0QyIvLQWxHv/y6gWJdbbgHh76nYgpksaDm55shUbLASegI n750ZDc/PS67fn2DsEV1j3PjJ3rrgfOoAbjkpUcI1ZmuSyj75uUxH5ftAFEYaybo7KOt VYVYyZZ7ie1UpstWQNPcczLgAo5L/btw9YivVYLyLH6r2pYJBWZIFrMNsv643h4w8n/4 287g== X-Gm-Message-State: AOAM531TBUi72IiFlFqZBEt63HDlsmIFhHEdsAdep8CTimJzmMZm5AKi hW6GpT4JpasW3VXqLbxJQ8lrj8n8WaAN01QkyJkuXg== X-Received: by 2002:a5d:5487:0:b0:20a:8f45:8f34 with SMTP id h7-20020a5d5487000000b0020a8f458f34mr7573081wrv.699.1650336162246; Mon, 18 Apr 2022 19:42:42 -0700 (PDT) MIME-Version: 1.0 References: <20220408200349.1529080-1-kaleshsingh@google.com> <20220408200349.1529080-7-kaleshsingh@google.com> <87tuaqae7h.wl-maz@kernel.org> In-Reply-To: <87tuaqae7h.wl-maz@kernel.org> From: Kalesh Singh Date: Mon, 18 Apr 2022 19:42:31 -0700 Message-ID: Subject: Re: [PATCH v7 6/6] KVM: arm64: Symbolize the nVHE HYP addresses To: Marc Zyngier Cc: Will Deacon , Quentin Perret , Fuad Tabba , Suren Baghdasaryan , "Cc: Android Kernel" , 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 , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , kvmarm , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Mon, Apr 18, 2022 at 3:16 AM Marc Zyngier wrote: > > 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 =3D __phys_to_kimg(elr_phys); > > u64 hyp_offset =3D elr_in_kimg - kaslr_offset() - elr_virt; > > u64 mode =3D spsr & PSR_MODE_MASK; > > + u64 panic_addr =3D elr_virt + hyp_offset; > > > > - /* > > - * The nVHE hyp symbols are not included by kallsyms to avoid iss= ues > > - * with aliasing. That means that the symbols cannot be printed w= ith the > > - * "%pS" format specifier, so fall back to the vmlinux address if > > - * there's no better option. > > - */ > > if (mode !=3D PSR_MODE_EL2t && mode !=3D PSR_MODE_EL2h) { > > kvm_err("Invalid host exception to nVHE hyp!\n"); > > } else if (ESR_ELx_EC(esr) =3D=3D 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", pa= nic_addr, > > + (void *)panic_addr); > > } else { > > - kvm_err("nVHE hyp panic at: %016llx!\n", elr_virt + hyp_o= ffset); > > + kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_ad= dr, > > + (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, cha= r 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. Good catch. I=E2=80=99ll fix it in the next version along with your other comments. Thanks for the reviews Mark. -Kalesh > > Thanks, > > M. > > -- > Without deviation from the norm, progress is not possible.