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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3671FC433F5 for ; Fri, 8 Apr 2022 20:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239376AbiDHUIx (ORCPT ); Fri, 8 Apr 2022 16:08:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232479AbiDHUIv (ORCPT ); Fri, 8 Apr 2022 16:08:51 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6825353A99 for ; Fri, 8 Apr 2022 13:06:46 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id e4-20020a056902034400b00633691534d5so7521590ybs.7 for ; Fri, 08 Apr 2022 13:06:46 -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=YMe3PswfejdLgJcOM+IwePz8bwgUsFhWIzC+X7TRk74=; b=SDDZXBLIrGsW+et2Gk7b5lo7cEr1tJz/aR/cf3Ij4+ew35M0VT5KBR5KSGpmpjWNs0 t//I6PG91dmLQ0L+GdOs4DwU1OMe/Yx/qSbV1k+7vZXFzx0QN0lXXF/ixYjhR6PWOIQr TC/ECs0qk7HJ+kjf1KaePs3tnhpyqqwGpVGAOFK7RDKhHd//d00+yQtTVz+GbcUMjapS AEH8oI4W4DR8MfAuz6MzB3DsLtsTCcGT4X1Nv3ztd4QU1eun1xaJ2Oc64ok+h3V7kGye tN1MF+NuBtLwdfT4tEm/Hj+1ZFpWvjHUKG96fLQaAeenDWrFjcYU8knrJIHYkDWJf2H9 ufVA== 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=YMe3PswfejdLgJcOM+IwePz8bwgUsFhWIzC+X7TRk74=; b=NO4KxP5gMFjPgZdC8sstjlfmbecFmRzoQwJs7H0nmoUzrg5hHYR1y8vxzTDgkmae4V MmPxvYCXIZg/Jhv++6ATIrdkrNq6MHrNK9uNzUbKnEIXWBryHrl5fmkWv2UjWU7MMIyt FWw8q7rsjFQN3SFB63hkW/tvl5O13gc6CQxtNTE+ZZTisHg/njeiCADHiwZbRGjUB0av GQSwTA3Bcj2qtAM+Gb96aVKpSSjbaEc9jL6yGS4atQuD9hsFldjXglDEmnuOlL9VnN13 La8YytHg/J6wE5gFSiCT2glAnTuqZLdSgZcHr7VGUC39bM5yP17n2LQQ8T+TbW4DL5HL vG0w== X-Gm-Message-State: AOAM531hATgxFSD39kglQxADwcZ8eUavlWHZZXhAJI8ydfXZTkUPW1wc qg5v7b+dOZQNG1NeJQ7U6/hINPSBofxYQHuSNg== X-Google-Smtp-Source: ABdhPJz7Xbg+YMlZC29IRqjeFluZOMCZUAs3P4FohGI67MZiTVA+Oxev9PNRndMoOAcC1cQHGV4y5em9Xs6NahFteg== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:f0ed:c8a:dab7:ecc2]) (user=kaleshsingh job=sendgmr) by 2002:a25:9845:0:b0:628:99a6:55ed with SMTP id k5-20020a259845000000b0062899a655edmr15089978ybo.221.1649448406098; Fri, 08 Apr 2022 13:06:46 -0700 (PDT) Date: Fri, 8 Apr 2022 13:03:29 -0700 In-Reply-To: <20220408200349.1529080-1-kaleshsingh@google.com> Message-Id: <20220408200349.1529080-7-kaleshsingh@google.com> Mime-Version: 1.0 References: <20220408200349.1529080-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v7 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 , 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 Content-Type: text/plain; charset="UTF-8" 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 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_", -- 2.35.1.1178.g4f1659d476-goog 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28047C433F5 for ; Fri, 8 Apr 2022 20:06:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C656D4B131; Fri, 8 Apr 2022 16:06:52 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OM3ziGsHFiFs; Fri, 8 Apr 2022 16:06:48 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CD7C74B216; Fri, 8 Apr 2022 16:06:48 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 992C94B216 for ; Fri, 8 Apr 2022 16:06:47 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eIff-ljfo1XW for ; Fri, 8 Apr 2022 16:06:46 -0400 (EDT) Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 8C43B4B20A for ; Fri, 8 Apr 2022 16:06:46 -0400 (EDT) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-2dc7bdd666fso84856417b3.7 for ; Fri, 08 Apr 2022 13:06:46 -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=YMe3PswfejdLgJcOM+IwePz8bwgUsFhWIzC+X7TRk74=; b=SDDZXBLIrGsW+et2Gk7b5lo7cEr1tJz/aR/cf3Ij4+ew35M0VT5KBR5KSGpmpjWNs0 t//I6PG91dmLQ0L+GdOs4DwU1OMe/Yx/qSbV1k+7vZXFzx0QN0lXXF/ixYjhR6PWOIQr TC/ECs0qk7HJ+kjf1KaePs3tnhpyqqwGpVGAOFK7RDKhHd//d00+yQtTVz+GbcUMjapS AEH8oI4W4DR8MfAuz6MzB3DsLtsTCcGT4X1Nv3ztd4QU1eun1xaJ2Oc64ok+h3V7kGye tN1MF+NuBtLwdfT4tEm/Hj+1ZFpWvjHUKG96fLQaAeenDWrFjcYU8knrJIHYkDWJf2H9 ufVA== 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=YMe3PswfejdLgJcOM+IwePz8bwgUsFhWIzC+X7TRk74=; b=VHuYV23vBRBI/duiCfhfU2j1eHTbIVs5TgpItWeHzpnhjUqj4d/Jz26CNqrjGw+1j3 ujzVcdePu/6kuCp77mvsew0U4jdOSkTv20/0Ukaug2G+gcmFwlltBSVUJBG2DOvpHkoJ MmRZqU5GdzIJQlNZkQVjSNLvJpAB81whjyEsOXeWZxGjQoT9fDQ9gr1z6QoF1ytOi/jY UzykY6NpOZAfkgr+QWpg282Z0933KIoSU22Uqq8DLEGZ+8Ebh0hDXRGPx/DAcNzMpGjL E3rqfrLAPkVVrRwJ7FMcA2TErzMalIcHjVg1MPrKiaQXE8c3K0CIn2jF3HZhUMolTPBZ iuTQ== X-Gm-Message-State: AOAM532J0tLFzzuGPCm03q5zco/GZZexa/COt4scZVgxpI8WT98rp3jC ebCaovir+qzXe+QfpDyf6RsQ3v1qxveFCAEjPQ== X-Google-Smtp-Source: ABdhPJz7Xbg+YMlZC29IRqjeFluZOMCZUAs3P4FohGI67MZiTVA+Oxev9PNRndMoOAcC1cQHGV4y5em9Xs6NahFteg== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:f0ed:c8a:dab7:ecc2]) (user=kaleshsingh job=sendgmr) by 2002:a25:9845:0:b0:628:99a6:55ed with SMTP id k5-20020a259845000000b0062899a655edmr15089978ybo.221.1649448406098; Fri, 08 Apr 2022 13:06:46 -0700 (PDT) Date: Fri, 8 Apr 2022 13:03:29 -0700 In-Reply-To: <20220408200349.1529080-1-kaleshsingh@google.com> Message-Id: <20220408200349.1529080-7-kaleshsingh@google.com> Mime-Version: 1.0 References: <20220408200349.1529080-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v7 6/6] KVM: arm64: Symbolize the nVHE HYP addresses From: Kalesh Singh Cc: Catalin Marinas , will@kernel.org, kvmarm@lists.cs.columbia.edu, Andrew Walbran , maz@kernel.org, Masahiro Yamada , kernel-team@android.com, Nathan Chancellor , linux-arm-kernel@lists.infradead.org, surenb@google.com, Nick Desaulniers , linux-kernel@vger.kernel.org, Changbin Du X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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_", -- 2.35.1.1178.g4f1659d476-goog _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 CAEAAC433F5 for ; Fri, 8 Apr 2022 20:07:59 +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:Cc:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XKIeO6D5dp4lruKlaEJ9aKFSZeV8wpvwXhG2SWzeBKs=; b=C9ikruKz3UZlkI Tex+vdDz8p/Y1snRvktMVRvFBl1F9FcQNi6FJDEvOEcUmJbjYTkdrE18HE8N1y3/R47WYvsGyA7vL j6XIPsKNVRatpTgbmvDjqlplNyuBnRP1U5oxep3FSMWzDdpc5ou8Abmimna5Thv2Q02KRsJpk9jB5 kK8zvwRXxyyPd+Jb2edypiW174yFONImhf7OBqPguiIsB9gs9wNIocqqG651VwPzgZB0rcpzQ4l9J gYQ5AtXSDK5GQfoxxxjRJCWoth0L5TKWMomamVGR4dyFnCIIeQ//JhBW5obkrj9EAXjzDUGBDJYvT YdPkXhXcqMRD8efIXung==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncusf-00192H-8i; Fri, 08 Apr 2022 20:06:53 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncusa-0018zr-Ix for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 20:06:50 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id y32-20020a25ad20000000b006339fb8e18cso7574275ybi.9 for ; Fri, 08 Apr 2022 13:06:46 -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=YMe3PswfejdLgJcOM+IwePz8bwgUsFhWIzC+X7TRk74=; b=SDDZXBLIrGsW+et2Gk7b5lo7cEr1tJz/aR/cf3Ij4+ew35M0VT5KBR5KSGpmpjWNs0 t//I6PG91dmLQ0L+GdOs4DwU1OMe/Yx/qSbV1k+7vZXFzx0QN0lXXF/ixYjhR6PWOIQr TC/ECs0qk7HJ+kjf1KaePs3tnhpyqqwGpVGAOFK7RDKhHd//d00+yQtTVz+GbcUMjapS AEH8oI4W4DR8MfAuz6MzB3DsLtsTCcGT4X1Nv3ztd4QU1eun1xaJ2Oc64ok+h3V7kGye tN1MF+NuBtLwdfT4tEm/Hj+1ZFpWvjHUKG96fLQaAeenDWrFjcYU8knrJIHYkDWJf2H9 ufVA== 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=YMe3PswfejdLgJcOM+IwePz8bwgUsFhWIzC+X7TRk74=; b=ttsjlKDOeQIIM+rYnAUs5dC0Ot8N1kKMnCGIVLs+9hfNUQADWs1PIPEq9NmH/BZDsQ 2XL5udOzKnlbfG0/9IPAMcIOJ5VesV+iaZNe1uVT400n6WWuPV68z2qUjL6mfJxk3c8h /T1ib6rRU9Iz9u5DhNH25aAdDFjJdkoXYUBOvEAjLf6IhJVkgTfmly6jUIn33IaJQT14 Pp/rT0KiqkxDA65HriJhZseJELaqGmP7U82uwjVgwpZu4jwdt4F8cDYW1RqZn46QiZ4h XmIi20jx65QY5fYi9sKlF6Driist1lw8BvGCp0BVzJv11bqw7jnEdEWPyHjR2TrdOXvj y76Q== X-Gm-Message-State: AOAM531Ya2fBPYHMy2pzeIBsnAh2tGmY1CgDF6TTOaG1Y4oDUGstOvY1 0PtC8YWBncIIFrJUc67fvLkqi2Ks36y1ykrJFQ== X-Google-Smtp-Source: ABdhPJz7Xbg+YMlZC29IRqjeFluZOMCZUAs3P4FohGI67MZiTVA+Oxev9PNRndMoOAcC1cQHGV4y5em9Xs6NahFteg== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:f0ed:c8a:dab7:ecc2]) (user=kaleshsingh job=sendgmr) by 2002:a25:9845:0:b0:628:99a6:55ed with SMTP id k5-20020a259845000000b0062899a655edmr15089978ybo.221.1649448406098; Fri, 08 Apr 2022 13:06:46 -0700 (PDT) Date: Fri, 8 Apr 2022 13:03:29 -0700 In-Reply-To: <20220408200349.1529080-1-kaleshsingh@google.com> Message-Id: <20220408200349.1529080-7-kaleshsingh@google.com> Mime-Version: 1.0 References: <20220408200349.1529080-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v7 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 , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_130648_668657_5C1F0655 X-CRM114-Status: GOOD ( 15.43 ) 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 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_", -- 2.35.1.1178.g4f1659d476-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel