All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/nouveau: fix unbounded kernel allocations in the VM_BIND uAPI
@ 2026-08-08 11:14 ` Junrui Luo
  0 siblings, 0 replies; 14+ messages in thread
From: Junrui Luo via B4 Relay @ 2026-08-08 11:14 UTC (permalink / raw)
  To: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Dave Airlie
  Cc: dri-devel, nouveau, linux-kernel, Junrui Luo, Yuhao Jiang, stable

Two independent fixes to the uAPI added by b88baab82871 ("drm/nouveau:
implement new VM_BIND uAPI").

Patch 1 bounds the sync and operation counts in EXEC and VM_BIND.
nouveau_exec_ucopy() and nouveau_uvmm_vm_bind_ucopy() hand user-supplied
u32 counts straight to u_memcpya(), which only rejects multiplication
overflow -- something a u32 count times a small element size never
reaches on 64-bit.  A wait_count of 0xffffffff thus becomes a 64 GB
vmemdup_user() request: above INT_MAX that trips the WARN_ON_ONCE() in
__kvmalloc_node_noprof(), and below it the kernel attempts a vmalloc of
up to 2 GB that GFP_USER leaves uncharged to the caller's memcg.

Patch 2 rejects a second VM_INIT.  nouveau_uvmm_ioctl_vm_init() never
checks whether the client already has a GPU VA space before overwriting
cli->uvmm.ptr, so a second call orphans the first nouveau_uvmm with no
remaining reference to it.  The orphan, its drm_gpuvm, that gpuvm's
reservation object and its region maple tree are never freed, the buffer
objects mapped in it stay pinned, and its nvif vmm keeps the GPU page
directories allocated until the file is closed.

Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
---
Junrui Luo (2):
      drm/nouveau: bound sync and op counts in EXEC and VM_BIND
      drm/nouveau/uvmm: reject a second VM_INIT

 drivers/gpu/drm/nouveau/nouveau_exec.c | 12 ++++++++++++
 drivers/gpu/drm/nouveau/nouveau_uvmm.c | 24 ++++++++++++++++++++++++
 include/uapi/drm/nouveau_drm.h         | 18 ++++++++++++++++++
 3 files changed, 54 insertions(+)
---
base-commit: 075b74841bd0065a3bda3440873c747938e69b68
change-id: 20260808-nouveau-fixes-70a70f3f5385

Best regards,
-- 
Junrui Luo <moonafterrain@outlook.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-08-11  4:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 11:14 [PATCH 0/2] drm/nouveau: fix unbounded kernel allocations in the VM_BIND uAPI Junrui Luo via B4 Relay
2026-08-08 11:14 ` Junrui Luo
2026-08-08 11:14 ` [PATCH 1/2] drm/nouveau: bound sync and op counts in EXEC and VM_BIND Junrui Luo via B4 Relay
2026-08-08 11:14   ` Junrui Luo
2026-08-08 11:27   ` sashiko-bot
2026-08-09 22:43   ` David Airlie
2026-08-09 22:43     ` David Airlie
2026-08-11  4:00     ` Junrui Luo
2026-08-11  4:00       ` Junrui Luo
2026-08-11  4:05       ` Dave Airlie
2026-08-11  4:05         ` Dave Airlie
2026-08-08 11:14 ` [PATCH 2/2] drm/nouveau/uvmm: reject a second VM_INIT Junrui Luo via B4 Relay
2026-08-08 11:14   ` Junrui Luo
2026-08-08 11:35   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.