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 DA12B1BDC3; Mon, 14 Oct 2024 14:47:58 +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=1728917278; cv=none; b=h6d5pnzSaWIFBkEKPGc/PKt27ylzmHs2Sd1IL/E4FkXDGJ4OxFZs1NSt8nH2erVCQmyL1oWLsTIsBgS/GZdaCBtjgv96j1iWlXUH6PdLF1uW15pAw9xqYSazowQ+KoSWATrBzolDbqTd5lsj/aCOTlyr5j4TBfJUWbaX5dxXxEk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917278; c=relaxed/simple; bh=UuaQMiMtzQS1tp+PlCSVYLaUDRwDorQhXCbknLNgFys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XuQlC2mCLnbvfOnk7Vp5NpbjUB8MQhnK++YLm5dBflEIQWlld2ewi9HsZdFJppHFcVBZ9GFKmfeMCTnMlzn6+NdgVA9q91V8yUDKjJD0rSByU8SagYWlyCAKZXYBGPvR1KQxUEqK3XcRzqki83FOaDNHhin4zIWyjH4xwW3KBRk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Lw5bPFOo; 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="Lw5bPFOo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5214DC4CEC3; Mon, 14 Oct 2024 14:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728917278; bh=UuaQMiMtzQS1tp+PlCSVYLaUDRwDorQhXCbknLNgFys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lw5bPFOoW0SQ27c1cyyjlUW6RWrj2/m4p5NKJgn4nEIK4k7x0iSYxPX5A4zvEoOY5 anMxwKGrIvQV/1WKj7GVeZBIrSYtx1mBTtZ45BDuHrg45TURQ/1xCv6vsfTv5gAbnj Y66FzsA5jOeVArw6IASeMp+l9YSBhz8A9TLImVIo= 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.6 203/213] nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error Date: Mon, 14 Oct 2024 16:21:49 +0200 Message-ID: <20241014141050.882479182@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141042.954319779@linuxfoundation.org> References: <20241014141042.954319779@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 @@ -193,7 +193,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;