From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E18DF1CA8D; Mon, 14 Oct 2024 15:34:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728920086; cv=none; b=chDTmMO0aaJWur/w08VR9sNkVrugl2N6dtjydFAIZVWPbr073JhAP1e4TxkOz1MNS2jxXpijz3UyVr7zOjQp2ZmUq1fofVqTnmzEYPqRAYTUbiqYPK0cfVGH8wg3XqEOAbrmr45uTjgrMD/uMSN8dQDmpa/L9qI5j27NW1DSj+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728920086; c=relaxed/simple; bh=HwncEqEl9g7/IMpvUbjSyWyZY2m3i/SRn8wLwtphmus=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kaW9HBAYRO/ixPMY3XH4RJDkTbdr6MfqZBWYcQhk+5mIgq4Cx5Sh7jQTwiA8oPRBYOSQpzb/BaHMpY+m6XbOUKX5SvIkLchWKL2DhTyDp1npwIlfdY+1A8rARi7dl+76NcX6z5OsbwTswjrsYuWcYFq1TS22RxCBbl83SoKCAsA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uAF3eaSk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uAF3eaSk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66938C4CEC3; Mon, 14 Oct 2024 15:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728920085; bh=HwncEqEl9g7/IMpvUbjSyWyZY2m3i/SRn8wLwtphmus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uAF3eaSk3rdRMMhO0xvhVr46GIqM3CLJtJoiJHQ+r02gmSimn11Tmt6u1MFWNZfxK SwGlVNR4ep66ad3G7gKW/3yx/EusAhehutJ6F97Zfyr5le8q61EGz4ArKDk2TAwvY4 syBoxlwEP5dNBeKf+5mJ01zUQar7iEhhpvCx+DIA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yonatan Maman , Gal Shalom , Ben Skeggs , Danilo Krummrich Subject: [PATCH 6.1 792/798] nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error Date: Mon, 14 Oct 2024 16:22:26 +0200 Message-ID: <20241014141249.187252362@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141217.941104064@linuxfoundation.org> References: <20241014141217.941104064@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yonatan Maman commit 835745a377a4519decd1a36d6b926e369b3033e2 upstream. The `nouveau_dmem_copy_one` function ensures that the copy push command is sent to the device firmware but does not track whether it was executed successfully. In the case of a copy error (e.g., firmware or hardware failure), the copy push command will be sent via the firmware channel, and `nouveau_dmem_copy_one` will likely report success, leading to the `migrate_to_ram` function returning a dirty HIGH_USER page to the user. This can result in a security vulnerability, as a HIGH_USER page that may contain sensitive or corrupted data could be returned to the user. To prevent this vulnerability, we allocate a zero page. Thus, in case of an error, a non-dirty (zero) page will be returned to the user. Fixes: 5be73b690875 ("drm/nouveau/dmem: device memory helpers for SVM") Signed-off-by: Yonatan Maman Co-developed-by: Gal Shalom Signed-off-by: Gal Shalom Reviewed-by: Ben Skeggs Cc: stable@vger.kernel.org Signed-off-by: Danilo Krummrich Link: https://patchwork.freedesktop.org/patch/msgid/20241008115943.990286-3-ymaman@nvidia.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -194,7 +194,7 @@ static vm_fault_t nouveau_dmem_migrate_t if (!spage || !(src & MIGRATE_PFN_MIGRATE)) goto done; - dpage = alloc_page_vma(GFP_HIGHUSER, vmf->vma, vmf->address); + dpage = alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vmf->vma, vmf->address); if (!dpage) goto done;