From patchwork Fri Nov 4 01:10:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 13031162 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 C8A06C4332F for ; Fri, 4 Nov 2022 01:13:30 +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=ZbOSwO6gcSGveuyA/lT1Bi6wpi1zaj0fDMeOpTdUY4o=; b=3PCEe2lHk2ZhplKsM5kZ7vDys+ 83+VNOQ4N8Dniru3RO2KLtbLog4Q6ZcaBnSd6+app0o7sX5yZPV+MVqg60RI8PJ+3TVgwsHOceNFu +I9i17UDolgl1fFIH5QPNPi/RARDb9Ja5pMm0VhbeCu3dNs8YJy0vS9MO2fxjzQW+updp6B2GmDyl 7TyFnQW+Z2JfS9dW/mPTVfZHOKxesUKqEN4YDcoMDNkdXLvoaAHnrMHT+gfOycMtVYukOvB1L+yfL 7vk4Pmtf2L0ccDnQ3Dx54g/hVZUHev1U7UAspOHxGjXiH0f9iZs8s8j1rX3LZTw2xD2Lzdc9aVfMe lzzVDyTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqlG2-00251s-CT; Fri, 04 Nov 2022 01:12:30 +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 1oqlEr-0024au-Jz for linux-arm-kernel@lists.infradead.org; Fri, 04 Nov 2022 01:11:18 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-349423f04dbso33733507b3.13 for ; Thu, 03 Nov 2022 18:11:16 -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:message-id:reply-to; bh=ZNLPTbSTlYPZjBY9HcgmDn5JBJ/klYO2bN4Z3HIMVZY=; b=bwqOOb8Qn4eAWyxn4R+vdMrp7z+X9MlDWhtS2hi7whYYdWkf5FJmAUT0M76zNFvK5c GyzhxZ5ilEPl4VxyNPOGGI5u87KZWaJ1KVssckoBO832LOf4XmVPYHCNIjRZdotM/F0J qj1sLHsNomzmqZ/nB59WTDwW3KcDU6htZGJrewk9dIdhjOkArVUQSeDtjaXhXp/5erjH pGMeBPkgMHqGoItOyxvfZeHzrb0m0uG0h2Zw+/go7QH1C0Uwo43havjN/hLRO/V/Inez e9WWTq8U9kdPOCNEajZfZcONdmtEe3Q8gQJwu+MfMee3ynkyU1T5t0Zg2llvErCGZsqA Tb1A== 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:message-id:reply-to; bh=ZNLPTbSTlYPZjBY9HcgmDn5JBJ/klYO2bN4Z3HIMVZY=; b=Y5UnFXOembejgfr3FyklaFxk4/KmBSkd9h3MUf4VhCn8FpTNcDSioSUtOvnus4dE/T gfE5r7Or3LVPluiwLHUVnmb+LjSqtMo2CALvwPtwzxcXFGm5DkPFqKnf/ezDdy00R7lV cpFrHBThj8eGrhjx339jsanqq9zKan4Pid4qC6bj+xsMACG3v3YvR29o7lHYdyH4r1mb RCoobSG1ScFwoSR0xXjHeuil72WEKkDokbSTeaIqy8FArMgKrjBhf+2Bqcl6wVeXHQiY orp/YFdL6c3RjMkzjmaIEOtWGFjhpjikLT/oWaCZyfVuPb8JuiInFbE2YEifEx/QHsoC rdHQ== X-Gm-Message-State: ACrzQf3OoimvaxzqXvhC1riZ8VsgLZAvqCZU/SnlB5wBiBIRm/78folG XXcxaUFU5OUwvmcHN5vSPSn+fZXYMni2FCVG9wXKyKqnebchVDirXjPpLSa+cpmot+1jXD3FUBv 7d+0AyKa5fSzjWxXkqXjTTk/LrtQnahOysGdCLHDqumnf/19mL7ssLpmH3oNoLrpc/DTifde3 X-Google-Smtp-Source: AMsMyM6nmXxJ8Gq+/aWVuDapWKSZFcWfvUUDZ0UKrzoV1+beR/aXVD1kiZHnxs3uVYWp1mJAGj9lGKM= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:2844:b0ec:e556:30d8]) (user=pcc job=sendgmr) by 2002:a0d:d705:0:b0:36f:f574:49a2 with SMTP id z5-20020a0dd705000000b0036ff57449a2mr32986451ywd.442.1667524276250; Thu, 03 Nov 2022 18:11:16 -0700 (PDT) Date: Thu, 3 Nov 2022 18:10:40 -0700 In-Reply-To: <20221104011041.290951-1-pcc@google.com> Message-Id: <20221104011041.290951-8-pcc@google.com> Mime-Version: 1.0 References: <20221104011041.290951-1-pcc@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH v5 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-20221103_181117_682471_0A5CBC4F X-CRM114-Status: GOOD ( 13.11 ) 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 Reviewed-by: Cornelia Huck --- 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 9ff9a271cf01..b9402d8b5a90 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1110,14 +1110,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; }