Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1057220iob; Fri, 13 May 2022 21:25:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1dn7fZvGR36BQqyRlDgh5DEp5vm5iWaVgucKZYluaEUkmq0a95PJbdlfcdYTHYx+3O3Xn X-Received: by 2002:a5d:4ed1:0:b0:20a:e375:35f0 with SMTP id s17-20020a5d4ed1000000b0020ae37535f0mr6194016wrv.94.1652502338455; Fri, 13 May 2022 21:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652502338; cv=none; d=google.com; s=arc-20160816; b=ZZLcz6MP7RZSu7+Ha6/+NdOykGwM95aW0V7cQlu6IA0nxeDRC3way1KsFWncsgpSrk RV+WM228TuGzoobG5eMepa6cnvHlMG228A0LBkcE+9ijwvuJbOV30yiRt75JIh5saIpr 5ZSrU0fA6IO9WhxlR5FcF4lNJk6Kije1nVQlRsk0T+Jf0Avw0jHp0kzAaB2FQrUFBgRC LkyaTcVuhnMxyfGCEl1Y+NQRDMM1qK0OI3xGuhm35Vp0bwCzWxl9cnhqetfh6amDQU0v 8MN61WiQu1LxKCHd/HrjyihdVJjVN8BS1ubasFH3/CuEEKn5PWjiJUi47l3HICrFCAFW VPRA== 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=YYxVvNkXOVsJBJNW7IkLQOo2NBhIQpi5g9EjRSQk2JE=; b=scjt3ZAkeeK5eGyMbIxL7kbmpUG0bZZlLZyCqfxQH3noXTUEaOXv0wHB5TWQ8Z5Tlh lt80OXvpGsFlApf7b0jHt9oVKX9ImHAYpnPbdLixwbxRllWgkn4OksutLW8i05BS2hg8 mBjsXH3mv0853f/Tiozbc9mpUDCyGv2ILFXfvt2VyXblptwBeqfg18eljF26V0VowlIG +j4iBhXl/5N93wNXt2SKBLIMkYsRRKl39QmV1e52CFcJP70raBbcGnq/jd4doNZAh6JN +N5Ifrz7ATUxCYL3I9E669rOivTBfvrUlTuPXnJQJnCyaFqc8EHEQN1dlsmdzLEKuDbr eNnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=OWYMsjKO; 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 o26-20020a05600c511a00b00394317da936si9156535wms.218.2022.05.13.21.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:25:38 -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=OWYMsjKO; 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 95745359BE9; Fri, 13 May 2022 19:52:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbiENCwi (ORCPT + 99 others); Fri, 13 May 2022 22:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbiENCw0 (ORCPT ); Fri, 13 May 2022 22:52:26 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE415308840 for ; Fri, 13 May 2022 17:56:03 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id n10so9433733pjh.5 for ; Fri, 13 May 2022 17:56:03 -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=YYxVvNkXOVsJBJNW7IkLQOo2NBhIQpi5g9EjRSQk2JE=; b=OWYMsjKOYyifYrajLqOHfATFsj04q/ZkdSMEMcZCdk4QcYAfNu/YwT46b6noyZk6my oEq0ANS3mBxLf9IMrnOmQNzPVZUyZLH3QwXBEYsWmaP4Zf4rf7v/QJP6kGbk2y2uGPa6 K+qprWkgQaasnfSCphUTng5U3bX5o+NoVVRWAJvnpuK6PMu9wRxf1jlARd/msP+8c69S StBxP4DB35ZWCsoVH15DOc1mk0P/5CPfD/qtct9xfbcH6e1kGoIEvIpJ6XDI8rRkKnFd BY3bhHmbJZ2NUSMah0uF8cqiDniC/nnbzoHXnomLCxFT7QSZHWOiUcQ1kuDAcr5m2Lfw uyrA== 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=YYxVvNkXOVsJBJNW7IkLQOo2NBhIQpi5g9EjRSQk2JE=; b=LChK7SS4q42Zx8zw8uaw2UykJ5V726X8f2KRgp7L+OBT6mkqBXLeviihoUocL2Hzsa 8/JMfriAu0PwttyX7i/OTUx2ab6zGywW1jF1M0T0XXqrZ/hjMEffT86DyrDQMdaq38d7 +bOc5KmK6b1xPcgYXG00+LxdKJhsTE7XiAOMp8PApl/njXN8a6tzPr7E1puEe/aAfcfJ NY/lVdqBoJaB9AGNT8aOZ6+hnq2LqhgY1fbntEe/YYhN0Hz+V00aW1/zhXm5C7BY2aT3 Bu5JTQrTYbLXCLRbmuYMQAAL9ECuEzZisz/0VLKLtxVJatVcwKGiZcv5BHCRuurWToWF mSdg== X-Gm-Message-State: AOAM53380riN5zNEFjdg9OXxP78xJIIYv89QqZhWCpOIVaKGoC+94HVy SHhBEclTUTv9FcKYdgWakw1F4g== X-Received: by 2002:a17:903:22cf:b0:15e:cf4e:79c9 with SMTP id y15-20020a17090322cf00b0015ecf4e79c9mr7334366plg.54.1652489763178; Fri, 13 May 2022 17:56:03 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id fv7-20020a17090b0e8700b001cd4989fecfsm4170476pjb.27.2022.05.13.17.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:56:01 -0700 (PDT) Date: Sat, 14 May 2022 00:55:58 +0000 From: Sean Christopherson To: David Matlack Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm list , LKML , Ben Gardon Subject: Re: [PATCH 1/2] KVM: x86/mmu: Drop RWX=0 SPTEs during ept_sync_page() Message-ID: References: <20220513195000.99371-1-seanjc@google.com> <20220513195000.99371-2-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Fri, May 13, 2022, David Matlack wrote: > On Fri, May 13, 2022 at 12:50 PM Sean Christopherson wrote: > > > > Drop SPTEs whose new protections will yield a RWX=0 SPTE, i.e. a SPTE > > that is marked shadow-present but is not-present in the page tables. If > > EPT with execute-only support is in use by L1, KVM can create a RWX=0 > > SPTE can be created for an EPTE if the upper level combined permissions > > are R (or RW) and the leaf EPTE is changed from R (or RW) to X. > > For some reason I found this sentence hard to read. Heh, probably because "KVM can create a RWX=0 SPTE can be created" is nonsensical. I botched a late edit to the changelog... > What about this: > > When shadowing EPT and NX HugePages is enabled, if the guest changes This doesn' thave anything to do with NX HugePages, it's an execute-only specific bug where L1 can create a gPTE that is !READABLE but is considered PRESENT because it is EXECUTABLE. If the upper level protections are R or RW, the resulting protections for the entire translation are RWX=0. All of sync_page()'s existing checks filter out only !PRESENT gPTE, because without execute-only, all upper levels are guaranteed to be at least READABLE.