From patchwork Wed Sep 21 03:51:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 12983197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF756C32771 for ; Wed, 21 Sep 2022 03:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JZQ8s5LiI7SCRpKXv4Ijbb/PMSRcxbkglHtRmiJilTI=; b=T4CZVwid12hncHdHeRHfRjaiUB UbPtXgW29y7vsl/eOCIj11td9ODLQwJoP1KyIPvAlZYudUxPafg0fzoelpjQBrQ4nVXWSJB2399z0 sJCVA1V5KBrMMOQ9u33CPUDwufYcOASZJhKdDLioS4cQ8gyYup0LllADrxefmwHE+YRTNbHsI7ZEF dlLzEPQ3csObtbMEJ7vc6/g/TTCmx2P/uSyfXco/tpeyqvd8d0xEn+9wATiAeE/1sNOSWiwj1Oid4 X3v85vjgmuLFeLElhY7flw5GdBF3sWRUnJuQo5GwxNZIYN9c1ZYPIEEefVsHzOPioidMLTTU5QG1j pnY8bBjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaqow-008gak-68; Wed, 21 Sep 2022 03:54:46 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaqnN-008ft9-Sg for linux-arm-kernel@lists.infradead.org; Wed, 21 Sep 2022 03:53:11 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id n6-20020a5b0486000000b006aff8dc9865so4043920ybp.11 for ; Tue, 20 Sep 2022 20:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date; bh=l32Gj8DFEI8fLqucJeW2Rbzgq3dj8DyhNV3q0+UkQLg=; b=XuosAkkktXXWMgAJHuCQa6UGl0+k/yysrZg8b+tKU72U2p9L/09e0hmFFdbpFORH8V vTILz5cc/H+dABEvWXOa0Q96/hCZZqtcjG6GDq9EnJkg1HRbHUdnGMBvgxgXxkD9eVhg 3mESCk3cMrCrJNyO444O2KjWFvhL+u7B8U8iyrT2z2rQsl/Atk7HTwqj22cvRTddvz5V /9XStQt610oFcuHnUCacx/6zTnRV/jgFzTs0rOpnX2VLj6/BcvNplLLaWguL+DWjExP6 E/0WLMczgDZY2C1h/uArgrik8gj1VT8Z5HqD+l0KltnMuzSx9/uO4IE53pibPPLBUHoA GLpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=l32Gj8DFEI8fLqucJeW2Rbzgq3dj8DyhNV3q0+UkQLg=; b=qAGH13nAOezMdImYPHIAAn7GdkVaJAGBirdT+Y2Nf4ZrBs57/NtToKVM/OdWnr4HuP 6GcsWmXflmQ29WL1kZWv+QovzfLTCZL0nqrcsGnPcZZ9s+H2dZXJoihMORi/CJ4jdd4d swDONnlG459PPYEm15F2mq0I1K/cR3UfMQP8hRQMgswEWqz3RBa2jM9Gs1uzPmuwJXkJ giih52m/95atGasmhRWLrnXi3njfzS4ssvK1ivpZLIFcB4/8BSN0VjXuNzOfrcWqwQXk iWmfSeMlIpLPMCntOFre9HK5KxlHWDMWjR7nMvI+nQO/mfXH9v3PdvYerO2mAbOtHgoG fGow== X-Gm-Message-State: ACrzQf3mbpT/JrlShC2Q+SF6Em4F8fnXwmzgqE8CvnQg0guNCBt3sWiw iMrpJXxmjnxmebY0MH/MZ+pe8Qc+y90mif7yZp99Zgi1cb05tQnFKXXf/8w7Umij3rNStMpmafC I62+xrmc0N/7zTOJUMoCKB+4X7lL/9XTZwRqkKtZRNCuYEw6SQ4OdSFzp+UmzNdLG15suahso X-Google-Smtp-Source: AMsMyM4k2SLq+xH0pc9iLcqj7V+ZPh7OXwHnlc3w1WiBAqn/qKtC40c1YU8Rcz5OMXlTDVVr0U6HpDc= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:1b89:96f1:d30:e3c]) (user=pcc job=sendgmr) by 2002:a25:d70b:0:b0:6b4:1ed6:24b2 with SMTP id o11-20020a25d70b000000b006b41ed624b2mr9467270ybg.268.1663732388240; Tue, 20 Sep 2022 20:53:08 -0700 (PDT) Date: Tue, 20 Sep 2022 20:51:39 -0700 In-Reply-To: <20220921035140.57513-1-pcc@google.com> Message-Id: <20220921035140.57513-8-pcc@google.com> Mime-Version: 1.0 References: <20220921035140.57513-1-pcc@google.com> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog Subject: [PATCH v4 7/8] KVM: arm64: permit all VM_MTE_ALLOWED mappings with MTE enabled From: Peter Collingbourne To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Peter Collingbourne , Cornelia Huck , Catalin Marinas , Will Deacon , Marc Zyngier , Evgenii Stepanov , kvm@vger.kernel.org, Steven Price , Vincenzo Frascino X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_205309_956001_D6545C43 X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Certain VMMs such as crosvm have features (e.g. sandboxing) that depend on being able to map guest memory as MAP_SHARED. The current restriction on sharing MAP_SHARED pages with the guest is preventing the use of those features with MTE. Now that the races between tasks concurrently clearing tags on the same page have been fixed, remove this restriction. Note that this is a relaxation of the ABI. Signed-off-by: Peter Collingbourne Reviewed-by: Catalin Marinas Reviewed-by: Steven Price --- arch/arm64/kvm/mmu.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index e34fbabd8b93..996ea11fb0e5 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1075,14 +1075,6 @@ static void sanitise_mte_tags(struct kvm *kvm, kvm_pfn_t pfn, static bool kvm_vma_mte_allowed(struct vm_area_struct *vma) { - /* - * VM_SHARED mappings are not allowed with MTE to avoid races - * when updating the PG_mte_tagged page flag, see - * sanitise_mte_tags for more details. - */ - if (vma->vm_flags & VM_SHARED) - return false; - return vma->vm_flags & VM_MTE_ALLOWED; }