Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3149147imw; Mon, 18 Jul 2022 03:03:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1toBkgIa7jMR7c3i65DfXt3nbGAcTBrTsdOFtgmXurzobnolMLHfNYMK3bfLWCs9YXinsv3 X-Received: by 2002:a17:907:2cf2:b0:72b:4a01:e8bb with SMTP id hz18-20020a1709072cf200b0072b4a01e8bbmr24965524ejc.673.1658138607849; Mon, 18 Jul 2022 03:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658138607; cv=none; d=google.com; s=arc-20160816; b=e46MSUvUmpZQq8pGsBaFPYNoqL1pV9YGwcsD4IUwcK3ayFFA68ZJ6g3htIs8bbMUI1 w5rD4PI53xn4B9dnSCzrCefEPMU2aVeKwmm3ae2S8ZbaRqcyDMH4ayqrARs284ac7lQB UE8/nDlSoowVtvUrhHKntO/s0Si0bONefQPXyTXL2NB6w6CDuiQJ3Js3LBTKGeSISp1q h1sEnonBiy5BSmsAaQasOD0ERpp+F4t4h8M6XiiGoLnu0BkhsJPHp1C315OCpo4L2vP5 QsUMNhNcf3tza/RdL2AQEliOY6S+jg9s6kk0iJ34B/Qjm7LzgqmYblWQ6u2kwrJRF9uC 1eeQ== 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=jgNPRW9hw02NVw+0p/23QKavloCKbGx8vnl1smXHoFg=; b=Tccf5tMDdy5r1hwiKIR3pZM7Nni8EvSoYlyN/j2lnmf6Stj/estq388FRWn3TPF0Dh SjPF134Lnrrdv4U+iyOcGpCfhkLpE1ypZHOa9WCQbmS4jAL5ky1Q2s7fosmSDrd6D8Cr 11edet5S46CqfczmF0ZSnm9QqQcQW8jC2nOhwG0wDfFL0RhLSPCpGlWE6UXlsDCeEHkB 4j4KAi+4lq/+VrWDPPiglQcSl60vUKVSpDmrm1GjrOPGUOVqNKPazRiW5iPBV11t1I+T qih6rXOIVtCQzYip1Tt6b2vOTniSjjUrloldQ8haDwx4VcApO+3Xq7r/GhEHmwmGpsFI 7gPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c9GrlWht; 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 nd38-20020a17090762a600b00726b031a475si14994726ejc.758.2022.07.18.03.02.55; Mon, 18 Jul 2022 03:03:27 -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=c9GrlWht; 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 S233271AbiGRJgW (ORCPT + 99 others); Mon, 18 Jul 2022 05:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233774AbiGRJgM (ORCPT ); Mon, 18 Jul 2022 05:36:12 -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 8C3C21ADA6 for ; Mon, 18 Jul 2022 02:36:11 -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 107CA614EE for ; Mon, 18 Jul 2022 09:36:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64A5CC341C8; Mon, 18 Jul 2022 09:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658136970; bh=c6Vl+AMZNcoDWWJaxFMtmHx1sXOLMMx/JcQWNmVAL2k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c9GrlWhthHbKfRrtPCKznNgcPZqHC/JfxON1RI4JoBfudVH4+XXicSbdeQ2SUfPU4 3ATmNF7sQuzLW7HfrV0wEulAVRqA0x9bua4OsKkEGkJoAQ38r0yfw4i3ESu2LBBbHr 0e7OPySSHdzrbvy1pQHALj+5C7NqEe4xWU/nROWXzkt0fkeIYmmBZBw/HUdTiQR1nw +25+0/ALVE6Ayim2mXTlUUE2qIPi8Wz7xaKg3a+AjCD433DNxpq7s1fsilPqUox9KB 9BVzWznbmIYfcyGOY9updJKcPWoLJqpVJhhP1FwQIzizMxb5jU65f9sWC9uCHZ/44V +nSOQWjjQYpgA== 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.95) (envelope-from ) id 1oDNAd-008A3w-Vi; Mon, 18 Jul 2022 10:36:08 +0100 Date: Mon, 18 Jul 2022 10:36:07 +0100 Message-ID: <87tu7ezrso.wl-maz@kernel.org> From: Marc Zyngier To: Kalesh Singh Cc: mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, will@kernel.org, qperret@google.com, tabba@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, russell.king@oracle.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, drjones@redhat.com, wangkefeng.wang@huawei.com, elver@google.com, keirf@google.com, yuzenghui@huawei.com, ardb@kernel.org, oupton@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, android-mm@google.com, kernel-team@android.com Subject: Re: [PATCH v4 12/18] KVM: arm64: Save protected-nVHE (pKVM) hyp stacktrace In-Reply-To: <20220715061027.1612149-13-kaleshsingh@google.com> References: <20220715061027.1612149-1-kaleshsingh@google.com> <20220715061027.1612149-13-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, mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, will@kernel.org, qperret@google.com, tabba@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, russell.king@oracle.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, drjones@redhat.com, wangkefeng.wang@huawei.com, elver@google.com, keirf@google.com, yuzenghui@huawei.com, ardb@kernel.org, oupton@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, android-mm@google.com, kernel-team@android.com 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.8 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 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, 15 Jul 2022 07:10:21 +0100, Kalesh Singh wrote: > > In protected nVHE mode, the host cannot access private owned hypervisor > memory. Also the hypervisor aims to remains simple to reduce the attack > surface and does not provide any printk support. > > For the above reasons, the approach taken to provide hypervisor stacktraces > in protected mode is: > 1) Unwind and save the hyp stack addresses in EL2 to a shared buffer > with the host (done in this patch). > 2) Delegate the dumping and symbolization of the addresses to the > host in EL1 (later patch in the series). > > Signed-off-by: Kalesh Singh > --- > arch/arm64/include/asm/stacktrace/nvhe.h | 18 ++++++ > arch/arm64/kvm/hyp/nvhe/stacktrace.c | 70 ++++++++++++++++++++++++ > 2 files changed, 88 insertions(+) > > diff --git a/arch/arm64/include/asm/stacktrace/nvhe.h b/arch/arm64/include/asm/stacktrace/nvhe.h > index 36cf7858ddd8..456a6ae08433 100644 > --- a/arch/arm64/include/asm/stacktrace/nvhe.h > +++ b/arch/arm64/include/asm/stacktrace/nvhe.h > @@ -21,6 +21,22 @@ > > #include > > +/** > + * kvm_nvhe_unwind_init - Start an unwind from the given nVHE HYP fp and pc > + * > + * @fp : frame pointer at which to start the unwinding. > + * @pc : program counter at which to start the unwinding. > + */ > +static __always_inline void kvm_nvhe_unwind_init(struct unwind_state *state, > + unsigned long fp, > + unsigned long pc) > +{ > + unwind_init_common(state, NULL); Huh. Be careful here. This function is only 'inline', which means it may not be really inlined. We've had tons of similar issues like this in the past, and although this will not break at runtime anymore, it will definitely stop the kernel from linking. Thanks, M. -- Without deviation from the norm, progress is not possible.