Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3606533imw; Mon, 18 Jul 2022 11:05:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1upQ3Rj31n8KFL+DGWs2wkKx8UGAVLmdfReh3+80iWvQ08mlfKBtW+SKdph6b9FqJU4oE98 X-Received: by 2002:a17:90b:3942:b0:1ef:9fcd:f8eb with SMTP id oe2-20020a17090b394200b001ef9fcdf8ebmr38782616pjb.10.1658167517875; Mon, 18 Jul 2022 11:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658167517; cv=none; d=google.com; s=arc-20160816; b=tTHcQzlUQzOIzkO12tD3QYKrgFpIJSeXobET93B0pAWU/gPYdxjIN40HivWRs95zWC nQMue7j0Ml8i7n0vyjANy88s5brq2d+CkkcC9ol25++BwbFDfH94XMEjLlieEv8RMd2R BXEBt4X+krS3AsMRN6h4FrADlHJG6jZKsC7gLzw0vwfBlF8DRbOKG0HWaXZSEgyh4FbQ 3w1zxnFX/rZWgA2wKjosmN548xfMh+7HEX0jARnf3y6ThIPfFpBXfbC0KBKVGvEjrNe1 V48+noxTSb5akOsG+aNom8OubmGThcZoz4Zv5IyWyNGnFAHTEqzHMsyomMnsHGKfs3Uv 1H2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+GhSiJA8jNsER0UOznMgRktrQLMwzPG3Lkdw+33iL48=; b=Ij2C71D+BMCESmp5cMy19N8hptBc2qU4Yvtq9hYtSLFEzga2ffaHi9n3+UKXrFKIJY c5V/MsuSL/wrU+q0LoFjH7tOMQ47hqzMjw2d2QimbKG9ogj6v685VX0W0Syw7inJjQAz K1p6b2XK+EBFuElfp8MWUunR8u8d3AkxgBXoxelu02cyzdkotM1H7GKCKgJr5zZPODn2 vumUnk7yjylmfNUuvcQ/QosLdU9WoYmpxJQTztPuyM5WF7LSBzvofeN9gDrTK/SJXgrU MY7cjHJqlWOssYVANouD1NIkDi1Yjv22Tr62zquB+xIscbhelQR/qTkU3lwcB4xtlIIM DfJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DVpMJwQk; 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 a20-20020a634d14000000b004116bc7daf2si14708615pgb.562.2022.07.18.11.04.55; Mon, 18 Jul 2022 11:05:17 -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=DVpMJwQk; 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 S235821AbiGRRdH (ORCPT + 99 others); Mon, 18 Jul 2022 13:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbiGRRdG (ORCPT ); Mon, 18 Jul 2022 13:33:06 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 250962CE0D for ; Mon, 18 Jul 2022 10:33:05 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id id17so474311wmb.1 for ; Mon, 18 Jul 2022 10:33:05 -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; bh=+GhSiJA8jNsER0UOznMgRktrQLMwzPG3Lkdw+33iL48=; b=DVpMJwQkF5I84C5a0bD/n0SGDKhI8JmAiylD9fmz59B8jFXrW5DzKsxyYiuwdhGLvm K4gULiPfi6uauHtwJd2OIRawraFt+4S6N4KPFQEXI0286+Iz5uri3jFYjtWo7UNzRDbq WO/sHs2EbpJKexJf2/tIF2biRfjE38wrxW6d0gZkNTo64HJbndH7E73QqrQQbQSXP8IW +2es2frz9Bo5NJ4Ed4m92YziZGBbbEVM0o9C24Sru2nHI1xnBwSVrqYMNffmWR61pa9D 12jZHHKA2uzOcv8qjjqzDwaga2LDQK5UYlTyUy8DbMjzhxEGoWrK4gduH418liVMZ7We plfA== 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; bh=+GhSiJA8jNsER0UOznMgRktrQLMwzPG3Lkdw+33iL48=; b=6fEcRtFd25AaCkmEsu1e+cO0IwELKt0SuO4JIE+7aCORrgtoO1axjcoNWZZDqdFKtc ivMUfDpIajWIz2xH95anaAHiUMcDOH8+a5YWqRUxHsNGqJSUqAXto3pkx8pV8dmKtfd4 IVnDgknizT3ReZLXLu/x1F9BZ9hgMd9BkJYPmFgvWEB4miVR5ylu6fCRDzAg+hNG4m14 P6DUniZoqd0R1s8kB76VF7oBBHltMoID68U61oJGo/pWio3gqWURCtWoK1zwL/UmxrXb qyveA4tE7u6MkWtKomo6SLm7oFLUBTQJnmx+gVxWAPt4gz0PN2nbVhxbn8AIP46nPC7y aTOw== X-Gm-Message-State: AJIora9Tb0rCbotJAaVF6lA1IvLck0nVI2RGiRXRyPAgNH9iLe+ql5EN e2q7kp387N/WwHymwUVYSF89SiVOemeizIlqtu1hyA== X-Received: by 2002:a1c:7213:0:b0:3a3:155a:dd5d with SMTP id n19-20020a1c7213000000b003a3155add5dmr9625060wmc.178.1658165583538; Mon, 18 Jul 2022 10:33:03 -0700 (PDT) MIME-Version: 1.0 References: <20220715061027.1612149-1-kaleshsingh@google.com> <20220715061027.1612149-13-kaleshsingh@google.com> <87tu7ezrso.wl-maz@kernel.org> In-Reply-To: <87tu7ezrso.wl-maz@kernel.org> From: Kalesh Singh Date: Mon, 18 Jul 2022 10:32:52 -0700 Message-ID: Subject: Re: [PATCH v4 12/18] KVM: arm64: Save protected-nVHE (pKVM) hyp stacktrace To: Marc Zyngier Cc: Mark Rutland , Mark Brown , "Madhavan T. Venkataraman" , Will Deacon , Quentin Perret , Fuad Tabba , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , andreyknvl@gmail.com, russell.king@oracle.com, vincenzo.frascino@arm.com, Masami Hiramatsu , Alexei Starovoitov , Andrew Jones , Kefeng Wang , Marco Elver , Keir Fraser , Zenghui Yu , Ard Biesheuvel , Oliver Upton , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , kvmarm , LKML , android-mm@google.com, "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" 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, 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, Jul 18, 2022 at 2:36 AM Marc Zyngier wrote: > > 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. Ahh, there are a few other always inline *unwind_init* functions that use this. I'll update in the next version. Thanks, Kalesh > > Thanks, > > M. > > -- > Without deviation from the norm, progress is not possible.