Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp887334pxb; Fri, 22 Apr 2022 13:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwOrYaAdJqx26DZw2rOivCJZgIlwIkiIGBdeqC02iftVQ+0yk4wzRg+DCBd6myGJhgpttk X-Received: by 2002:a63:fd53:0:b0:386:66d:b40c with SMTP id m19-20020a63fd53000000b00386066db40cmr5316887pgj.266.1650659317013; Fri, 22 Apr 2022 13:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650659317; cv=none; d=google.com; s=arc-20160816; b=IqDM/ZWCxLSMXcZJS7Eq/s2zgX77y4DtKcVftS//qI21xaJSKMMcPShQBEAkvYKj5U OVpu9RpcoAsNRgJ2V1TJlpTERV9b5kVe512DqevutLVmbPIZ9ghf5yUPBpnBhf55vGUT t+55UAHbCtPMdfRTCwGGlH1mlO6+6VM4CmL/iZ+RbHaNSh4cAKHROzDdpnmdE6sOtXHT nykXVV3esOiU9QuCDxN2CRfeZ+1RnNpSkrJTqHpg55MXYG19JdV5iLnkVe5WoS+gYv84 R8Q1i5U1g1RjIyyG9I2OmoI5qsp997Bi1oFZsyZ14HX/Z2m/vzlAbibqRKI9Qa7QaFAv c73A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=3TRcCUUaZ+b7tjFg88UNtO89FA4GsBVVD3ULOF8xuc0=; b=OD4Oum7ytA2oK6/NwzXB8x+ahH1Hif3zEu5uiNAmBwm9M2cv4ZpJluH3ZNV3R9tHNE utALY2s4Hk0IB6Wln6TrTOwJvk7EAjtlg8eorNxiLCJOzgBEV6JRsL8uxFIyx7CYxnzr HHNzI8X+a42g5s/vs9Mx5aRT2p7iAhI1VJUGfWQd0YGLAY/d/wB8ZHgJMTTpXENVCn94 TiBSTgKa5GbSTyA6qWiNFcF5psw9ikxsOoYrIi6h7kHknYrno+v2K6uvZLbxjQCJh9jv cQYnqvAkL/b/lWdz5/VQHFRG024Y5X8YyNg8Ss0Nv4sfBTDNTw6X4fiCFi9K0c2gwu8a HO8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fNlEbCPY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a13-20020a631a4d000000b0039800914255si9217255pgm.623.2022.04.22.13.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:28:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fNlEbCPY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 82E9C112D81; Fri, 22 Apr 2022 12:15:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380375AbiDTVtj (ORCPT + 99 others); Wed, 20 Apr 2022 17:49:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234964AbiDTVti (ORCPT ); Wed, 20 Apr 2022 17:49:38 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14AD73E5DE for ; Wed, 20 Apr 2022 14:46:51 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2f198b4e2d1so26926907b3.14 for ; Wed, 20 Apr 2022 14:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:cc; bh=3TRcCUUaZ+b7tjFg88UNtO89FA4GsBVVD3ULOF8xuc0=; b=fNlEbCPYFY/2sKN0B+7mRjKWh9Vmc0mQaldUs5//VcDe8AKIWT3mEXRG2KmS10vL5m 55EK4a6Y6SvHoEHe583jl1ltI7lA3lfGImFy/DQ2SKUpe8Irwm8RZBCCkLKpl4jwU2hE cQjtaRRrYRRRRGCWFwdlb4iNu1ZFs+3MDX+TOnItxhcue3RRUprY5La0mnX8uvo+dqjt 2Mxx/8gIDsYenMuLbEfx/0MI476D/uSdF3vFghFSAOT/mzBSXqlZchMjcvwiSaJPI+yl 685YmTacJ70CuTt+LNso67g/Cybklwhm0T5nrSbQ3W8Y2OVqVugGT8KvrofMeWv2RMV8 OYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=3TRcCUUaZ+b7tjFg88UNtO89FA4GsBVVD3ULOF8xuc0=; b=w1xXIjJn5MqcOln49PANzSevP4i6hoiM1hXI20FVDkFUpNPLQ70q3fo9M2o9+Hz8Yg BB45tJMCIQEDHw7lYNx8MTVHkwMmxNaLmVPhj1/GUOatqDFZ6k+lEE6gLyDOh5cQ66bL jJcwxO9ekTxvP5ADgrA9932TyeCNB/Q13Kq6H5XFczgyX9g0WsXFDbSkdNddRdWZZi1U t7Ktoie3EqfouVqyB3z4YoYDNdXo4dlxgtNO9DJqwMJheaimv5FtuH/CiRMqWh2suH9s XHO/Bcr/YejxyuJqHmV2QYEXsH83fjCZnQXJv80iJyTZdWt1OTjN7N+DgUkLkRARDfuX RPuw== X-Gm-Message-State: AOAM532y7EbpAosJ7wBbxWGWmEM9s500Yw9Su22Y6wlORYKqCsXbl+Kp mxoQQVOm6JxjOcPfrkELyOQTS236GkBta8P/gw== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:2a20:cec4:8f41:cd6f]) (user=kaleshsingh job=sendgmr) by 2002:a05:6902:70c:b0:645:58e:a3ac with SMTP id k12-20020a056902070c00b00645058ea3acmr17151653ybt.380.1650491210272; Wed, 20 Apr 2022 14:46:50 -0700 (PDT) Date: Wed, 20 Apr 2022 14:42:57 -0700 In-Reply-To: <20220420214317.3303360-1-kaleshsingh@google.com> Message-Id: <20220420214317.3303360-7-kaleshsingh@google.com> Mime-Version: 1.0 References: <20220420214317.3303360-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog Subject: [PATCH v8 6/6] KVM: arm64: Symbolize the nVHE HYP addresses From: Kalesh Singh Cc: will@kernel.org, maz@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, kernel-team@android.com, Kalesh Singh , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Andrew Walbran , Mark Rutland , Andrew Jones , Ard Biesheuvel , Masahiro Yamada , Nathan Chancellor , Changbin Du , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v8: - Also ignore local symbols prefixed by '.L' in KVM nvhe namespace, per Marc 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 | 3 ++- 2 files changed, 7 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..e6906f79833d 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -111,7 +111,8 @@ 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 */ + "__kvm_nvhe_.L", /* arm64 local symbols in non-VHE KVM namespace */ "__AArch64ADRPThunk_", /* arm64 lld */ "__ARMV5PILongThunk_", /* arm lld */ "__ARMV7PILongThunk_", -- 2.36.0.rc0.470.gd361397f0d-goog