Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4617456pxj; Wed, 12 May 2021 09:20:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn1RI3wJfra3UV8iA9gAdjUSjHKvN/JD3KFwLZjwavFLjLxAYK/N3zrR0kzDG8BYxiVNSC X-Received: by 2002:a17:907:10d4:: with SMTP id rv20mr38509676ejb.301.1620836400804; Wed, 12 May 2021 09:20:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836400; cv=none; d=google.com; s=arc-20160816; b=JaJz7a/Mhm92WHEV4xXTgXBH5YSeAqtuRUcaAthhpi2q/Rav9/a5A2UUo7WceAPx4x QM88KO5mLyDKL7og1+rn3xuZ+V7sVHoRUaa+kCA0DHb/MXDzyGkW2SvoBBA/E2ysmPXX rl0U+rPO+J5L7+LSYisoB6Fdq7cO6xfoSjM1fDthhPeCbJs6L0RUUR1/hTm1qfyShnrj Uw9Oueicit1bHqbDjYeNYGnTj+Ov3/jY/Nh0RHC6WWoLMalHApjLEr+6Hjk+JvXvncCl iXz0uscmKoef0lKPsh9U3tzFMv1+MoC3ES1+Qf9Azj3ygpa2oiuA9EcpCslo/efMajPw hMtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UTWaN35y0c41bf3K06BpoQuYdiYQvp8rfa//0pubIFI=; b=N3RDQsWfpSglZ8CkN33+GuSyqhSLHyKabJmflOWT/Q9vc5QboyuBz9WkR8GozzYJTU 774piKZS6aHvdQqbrNfk5HRZRFe8Wokg7pODYGpUUiWzgvPzOkrRKUgpp3SECFIaq35J 9r3Jb//tbG5JwWvfBcpaCu/i7jfpQgJlEsVxtyYMTurX9UdxHxuSUXfe2AlBfoRWzxCO yDwTQ3BNVUywCWRttsYhVWchNAjdgUPp5VzAWhjAxuI1fTHL4RiS5Ye8TwQ0FLZE6Rs/ e7NbEYvnEd8TaZ8xUY83t0QApstfy4HxmuTucvVHmlKUcwaoDmPy392sDMu6GiYowGHj /q3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kbz4QBuQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x22si100300eds.436.2021.05.12.09.19.35; Wed, 12 May 2021 09:20:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kbz4QBuQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240143AbhELQRS (ORCPT + 99 others); Wed, 12 May 2021 12:17:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:50072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233628AbhELPdz (ORCPT ); Wed, 12 May 2021 11:33:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8786E61C35; Wed, 12 May 2021 15:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832637; bh=xBnnw+oRUG0J5VV86b4KwUe+R5KtRj6Wdk0I7DAuAeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbz4QBuQbflR0565sBWA9SRFqALWJ/wo4STxtWskXoiJoU1rx4Z8UmhdQLMSeRn7O D+aQ6Gbb9RPcGO+x4nOU6uVSvPk4C/cXo0abwPpdrxKAsnaRFRLpTRn48mpAJlcvWK kitF1HE9J1d/4wpjVQLW6SJZw0sMirkiyf7yQpTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lu Baolu , Jacob Pan , Joerg Roedel , Sasha Levin Subject: [PATCH 5.10 360/530] iommu/vt-d: Reject unsupported page request modes Date: Wed, 12 May 2021 16:47:50 +0200 Message-Id: <20210512144831.614905781@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jacob Pan [ Upstream commit 78a523fe73b81b4447beb2d6c78c9fafae24eebb ] When supervisor/privilige mode SVM is used, we bind init_mm.pgd with a supervisor PASID. There should not be any page fault for init_mm. Execution request with DMA read is also not supported. This patch checks PRQ descriptor for both unsupported configurations, reject them both with invalid responses. Fixes: 1c4f88b7f1f92 ("iommu/vt-d: Shared virtual address in scalable mode") Acked-by: Lu Baolu Signed-off-by: Jacob Pan Link: https://lore.kernel.org/r/1614680040-1989-4-git-send-email-jacob.jun.pan@linux.intel.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/intel/svm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index b200a3acc6ed..5c95e9693bf5 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel/svm.c @@ -959,7 +959,17 @@ static irqreturn_t prq_event_thread(int irq, void *d) ((unsigned long long *)req)[1]); goto no_pasid; } - + /* We shall not receive page request for supervisor SVM */ + if (req->pm_req && (req->rd_req | req->wr_req)) { + pr_err("Unexpected page request in Privilege Mode"); + /* No need to find the matching sdev as for bad_req */ + goto no_pasid; + } + /* DMA read with exec requeset is not supported. */ + if (req->exe_req && req->rd_req) { + pr_err("Execution request not supported\n"); + goto no_pasid; + } if (!svm || svm->pasid != req->pasid) { rcu_read_lock(); svm = ioasid_find(NULL, req->pasid, NULL); -- 2.30.2