From patchwork Fri Jul 22 01:50: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: 12925875 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 B8EEAC43334 for ; Fri, 22 Jul 2022 01:53:22 +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=JHm3xBpy13pgXqXrPR6x2GmE1FxxWIqgAZUAF9WjBTc=; b=r4Ec/JCd8v85pA/a8bMRujI/ZQ iJYjfGXfDzFITGUI48WyxGd39rydrkmyb7/P7dF594hIKPes6wUrCVKNb2vTAJ4ZP6Mc95vqRCjS3 6j9DoZrnX8oY7HRu7q/rOe36aPJcUB8UVhKlQ93ixEtjo0Elqz2IHecMFa7p/Qc3mqrYnpzZCHB2O 3uJ3ngGLxmN9Mxyz/42nVz2tdAU+0kigeFgCFPZBdvbIIYkILNFeLJ+g/iVzc0YRTffsY1hWL8yVX cVROijG75PYgZsbIrz/6r9ZI3hEkewf8soIoy/l15TpaIfcQbPy5efM5vfG5zdjZhtwzsZhwdZiGP LkgcHfsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEhq3-00FoHm-Ib; Fri, 22 Jul 2022 01:52:23 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEhot-00Flx3-MC for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2022 01:51:13 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-31e62f7b377so28370807b3.17 for ; Thu, 21 Jul 2022 18:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cXHHG5JyJT6/zfSdYwcZ5hplI/Zwtw5pce4ngWT2RP0=; b=B/196tHwJZGxwdFpPDFtGgET20t1oaPOi+B7MforGvjteQqAubrBbnDQDcEDABfdFN 3DK9BLo4bXahlAM1Zsxz6zcxuz6ugGDvcoav9uuevoCJW5/jGeVxKgcMDWkvWNt+YlYE YGooogCFEZU+f/gGBwXExbBhTXJG7xpnwCN4d1QjLWLCX6p/euCGwNgqngATINfEafUZ vmxSUdXRy8210cbejvc/kzSbNqREBTwRlsnUJ3CeOb7E82yXcf7pGch9UX8WepzcpJGw gVDLrfHbXsI5qYh6TeA8MbgK6BZW4I+5FNvZUO3QAWxqrGa639qAV9IpgKC4MjSspDJg W3qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cXHHG5JyJT6/zfSdYwcZ5hplI/Zwtw5pce4ngWT2RP0=; b=hlr2KDQS293AlgqE0ju5KHCHvFcHoQoW9vpXAP9axsRu3M7+8pDXTgg+y9nZ0bTsIc q6cqqlbyRmXOrV28o8cRLwPXL//rNnsslHdI1QFy9+pmfGTFIlEDIzjC4KlBh6H/hjms 8jEAJM5XlnH0eqsl1b2gRo7J0qlY+NHLMcLSEaYNdkN/cWpz+W47zeifknrc8Z08BYJu qzW/DNyAzg1vMcqJwOwKt8Q0thkUdqjRtFIBAd84SUNklP8yH09Xv6+RUoY7rnG8aa1E JHE+V5BMETTfJvi2OF/amHooU/DkWRt0c+5Ucqvol2cBLovVfHAc1twRJJUCNUngstFv zmVg== X-Gm-Message-State: AJIora9bVlLxfhcxizFVREHDJpl5IaprZ9aZtymKZTNdfU1Z89WXaftF ZSJCw49Z/CzLxVE7ZgpaanqIumZzX9eLGDho86l/ap5VZm84NrhiWb8Uoq5ofchG5WAhyCbApDg bbiFqX44Nih5inZ6YnLewrIBmSmWXlePbeAujpQREZ4g/5CqdCOhjDQcp/K4Y+NNNeJvy7gpV X-Google-Smtp-Source: AGRyM1uyeQgFMIiL2ECknr9YM3j6WFlHrejpaFbSL4QcZoqTrnLYKShMPao1gximyv/6/63IGwrd5rM= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:7ed4:5864:d5e1:ffe1]) (user=pcc job=sendgmr) by 2002:a81:124b:0:b0:31c:fc99:d4de with SMTP id 72-20020a81124b000000b0031cfc99d4demr1273232yws.348.1658454670287; Thu, 21 Jul 2022 18:51:10 -0700 (PDT) Date: Thu, 21 Jul 2022 18:50:32 -0700 In-Reply-To: <20220722015034.809663-1-pcc@google.com> Message-Id: <20220722015034.809663-7-pcc@google.com> Mime-Version: 1.0 References: <20220722015034.809663-1-pcc@google.com> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog Subject: [PATCH v2 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-20220721_185111_755596_51F8975C X-CRM114-Status: GOOD ( 12.57 ) 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 --- 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; }