From patchwork Wed Aug 10 19:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 12940954 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 C9497C00140 for ; Wed, 10 Aug 2022 19:33:45 +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=ghm+cfQTqQ8LxQqQikVLGedsEQpW3988ywseZbsL494=; b=zqzs8YDUn7Xo82Hnn1pBKv0ufb /TNl/WTFWqLdf83hDkRKIoxbNADNfQF0ETnpFYffAbSQemwsgvVT1iUcyvzlKsATCRft86Hg6XZLr w5MQR0cBz8YvAT4xQYvDFa3B+/WinEEDS+6/m+XmBQJsIhKVv17MdzrFSeibZkwRVrVNxCNLjypri acdto2UpeEhv8JN3er0FgxqaC7aRLUEdi1QzQz4pOWXd9SKLhRRmcXb5gnPgLBUZjMmJQb1rAP7Qs FfCH8/8g2lvbLUr6lg/Ko8U9ab1uFsUJqxnoYslynag5ISG8QvaJL+alrWDWclTSn0N2NLK81R6Cl bnaxO/rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLrRL-00ECk8-FU; Wed, 10 Aug 2022 19:32:28 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLrPq-00EBmM-90 for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2022 19:30:55 +0000 Received: by mail-yb1-xb49.google.com with SMTP id bt7-20020a056902136700b006777a976adfso12989437ybb.20 for ; Wed, 10 Aug 2022 12:30:53 -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; bh=+yNPE0YtwokNPZdowqkCFFxMTcHqUO1hXxky5MuupRY=; b=oZ5EETOvVLFNFJcFvJs5CUWFZV2YZx1lZtCVYg3Xpam3/6hJePg2ArdHUJxsspg7R5 kYnk9btdizwNCjiWTgj6vhaG+Ln/haQoW/pUsdjAvXGRUtwyTKhYaNbVGIqa4N0knmX5 Y6Bf8Sp0myosiRXqgzgjzzrxNgMTvUamymRKjYhHFjm5HuDY7N2HLKT82K2ZR3tI6a2I TkfL2xlNiTx9SHZbWxe0/jGZ8EVR0bP+e7g+tySRt7UNKn82GSElS85ZLEZQitwkkwIT z43wgykSu9Orgytw+Yk5q/JCadYNjdaFTKqRIDXR1Haw0of7kw8Io57Gij0cmraUd7F0 vpZQ== 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; bh=+yNPE0YtwokNPZdowqkCFFxMTcHqUO1hXxky5MuupRY=; b=ac7FZYA0331Bl3qRp5DiQUY+GNsZecqJGLFKr6lgD7OjI/A3UYSbjZ+52tQa6cP1w2 FCS4Tt+0GOnIE3YvJsGkPrM7mUPKPrnUqEOjCI6DhXxMvA+xcEPy2Lx/a5bVIj4BWhgy NATdVrs0MVAcr0Yx6Pom7Gwaw5Zej6RiMYy7C+ZYd78DwoJMbT2Twxw26DQRuSXvA1+i jbUrEQRdHNRdphErsQwBkTIWAxhXs2kCGNo5qZu5XZPbfw/XyFvYjvgNmeuJm6EIIuNu XHl/7lZ2iLRTA4SVZtuw+EKbdNbA6X0GSR3yWQcKp9bhS5P9QLvb32PenD3K4raQQCo4 TLiw== X-Gm-Message-State: ACgBeo3tERXmEpzjFU0sYA2OY3JinxEHoW+BjSBPd89yhKPd0zE7JQTO rJ+Uc/B+7C1lM8Q3gPQNhSTu8oLq6AkJNzkbt+d60TsOnSp1PQbarSG7CplTt4dd5hXkrMk6XaS /CifXHAoWKjW434Nei+dckIQgSVNKItLkAk7oJwWorS43TUzbwuYkGJa3b/iYycA3GAS8hHbL X-Google-Smtp-Source: AA6agR6moG62zPERwU4Dk26hNOp5DcD21DJAex4OmPFxWG3fnAGG1z1V+i1T2gQ2yJV0LxVv859Fqu0= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:4d8b:fb2a:2ecb:c2bb]) (user=pcc job=sendgmr) by 2002:a25:b951:0:b0:67b:93e9:1ff9 with SMTP id s17-20020a25b951000000b0067b93e91ff9mr21338230ybm.101.1660159852914; Wed, 10 Aug 2022 12:30:52 -0700 (PDT) Date: Wed, 10 Aug 2022 12:30:32 -0700 In-Reply-To: <20220810193033.1090251-1-pcc@google.com> Message-Id: <20220810193033.1090251-7-pcc@google.com> Mime-Version: 1.0 References: <20220810193033.1090251-1-pcc@google.com> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog Subject: [PATCH v3 6/7] 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-20220810_123054_347799_36F13246 X-CRM114-Status: GOOD ( 12.79 ) 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. 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 d54be80e31dd..fc65dc20655d 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; }