Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3462229pxb; Mon, 4 Apr 2022 17:45:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkyjx7AcJVzkULNdldr2/rsLFmylh6JA7ISrbPFpKxBVP+OEqHugrmMUCWtn+y8mEVB7A7 X-Received: by 2002:a62:e518:0:b0:4fa:9333:ddbd with SMTP id n24-20020a62e518000000b004fa9333ddbdmr850304pff.11.1649119540373; Mon, 04 Apr 2022 17:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649119540; cv=none; d=google.com; s=arc-20160816; b=b40fV2sF97l6bDxoD7b1K/RbAJkbgiG1lNAuE+Fu1LJa8Ci4HzUjV9aEbonyEGaxGi Ja6hquuBapMnG3hL9dnRlSjSe70uke26Zc3Kr8GZsq4wb4W7NhmsZRDEzVuMvVXZLG83 47Owuq+WsydHqRAh5WYsi0XlHTsKbkSIudwQBoRcm9MAIpAkBrRG+0+rdu95OIhj6ifu LfDqBX6vJYy8oM0gh8MdPSICIUbRtF+sHkYwidrxO3y8Vh6EASN2ggbiPX3Rhsp5nSpc A5p5pDTiDxCueM9M+4N6VBh3RSrtp1uNwo4Ugx4oOLJWfrrrVS+TAFalhhXfctcUexDV dnsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=085CFCikZI0ZSlSyHC8HLU/h1P8XbTcUdfdIfFSc4n0=; b=A6xX6K/cdzRg76hBagLOwAn2hnchxHOIOWEo5vJvZiytKvGvcszKysNNyK2yS5+rb9 S6JbOlT5bNFRFk7mf0Y8i/lHel2JdjxcPmu5DzXzQiEmzk5SWqjINwcJS02UbT73z57n 7KJYSgM1EGMHV1r1Yko7dhbJcRmXyv/O9/y1Ar3EjyhRk4B8lrWQnKPFoZj4bBDRAhB4 VU6utyoXqxED056VTKCtto7zKqOkESlBImdqDK2OjiSn/HxwCDMc3WLAiIcFY2SuobTP ilodT83ND4OEKKiL0duuptYJv7R4afc4/yZxaO7T3S6agAmxbWKTY2Zxi/nESLxeMTPT rCuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=OOV2xbEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w4-20020a170902904400b00156a18597easi4699787plz.452.2022.04.04.17.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=OOV2xbEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 DCA9962C9F; Mon, 4 Apr 2022 16:57:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382648AbiDDVvd (ORCPT + 99 others); Mon, 4 Apr 2022 17:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379529AbiDDRXj (ORCPT ); Mon, 4 Apr 2022 13:23:39 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452B6240A9 for ; Mon, 4 Apr 2022 10:21:43 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id t4so8905790pgc.1 for ; Mon, 04 Apr 2022 10:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=085CFCikZI0ZSlSyHC8HLU/h1P8XbTcUdfdIfFSc4n0=; b=OOV2xbEit2y/RdYNm23+xuyCZl8Z+T2ls0EsFdAXySz9w2s48E/Xs73MadwVN1p+JK HMfcSM84pXVwBFVgA7/8Tr4hMDCeyWPh3HmkbAHNTzdnWt96Y9rN6/i8uqMqRTgsHeMh chxXW3tMK9KMN1XT3Yqny19YyY2aErNbS8NMXMjQxGtUruOzKCflQ0CMr+4Y+e0iopSN 7WdNTl8v1DadN1I9QAgp5Jk8Z8APtXIRMiaeFjeRmua6x7K7eSFhOLn9dw4AqXF+HJDI 67g6u0kcNlZ/VL+qeK0e2Q8xal2YZZTBIqQ2daUc/bx7LECIxOTNjADyu4lJyg7TUTev BbrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=085CFCikZI0ZSlSyHC8HLU/h1P8XbTcUdfdIfFSc4n0=; b=K4ZkHXaINqo9p0tF8p3d9gB2EUjRhV3bRxpiLt0fwq56INOJH2aeETnTgkqYnEjI0u lATVtoY6mg+YDmfWyrs0TPsKDOYap69WVdH4KL+cDiiW0Gfms40yCAnzYYBCVvzqvNNd glSThRp0gFpPquFANbkmzyfeD/zGkShH2Pbz7N+lm04rPYINCX4kNK2VMJ5iRmN1BpbV 40McOUGbxVYXMj5RvfvS72IeQTZyLps8KvW68VsBwBJl5nkv2PNl3ojP1951YBiYyd+t 0AihqtMFM1N97er9MVX9FThoriaXNzkXaG3V486ATFhmuUe2NKizYeWr5VCWC6dXbw4K oFRg== X-Gm-Message-State: AOAM533EqIQc52Qv8sO2MtIGrw4t0JK/M/zccJKg8YZSGY7IkGxyCtf1 cuWi7lMi7WqTlv7WnO/9mZOGiw== X-Received: by 2002:a05:6a00:e8e:b0:4fa:a52f:59cf with SMTP id bo14-20020a056a000e8e00b004faa52f59cfmr1098319pfb.84.1649092902528; Mon, 04 Apr 2022 10:21:42 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id n14-20020a17090a394e00b001c670d67b8esm66687pjf.32.2022.04.04.10.21.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 10:21:41 -0700 (PDT) Date: Mon, 4 Apr 2022 17:21:38 +0000 From: Sean Christopherson To: "Maciej S. Szmigiero" Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/8] KVM: nSVM: Sync next_rip field from vmcb12 to vmcb02 Message-ID: References: <20220402010903.727604-1-seanjc@google.com> <20220402010903.727604-2-seanjc@google.com> <112c2108-7548-f5bd-493d-19b944701f1b@maciej.szmigiero.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <112c2108-7548-f5bd-493d-19b944701f1b@maciej.szmigiero.name> 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,T_SCC_BODY_TEXT_LINE, 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 04, 2022, Maciej S. Szmigiero wrote: > > @@ -1606,7 +1622,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, > > nested_copy_vmcb_control_to_cache(svm, ctl); > > svm_switch_vmcb(svm, &svm->nested.vmcb02); > > - nested_vmcb02_prepare_control(svm); > > + nested_vmcb02_prepare_control(svm, save->rip); > > ^ > I guess this should be "svm->vmcb->save.rip", since > KVM_{GET,SET}_NESTED_STATE "save" field contains vmcb01 data, > not vmcb{0,1}2 (in contrast to the "control" field). Argh, yes. Is userspace required to set L2 guest state prior to KVM_SET_NESTED_STATE? If not, this will result in garbage being loaded into vmcb02.