drm/nouveau: Fix NULL pointer dereferences in GETPARAM and GET_ZCULL_INFO ioctls
Subsystems (3)
cover drm/nouveau: Fix NULL pointer dereferences in GETPARAM and GET_ZCULL_INFO ioctls
When Nouveau initialization is incomplete (e.g. firmware microcode fails to load or graphics engine initialization aborts early), userspace display servers (GNOME/Mesa) probing device capabilities trigger fatal kernel NULL pointer dereferences in the Nouveau ioctl handlers.
This 2-patch series fixes two distinct NULL pointer crash paths:
1. drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
- Prevents NULL dereference of gr, gr->func, and nvkm_device->func in nouveau_abi16_ioctl_getparam(). Returns -ENODEV cleanly.
2. drm/nouveau: Fix NULL pointer dereference in GET_ZCULL_INFO ioctl
- Checks that gr is non-NULL before inspecting gr->has_zcull_info at
offset 0xf0 in nouveau_abi16_ioctl_get_zcull_info().
Both bugs were reproduced and verified fixed on GA107 (NVIDIA GeForce RTX 3050 Mobile) running 7.2-rc7 under GNOME Wayland desktop initialization.
---
Jim Cromie (2):
drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl drm/nouveau: Fix NULL pointer dereference in GET_ZCULL_INFO ioctl
drivers/gpu/drm/nouveau/nouveau_abi16.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
---
base-commit: db2ddb87143519e20a95aa36c60b36107b736a58
change-id: 20260815-null-fixes-5e9e86666a5d
Best regards,
Signature · 1 line
Jim Cromie <[email protected]>
PATCH 1/2 drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
When hardware or firmware initialization fails, the graphics engine (gr) or device functions may remain NULL. Attempting to access these during the GETPARAM ioctl (e.g., NOUVEAU_GETPARAM_GRAPH_UNITS) results in a kernel NULL pointer dereference, causing a crash when userspace (GNOME/Mesa) attempts to probe the device.
Add safety checks for 'gr', 'gr->func', and 'nvkm_device->func' in the ioctl handler. Return -ENODEV to signal the missing hardware state to userspace, and use NV_ERROR_ONCE to provide diagnostic proof in the kernel log without risking a console flood.
RFC:
These crashes may not be repeatable, they happened while I was trying to build nouveau as a builtin module, with binary blobs in the kernel image, on a laptop with an encrypted disk. Gemini tells me this won't work, so I punted.
--- drivers/gpu/drm/nouveau/nouveau_abi16.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nouveau_abi16.c +21 -4
@@ -306,7 +306,12 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) getparam->value =1 ;break ;case NOUVEAU_GETPARAM_GRAPH_UNITS : - getparam->value =nvkm_gr_units (gr); +if (gr && gr->func) { + getparam->value =nvkm_gr_units (gr); + }else { +NV_ERROR_ONCE (drm,"GETPARAM_GRAPH_UNITS: no gr engine or func\n" ); +return -ENODEV ; + }break ;case NOUVEAU_GETPARAM_EXEC_PUSH_MAX : {int ib_max =getparam_dma_ib_max (device);
@@ -315,11 +320,23 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)break ; }case NOUVEAU_GETPARAM_VRAM_BAR_SIZE : - getparam->value = nvkm_device->func->resource_size (nvkm_device,NVKM_BAR1_FB ); +if (nvkm_device && nvkm_device->func && nvkm_device->func->resource_size) { + getparam->value = + nvkm_device->func->resource_size (nvkm_device,NVKM_BAR1_FB ); + }else { +NV_ERROR_ONCE (drm,"GETPARAM_VRAM_BAR_SIZE: no device func\n" ); +return -ENODEV ; + }break ;case NOUVEAU_GETPARAM_VRAM_USED : { -struct ttm_resource_manager *vram_mgr =ttm_manager_type (&drm->ttm.bdev,TTM_PL_VRAM ); - getparam->value = (u64 )ttm_resource_manager_usage (vram_mgr); +struct ttm_resource_manager *vram_mgr = +ttm_manager_type (&drm->ttm.bdev,TTM_PL_VRAM ); +if (vram_mgr) { + getparam->value = (u64 )ttm_resource_manager_usage (vram_mgr); + }else { +NV_ERROR_ONCE (drm,"GETPARAM_VRAM_USED: no vram mgr\n" ); +return -ENODEV ; + }break ; }case NOUVEAU_GETPARAM_HAS_VMA_TILEMODE :
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 1/2] drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] The patch fixes a NULL pointer dereference in the GETPARAM ioctl when the graphics engine (gr) fails to initialize but misses an identical issue in nouveau_abi16_ioctl_get_zcull_info. --
--- Patch [1]: [PATCH 1/2] drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl --- commit 6569813c05cdc1cf39cfd469b6745e81e7cad86d
Author: Jim Cromie <[email protected]>
drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
This patch adds safety checks for the graphics engine and device functions in the GETPARAM ioctl handler. It returns -ENODEV to signal missing hardware state to userspace, preventing a kernel NULL pointer dereference when initialization fails.
Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_abi16.c +0
-0@@ -306,7 +306,12 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) getparam->value =1 ;
drivers/gpu/drm/nouveau/nouveau_abi16.c nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) · line 315
Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_abi16.c +6
-1break ;case NOUVEAU_GETPARAM_GRAPH_UNITS : - getparam->value =nvkm_gr_units (gr); +if (gr && gr->func) { + getparam->value =nvkm_gr_units (gr); + }else { +NV_ERROR_ONCE (drm,"GETPARAM_GRAPH_UNITS: no gr engine or func\n" ); +return -ENODEV ; + }break ;
[Severity: Critical]
This is a pre-existing issue, but while you are fixing the NULL pointer dereference of the gr pointer here, is there a similar vulnerability in the adjacent nouveau_abi16_ioctl_get_zcull_info() function?
If the graphics engine fails to initialize and gr is NULL, as addressed by this patch, it looks like an unprivileged userspace process could still trigger an Oops by calling the DRM_IOCTL_NOUVEAU_GET_ZCULL_INFO ioctl, which only requires DRM_RENDER_ALLOW.
Looking at the nouveau_abi16_ioctl_get_zcull_info() function in drivers/gpu/drm/nouveau/nouveau_abi16.c, the gr pointer is unconditionally dereferenced:
int nouveau_abi16_ioctl_get_zcull_info(ABI16_IOCTL_ARGS)
{
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_gr *gr = nvxx_gr(drm);
struct drm_nouveau_get_zcull_info *out = data;
if (gr->has_zcull_info) {
const struct nvkm_gr_zcull_info *i = &gr->zcull_info;
...Would it make sense to add a similar check for gr being NULL before dereferencing gr->has_zcull_info?
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/2] drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
Quoted 60 lines · On Sat, Aug 15, 2026 at 11:40 AM <[email protected]> wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] The patch fixes a NULL pointer dereference in theGETPARAMioctl when the graphics engine (gr) fails to initialize but misses an identical issue innouveau_abi16_ioctl_get_zcull_info. ----- Patch [1]: [PATCH 1/2] drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl --- commit
6569813c05cdc1cf39cfd469b6745e81e7cad86d
Author: Jim Cromie <[email protected]>drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
This patch adds safety checks for the graphics engine and device functions in the GETPARAM ioctl handler. It returns
-ENODEVto signal missing hardware state to userspace, preventing a kernel NULL pointer dereference when initialization fails.Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_abi16.c +0
-0@@ -306,7 +306,12 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) getparam->value =1 ;drivers/gpu/drm/nouveau/nouveau_abi16.c nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) · line 315
Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_abi16.c +6
-1break ;case NOUVEAU_GETPARAM_GRAPH_UNITS : - getparam->value =nvkm_gr_units (gr); +if (gr && gr->func) { + getparam->value =nvkm_gr_units (gr); + }else { +NV_ERROR_ONCE (drm,"GETPARAM_GRAPH_UNITS: no gr engine or func\n" ); +return -ENODEV ; + }break ;[Severity: Critical]
This is a pre-existing issue, but while you are fixing the NULL pointer dereference of the gr pointer here, is there a similar vulnerability in the adjacentnouveau_abi16_ioctl_get_zcull_info()function?If the graphics engine fails to initialize and gr is NULL, as addressed by this patch, it looks like an unprivileged userspace process could still trigger an Oops by calling the
DRM_IOCTL_NOUVEAU_GET_ZCULL_INFOioctl, which only requiresDRM_RENDER_ALLOW.Looking at the
nouveau_abi16_ioctl_get_zcull_info()function indrivers/gpu/drm/nouveau/nouveau_abi16.c, the gr pointer is unconditionally dereferenced:int
nouveau_abi16_ioctl_get_zcull_info(ABI16_IOCTL_ARGS){ struct nouveau_drm *drm = nouveau_drm(dev); struct nvkm_gr *gr = nvxx_gr(drm); struct drm_nouveau_get_zcull_info *out = data; if (gr->has_zcull_info) { const struct nvkm_gr_zcull_info *i = &gr->zcull_info; ...
Quoted 2 lines
Would it make sense to add a similar check for gr being NULL before dereferencing
gr->has_zcull_info?
yes indeed, the next patch does so.
I hit them both, separately, but theyre mergable if you like.
Quoted 5 lines
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
maintainerRe: [PATCH 1/2] drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
In reply to Jim CromieQuoted 13 lines · Jim Cromie
When hardware or firmware initialization fails, the graphics engine (gr) or device functions may remain NULL. Attempting to access these during the GETPARAM ioctl (e.g.,
NOUVEAU_GETPARAM_GRAPH_UNITS) results
in a kernel NULL pointer dereference, causing a crash when userspace (GNOME/Mesa) attempts to probe the device.Add safety checks for 'gr', '
gr->func', and 'nvkm_device->func' in the
ioctl handler. Return-ENODEVto signal the missing hardware state to userspace, and useNV_ERROR_ONCEto provide diagnostic proof in the kernel log without risking a console flood.
Quoted 7 lines
RFC:
These crashes may not be repeatable, they happened while I was trying to build nouveau as a builtin module, with binary blobs in the kernel image, on a laptop with an encrypted disk. Gemini tells me this won't
work, so I punted.
"Gemini tells me this won't work, so I punted."
I'm sorry, what exactly do you mean here? And could you clarify what LLMs were used for in writing this series? Code generation, analysis, etc.?
Quoted 2 lines
Signed-off-by Jim Cromie <[email protected]>
Re: [PATCH 1/2] drm/nouveau: Fix NULL pointer dereferences in GETPARAM ioctl
Quoted 23 lines · On Thu, Sep 17, 2026 at 2:26 PM <[email protected]> wrote:
Quoted 13 lines · Jim Cromie
When hardware or firmware initialization fails, the graphics engine (gr) or device functions may remain NULL. Attempting to access these during the GETPARAM ioctl (e.g.,
NOUVEAU_GETPARAM_GRAPH_UNITS) results
in a kernel NULL pointer dereference, causing a crash when userspace (GNOME/Mesa) attempts to probe the device.Add safety checks for 'gr', '
gr->func', and 'nvkm_device->func' in the
ioctl handler. Return-ENODEVto signal the missing hardware state to userspace, and useNV_ERROR_ONCEto provide diagnostic proof in the kernel log without risking a console flood.Quoted 7 lines
RFC:
These crashes may not be repeatable, they happened while I was trying to build nouveau as a builtin module, with binary blobs in the kernel image, on a laptop with an encrypted disk. Gemini tells me this won't
work, so I punted.
Quoted 5 lines
"Gemini tells me this won't work, so I punted."
I'm sorry, what exactly do you mean here? And could you clarify what LLMs were used for in writing this series? Code generation, analysis, etc.?
Gemini CLI v0.50.0 - or earlier, at that time.
these were drive-by patches I did while testing a patchset on HW. The bootlogs showed a null ptr splat
I threw the logs to gemini, it tracked down the bug. the null ptr b4 deref was rather obvious.
at time of writing there was also some FW churn going on,
and it felt un-repeatable wo screwing with fwupd, which I wasnt gonna do. Plus the test scenario felt like it gonna fall apart.
Since then Ive been merging it into builds for HW installs, I recently forgot to merge them, and one occurred immediately
Sep 16 22:53:28 frodo kernel: Linux version 7.3.0-rc3-rhx-00051-g3078971ab959 (jimc@frodo) (gcc (GCC) 16.2.1 20260819 (Red Hat 16.2.1-2), GNU ld version 2.46.1-1.fc44) #> Sep 16 22:53:28 frodo kernel: Command line: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-7.3.0-rc3-rhx-00051-g3078971ab959 root=UUID=66f47421-b9ff-49ca-9257-0216463436c2 ro rootflags=s> Sep 16 22:53:28 frodo kernel: BIOS-provided physical RAM map: ... Sep 16 22:54:53 frodo kernel: BUG: kernel NULL pointer dereference, address: 00000000000000f0 Sep 16 22:54:53 frodo kernel: #PF: supervisor read access in kernel mode Sep 16 22:54:53 frodo kernel: #PF: error_code(0x0000) - not-present page Sep 16 22:54:53 frodo kernel: PGD 0 P4D 0 Sep 16 22:54:53 frodo kernel: Oops: Oops: 0000 [#3] SMP NOPTI Sep 16 22:54:53 frodo kernel: CPU: 2 UID: 60579 PID: 2445 Comm: gnome-shell Tainted: G D 7.3.0-rc3-rhx-00051-g3078971ab959 #10 PREEMPT(lazy) Sep 16 22:54:53 frodo kernel: Tainted: [D]=DIE Sep 16 22:54:53 frodo kernel: Hardware name: ASUSTeK COMPUTER INC. ASUS TUF Gaming A17 FA706QE_TUF706QE/FA706QE, BIOS FA706QE.311 11/06/2025 Sep 16 22:54:53 frodo kernel: RIP: 0010:nouveau_abi16_ioctl_get_zcull_info+0x17/0xa0 [nouveau] Sep 16 22:54:53 frodo kernel: Code: 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 47 40 48 8b 00 48 8b 80 70 02 00 00 <80> b8> Sep 16 22:54:53 frodo kernel: RSP: 0018:ffffd36e025dbbb0 EFLAGS: 00010202 Sep 16 22:54:53 frodo kernel: RAX: 0000000000000000 RBX: 0000000000000020 RCX: 0000000000000020 Sep 16 22:54:53 frodo kernel: RDX: ffff8c547be52600 RSI: ffffd36e025dbc50 RDI: ffff8c545440b800 Sep 16 22:54:53 frodo kernel: RBP: ffff8c547be52600 R08: ffffd36e025dbc50 R09: ffffd36e025dbc50 Sep 16 22:54:53 frodo kernel: R10: 0000000000000030 R11: ffff8c5454600098 R12: ffff8c545440b800 Sep 16 22:54:53 frodo kernel: R13: ffffffffc31569e0 R14: ffffd36e025dbc50 R15: 0000000080306453 Sep 16 22:54:53 frodo kernel: FS: 00007fa46fa77880(0000) GS:ffff8c576ab7a000(0000) knlGS:0000000000000000 Sep 16 22:54:53 frodo kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Sep 16 22:54:53 frodo kernel: CR2: 00000000000000f0 CR3: 000000011df78000 CR4: 0000000000f50ef0 Sep 16 22:54:53 frodo kernel: PKRU: 55555554 Sep 16 22:54:53 frodo kernel: Call Trace: Sep 16 22:54:53 frodo kernel: <TASK> Sep 16 22:54:53 frodo kernel: drm_ioctl_kernel+0xae/0x100 Sep 16 22:54:53 frodo kernel: drm_ioctl+0x2e0/0x560 Sep 16 22:54:53 frodo kernel: ? __pfx_nouveau_abi16_ioctl_get_zcull_info+0x10/0x10 [nouveau] Sep 16 22:54:53 frodo kernel: nouveau_drm_ioctl+0x58/0xc0 [nouveau] Sep 16 22:54:53 frodo kernel: __x64_sys_ioctl+0xb9/0x100 Sep 16 22:54:53 frodo kernel: ? do_syscall_64+0xfa/0x470 Sep 16 22:54:53 frodo kernel: do_syscall_64+0xbe/0x470
if youd like, I can trim that part of the commit - msg or just edit out the noise.
Quoted 4 lines
Quoted 3 lines
Signed-off-by Jim Cromie <[email protected]>
PATCH 2/2 drm/nouveau: Fix NULL pointer dereference in GET_ZCULL_INFO ioctl
In reply to Jim CromieWhen graphics engine firmware fails to load or initialization aborts early, nvxx_gr(drm) returns NULL. Calling DRM_IOCTL_NOUVEAU_GET_ZCULL_INFO causes nouveau_abi16_ioctl_get_zcull_info() to dereference gr at offset 0xf0 without checking for NULL, triggering a kernel page fault.
Validate that gr is non-NULL before inspecting gr->has_zcull_info.
---
Aug 14 09:21:52 frodo kernel: BUG: kernel NULL pointer dereference, address: 00000000000000f0 Aug 14 09:21:52 frodo kernel: #PF: error_code(0x0000) - not-present page Aug 14 09:21:52 frodo kernel: Oops: Oops: 0000 [#1] SMP NOPTI Aug 14 09:21:52 frodo kernel: RIP: 0010:nouveau_abi16_ioctl_get_zcull_info+0x17/0xa0 [nouveau] Aug 14 09:21:52 frodo kernel: Code: 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 47 40 48 8b 00 48 8b 80 70 02 00 00 <80> b8 f0 00 00 00 00 74 72 8b 90 c0 00 00 00 89 16 8b 90 c4 00 00 Aug 14 09:21:52 frodo kernel: Call Trace: Aug 14 09:21:52 frodo kernel: <TASK> Aug 14 09:21:52 frodo kernel: drm_ioctl_kernel+0xae/0x100 Aug 14 09:21:52 frodo kernel: drm_ioctl+0x2e0/0x560 Aug 14 09:21:52 frodo kernel: ? __pfx_nouveau_abi16_ioctl_get_zcull_info+0x10/0x10 [nouveau] Aug 14 09:21:52 frodo kernel: nouveau_drm_ioctl+0x58/0xc0 [nouveau] Aug 14 09:21:52 frodo kernel: __x64_sys_ioctl+0xb9/0x100 Aug 14 09:21:52 frodo kernel: do_syscall_64+0xe2/0x560 Aug 14 09:21:52 frodo kernel: entry_SYSCALL_64_after_hwframe+0x76/0x7e Aug 14 09:21:52 frodo kernel: </TASK> --- drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_abi16.c +1 -1
@@ -357,7 +357,7 @@ nouveau_abi16_ioctl_get_zcull_info(ABI16_IOCTL_ARGS)struct nvkm_gr *gr =nvxx_gr (drm);struct drm_nouveau_get_zcull_info *out = data; -if (gr->has_zcull_info) { +if (gr && gr->has_zcull_info) {const struct nvkm_gr_zcull_info *i = &gr->zcull_info; out->width_align_pixels = i->width_align_pixels;
Signature · 1 line
2.55.0
Re: [PATCH 2/2] drm/nouveau: Fix NULL pointer dereference in GET_ZCULL_INFO ioctl
Hi Jim, Lyude,
This one repeats here every time.
Setup: an RTX 3060 (GA106) passed through to a VM, kernel 7.3-rc1, Mesa 26.1.6 (Debian testing), firmware-nvidia-gsp not installed. nouveau probes with "gr: firmware unavailable", so nvxx_gr() is NULL. As soon as KWin starts, Mesa's NVK asks for the zcull info and the kernel oopses:
BUG: kernel NULL pointer dereference, address: 00000000000000f0 RIP: 0010:nouveau_abi16_ioctl_get_zcull_info+0x17/0xa0 [nouveau] Comm: kwin_wayland
kwin_wayland dies with it, so the whole session goes, not only acceleration.
With this patch alone the zcull oops is gone, but the next NULL dereference follows right away, in GETPARAM with NOUVEAU_GETPARAM_GRAPH_UNITS:
RIP: 0010:nvkm_gr_units+0x9/0x30 [nouveau]
With this patch plus Zhenhao Wan's "drm/nouveau: prevent NULL deref of gr in GETPARAM_GRAPH_UNITS", there is no oops: KWin starts and composites, and NVK refuses the device cleanly (vkEnumeratePhysicalDevices returns VK_ERROR_INITIALIZATION_FAILED).
To reproduce: a Turing or newer card on nouveau without firmware-nvidia-gsp, then start any Vulkan or zink client. Both fixes are needed for a desktop to survive a missing firmware package.
Whatever helped find it, the bug is real, it repeats, and the check is the obvious one.
Disclosure: I did this testing with an AI assistant, Claude Code (Claude Opus 5.5). It built the kernels, ran the VM and read the traces under my direction; I checked the results on the hardware.
For this patch, tested together with Zhenhao's:
Daniel
Re: [PATCH 2/2] drm/nouveau: Fix NULL pointer dereference in GET_ZCULL_INFO ioctl
hi Daniel,
thanks for testing this -
I didnt want to screw with my firmware,
but you're clearly prepared to do so.
I just sent rev-3, with another null-ptr fix I need locally. Im pretty certain the patch you tested is unchanged, but if you could test rev3 that would be marvelous.
fwiw - mine is a GA107
01:00.0 VGA compatible controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Ti Mobile] (rev a1) (prog-if 00 [VGA controller])
Subsystem: ASUSTeK Computer Inc. Device 125c
Physical Slot: 0
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupts: pin B disabled, MSI(X) routed to IRQ 101
IOMMU group: 10
Region 0: Memory at fb000000 (32-bit, non-prefetchable) [size=16M] Region 1: Memory at fe00000000 (64-bit, prefetchable) [size=4G] Region 3: Memory at ff00000000 (64-bit, prefetchable) [size=32M] Region 5: I/O ports at f000 [size=128]
Expansion ROM at fc000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nouveau
Kernel modules: nouveau
Quoted 44 lines · Daniel Campos Ramos
Hi Jim, Lyude,
This one repeats here every time.
Setup: an RTX 3060 (GA106) passed through to a VM, kernel 7.3-rc1, Mesa 26.1.6 (Debian testing), firmware-nvidia-gsp not installed. nouveau probes with "gr: firmware unavailable", sonvxx_gr()is NULL. As soon as KWin starts, Mesa's NVK asks for the zcull info and the kernel oopses:BUG: kernel NULL pointer dereference, address: 00000000000000f0 RIP: 0010:nouveau_abi16_ioctl_get_zcull_info+0x17/0xa0 [nouveau] Comm: kwin_wayland
kwin_waylanddies with it, so the whole session goes, not only acceleration.With this patch alone the zcull oops is gone, but the next NULL dereference follows right away, in GETPARAM with
NOUVEAU_GETPARAM_GRAPH_UNITS:RIP: 0010:nvkm_gr_units+0x9/0x30 [nouveau]With this patch plus Zhenhao Wan's "drm/nouveau: prevent NULL deref of gr in
GETPARAM_GRAPH_UNITS", there is no oops: KWin starts and composites, and NVK refuses the device cleanly (vkEnumeratePhysicalDevices returnsVK_ERROR_INITIALIZATION_FAILED).To reproduce: a Turing or newer card on nouveau without firmware-nvidia-gsp, then start any Vulkan or zink client. Both fixes are needed for a desktop to survive a missing firmware package.
Whatever helped find it, the bug is real, it repeats, and the check is the obvious one.Disclosure: I did this testing with an AI assistant, Claude Code (Claude Opus 5.5). It built the kernels, ran the VM and read the traces under my direction; I checked the results on the hardware.
For this patch, tested together with Zhenhao's:
Tested-by Daniel Campos Ramos <[email protected]>Daniel