From patchwork Thu Oct 12 12:24:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10001795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF7F360325 for ; Thu, 12 Oct 2017 12:26:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E041728D75 for ; Thu, 12 Oct 2017 12:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D51AF28DA7; Thu, 12 Oct 2017 12:26:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5DE1C28D75 for ; Thu, 12 Oct 2017 12:26:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2cXJ-0003zg-CN; Thu, 12 Oct 2017 12:24:25 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2cXI-0003zO-Ae for xen-devel@lists.xenproject.org; Thu, 12 Oct 2017 12:24:24 +0000 Received: from [85.158.143.35] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-6.messagelabs.com id 25/9B-16487-7FE5FD95; Thu, 12 Oct 2017 12:24:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRWlGSWpSXmKPExsXS6fjDS/db3P1 Igy1tahbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bDuweZCjbxVsz7s4KlgfE6excjJ4eQQJ7E sgmNzF2MHBy8AnYSS9+kgYQlBAwlTi+8yQJiswioStz8DlHOJqAu0fZsOytIuYiAgcS5o0kgJ rOAvsS2dWDVwgKBEo3/TjNBDLeTePLyApjNKWAv0fF2NtQiQYm/O4RBwswCWhIPf91igbC1JZ YtfM0MMVFaYvk/jgmMfLMQGmYhaZiFpGEWQsMCRpZVjBrFqUVlqUW6RkZ6SUWZ6RkluYmZObq GBmZ6uanFxYnpqTmJScV6yfm5mxiBYccABDsY18wPPMQoycGkJMqbEXg/UogvKT+lMiOxOCO+ qDQntfgQowYHh8C2XasvMEqx5OXnpSpJ8L6JBaoTLEpNT61Iy8wBRgZMqQQHj5II7yWQNG9xQ WJucWY6ROoUoy5Hx827f5iEwGZIifMyAeNMSACkKKM0D24ELEovMcpKCfMyAh0oxFOQWpSbWY Iq/4pRnINRSZh3L8gqnsy8ErhNr4COYAI6QjTtDsgRJYkIKakGxklrTotr3BHc1GddlHjv5h/ ZHtaVj5izGp88LoyOnPhfmlPw8b8sqWurtqzpLJ3Ffy0kNvOBkvzh6U7hC/cwLlxUHv8rSWHe ngk8pmqnZK12b5ZjalJojXl49Kmed4iYJn/dfbcg14aIIyrty3bYSwuX2WrxfQiR3D1nrvv0T 4k7OHzS/SXklViKMxINtZiLihMBiitJDc0CAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1507811060!70396767!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8051 invoked from network); 12 Oct 2017 12:24:22 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-4.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Oct 2017 12:24:22 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 12 Oct 2017 06:24:20 -0600 Message-Id: <59DF7B130200007800185945@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.2 Date: Thu, 12 Oct 2017 06:24:19 -0600 From: "Jan Beulich" To: "xen-devel" References: <59DF54320200007800185513@prv-mh.provo.novell.com> In-Reply-To: <59DF54320200007800185513@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 4/3] x86: don't ignore foreigndom on L2/L3/L4 page table updates X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Silently assuming DOMID_SELF is unlikely to be a good idea for page table updates. For PGT_writable pages, though, it seems better to allow the writes, so the same check isn't being applied there. Also add blank lines between the individual case blocks. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -3542,18 +3542,28 @@ long do_mmu_update( cmd == MMU_PT_UPDATE_PRESERVE_AD, v, pg_owner); break; + case PGT_l2_page_table: + if ( unlikely(pg_owner != pt_owner) ) + break; rc = mod_l2_entry(va, l2e_from_intpte(req.val), mfn, cmd == MMU_PT_UPDATE_PRESERVE_AD, v); break; + case PGT_l3_page_table: + if ( unlikely(pg_owner != pt_owner) ) + break; rc = mod_l3_entry(va, l3e_from_intpte(req.val), mfn, cmd == MMU_PT_UPDATE_PRESERVE_AD, v); break; + case PGT_l4_page_table: + if ( unlikely(pg_owner != pt_owner) ) + break; rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn, cmd == MMU_PT_UPDATE_PRESERVE_AD, v); break; + case PGT_writable_page: perfc_incr(writable_mmu_updates); if ( paging_write_guest_entry(v, va, req.val, _mfn(mfn)) )