open-gpu-kernel-modules icon indicating copy to clipboard operation
open-gpu-kernel-modules copied to clipboard

Crash in `nvidia_vma_access`

Open hvenev-insait opened this issue 7 months ago • 3 comments

NVIDIA Open GPU Kernel Modules Version

595.58.03

Please confirm this issue does not happen with the proprietary driver (of the same version). This issue tracker is only for bugs specific to the open kernel driver.

  • [ ] I confirm that this does not happen with the proprietary driver package.

Operating System and Version

Debian 13

Kernel Release

6.18.21

Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.

  • [x] I am running on a stable kernel release.

Hardware: GPU

GPU 0: NVIDIA RTX A6000 (UUID: GPU-a8786325-872d-f33a-6b4a-afe9ff6a9783) GPU 1: NVIDIA RTX A6000 (UUID: GPU-9d07d567-97b1-7ded-dafc-9e49be4decbf) GPU 2: NVIDIA RTX A6000 (UUID: GPU-c3e4b380-e3d2-d25c-83eb-504308917eb1) GPU 3: NVIDIA RTX A6000 (UUID: GPU-e29202bb-289a-deb0-62ed-20390c094e3c) GPU 4: NVIDIA RTX A6000 (UUID: GPU-859eda35-2554-7da2-b14d-08f16680bd0d) GPU 5: NVIDIA RTX A6000 (UUID: GPU-9fca2b4f-5285-3b02-94ab-da819d836327) GPU 6: NVIDIA RTX A6000 (UUID: GPU-53e224c9-2606-01fd-98ae-ac0c6b9085ea) GPU 7: NVIDIA RTX A6000 (UUID: GPU-7105642b-8ea3-b3e1-a179-159cbe1de056)

Describe the bug

In driver version 595.58.03, nvidia_vma_access is guaranteed to crash with a NULL pointer dereference if ever called.

mmap_context is initialized to NULL and immediately dereferenced.

To Reproduce

Open /proc/PID/mem and read from an offset corresponding to an address backed by a GPU memory mapping.

Bug Incidence

Always

nvidia-bug-report.log.gz

nvidia-bug-report.log.gz

More Info

No response

hvenev-insait avatar Apr 14 '26 08:04 hvenev-insait

Seeing the same issue. 100% reproducible when starting Anki on NixOS-unstable. https://github.com/ankitects/anki/issues/1767#issuecomment-4116024266

The panic does not occur with the proprietary driver (hardware.nvidia.open = false; Nix Option)

System:
  Host: nixos Kernel: 6.18.22 arch: x86_64 bits: 64
  Desktop: Cosmic v: N/A Distro: NixOS 26.05 (Yarara)
Graphics:
  Device-1: NVIDIA TU116 [GeForce GTX 1660 SUPER] driver: nvidia v: 595.58.03
  Display: wayland server: X.Org v: 24.1.9 with: Xwayland v: 24.1.9
    compositor: cosmic-comp driver: gpu: nv_platform,nvidia,nvidia-nvswitch
    resolution: 1920x1080~144Hz
  API: EGL v: 1.5 drivers: nvidia,swrast
    platforms: gbm,wayland,x11,surfaceless,device
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 595.58.03
    renderer: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
  Info: Tools: api: eglinfo,glxinfo gpu: nvidia-smi
    x11: xdpyinfo, xprop, xrandr

sollniss avatar Apr 18 '26 15:04 sollniss

I have encountered a similar problem with my NVIDIA GeForce RTX 3060 on a NixOS PC and the nvidia open driver.

Until about 5 weeks ago, I could use the programs calibre/ebook-viewer/ebook-edit or sigil. That was with the 580.142 driver.

Since then, those programs crash with the "BUG: kernel NULL pointer dereference, address: 0000000000000030" and "RIP: 0010:nvidia_vma_access+0x1b/0x350 [nvidia]" (from the systemd journal entries).

I have not (yet) tried the proprietary driver.

$ nix-info -m

  • system: "x86_64-linux"
  • host os: Linux 6.18.24, NixOS, 26.05 (Yarara), 26.05pre985613.0726a0ecb6d4
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.34.6
  • channels(root): "nixos"
  • channels(oo): "nixpkgs"
  • nixpkgs: /nix/store/a5g6nsf2iv7djiz5k9sv3wx7430vpnil-nixpkgs/nixpkgs

$ nix-shell -p inxi pciutils mesa-demos --run "inxi -Gx" Graphics: Device-1: NVIDIA GA106 [GeForce RTX 3060 Lite Hash Rate] driver: nvidia v: 595.58.03 arch: Ampere bus-ID: 26:00.0 Display: x11 server: X.org v: 1.21.1.22 driver: X: loaded: modesetting gpu: nv_platform,nvidia,nvidia-nvswitch resolution: 1: 3840x2160~60Hz 2: 3840x2160~60Hz API: EGL v: 1.5 drivers: nvidia,swrast platforms: active: gbm,x11,surfaceless,device inactive: wayland,device-1 API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 595.58.03 glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 3060/PCIe/SSE2 Info: Tools: api: clinfo, eglinfo, glxinfo gpu: nvidia-settings,nvidia-smi x11: xprop,xrandr

$ ebook-edit & journalctl -f Apr 28 10:17:39 nixos kernel: BUG: kernel NULL pointer dereference, address: 0000000000000030 Apr 28 10:17:39 nixos kernel: #PF: supervisor read access in kernel mode Apr 28 10:17:39 nixos kernel: #PF: error_code(0x0000) - not-present page Apr 28 10:17:39 nixos kernel: PGD 55c190067 P4D 55c190067 PUD 0 Apr 28 10:17:39 nixos kernel: Oops: Oops: 0000 [#1] SMP NOPTI Apr 28 10:17:39 nixos kernel: CPU: 0 UID: 1000 PID: 28651 Comm: python3.14 Tainted: G O 6.18.24 #1-NixOS PREEMPT(voluntary) Apr 28 10:17:39 nixos kernel: Tainted: [O]=OOT_MODULE Apr 28 10:17:39 nixos kernel: Hardware name: Micro-Star International Co., Ltd. MS-7B89/B450M MORTAR MAX (MS-7B89), BIOS 2.M1 08/19/2024 Apr 28 10:17:39 nixos kernel: RIP: 0010:nvidia_vma_access+0x1b/0x350 [nvidia] Apr 28 10:17:39 nixos kernel: Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 41 57 41 56 41 55 41 54 55 53 48 83 ec 20 48 8b 47 58 <4c> 8b 0c 25 30 00 00 00 4c 8b 3f 48 8b 68 18 4c 89 c8 48 c1 e8 1b Apr 28 10:17:39 nixos kernel: RSP: 0018:ffffcbec19e57d30 EFLAGS: 00010286 Apr 28 10:17:39 nixos kernel: RAX: ffff8b2212f16e40 RBX: 00007f5bf938e000 RCX: 0000000000000040 Apr 28 10:17:39 nixos kernel: RDX: ffff8b22b3bdd000 RSI: 00007f5bf938e000 RDI: ffff8b2212f83000 Apr 28 10:17:39 nixos kernel: RBP: 0000000000000040 R08: 0000000000000000 R09: ffffffffc2014870 Apr 28 10:17:39 nixos kernel: R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000008 Apr 28 10:17:39 nixos kernel: R13: ffff8b22b3bdd000 R14: 0000000000000000 R15: ffff8b22b3bdd000 Apr 28 10:17:39 nixos kernel: FS: 00007f5c1f98b780(0000) GS:ffff8b2f5ab46000(0000) knlGS:0000000000000000 Apr 28 10:17:39 nixos kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Apr 28 10:17:39 nixos kernel: CR2: 0000000000000030 CR3: 00000003d8767000 CR4: 0000000000350ef0 Apr 28 10:17:39 nixos kernel: Call Trace: Apr 28 10:17:39 nixos kernel: Apr 28 10:17:39 nixos kernel: __access_remote_vm+0x27a/0x380 Apr 28 10:17:39 nixos kernel: mem_rw+0x200/0x310 Apr 28 10:17:39 nixos kernel: vfs_read+0xbf/0x390 Apr 28 10:17:39 nixos kernel: ? srso_return_thunk+0x5/0x5f Apr 28 10:17:39 nixos kernel: ? __rseq_handle_notify_resume+0xa6/0x480 Apr 28 10:17:39 nixos kernel: __x64_sys_pread64+0x9c/0xd0 Apr 28 10:17:39 nixos kernel: do_syscall_64+0xb6/0x7c0 Apr 28 10:17:39 nixos kernel: ? srso_return_thunk+0x5/0x5f Apr 28 10:17:39 nixos kernel: entry_SYSCALL_64_after_hwframe+0x77/0x7f Apr 28 10:17:39 nixos kernel: RIP: 0033:0x7f5c1eea6922 Apr 28 10:17:39 nixos kernel: Code: 08 0f 85 51 36 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 66 2e 0f 1f 84 00 00 00 00 00 66 2e 0f 1f 84 00 00 00 00 00 66 Apr 28 10:17:39 nixos kernel: RSP: 002b:00007fffd6ee82b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000011 Apr 28 10:17:39 nixos kernel: RAX: ffffffffffffffda RBX: 00005b5a031cd420 RCX: 00007f5c1eea6922 Apr 28 10:17:39 nixos kernel: RDX: 0000000000000040 RSI: 00007fffd6ee83f0 RDI: 0000000000000020 Apr 28 10:17:39 nixos kernel: RBP: 00007fffd6ee82e0 R08: 0000000000000000 R09: 0000000000000000 Apr 28 10:17:39 nixos kernel: R10: 00007f5bf938e000 R11: 0000000000000246 R12: 00007f5bf938e000 Apr 28 10:17:39 nixos kernel: R13: 00007fffd6ee8370 R14: 00005b5a028cdeb0 R15: 0000000000000000 Apr 28 10:17:39 nixos kernel: Apr 28 10:17:39 nixos kernel: Modules linked in: snd_seq_dummy snd_hrtimer snd_seq xt_MASQUERADE xfrm_user xfrm_algo xt_set ip_set nft_chain_nat xt_addrtype overlay af_packet cfg80211 rfkill 8021q xt_conntrack xt_tcpudp ip6t_rpfilter ipt_rpfilter xt_pkttype nft_compat nf_tables sch_fq_codel nvidia_uvm(O) nvidia_drm(O) nls_iso8859_1 nls_cp437 vfat fat nvidia_modeset(O) edac_mce_amd edac_core intel_rapl_msr amd_atl ppdev ee1004 snd_hda_codec_alc662 snd_hda_codec_realtek_lib nvidia(O) intel_rapl_common snd_hda_codec_generic battery snd_hda_codec_nvhdmi polyval_clmulni snd_hda_codec_hdmi ghash_clmulni_intel snd_usb_audio snd_hda_intel sp5100_tco r8169 joydev watchdog snd_hda_codec mousedev rapl snd_ump realtek snd_hda_core snd_usbmidi_lib snd_intel_dspcfg snd_rawmidi mdio_devres snd_intel_sdw_acpi snd_seq_device of_mdio snd_hwdep ftdi_sio snd_pcm fixed_phy snd_timer fwnode_mdio i2c_piix4 libphy mc onboard_usb_dev evdev snd i2c_smbus k10temp mac_hid mdio_bus soundcore parport_pc rtc_cmos parport tiny_power_button gpio_amdpt gpio_generic Apr 28 10:17:39 nixos kernel: button wmi_bmof kvm_amd ccp kvm xt_nat x_tables br_netfilter drm_ttm_helper nf_nat ttm bridge nf_conntrack video atkbd libps2 wmi veth serio nf_defrag_ipv6 irqbypass tun ecc loop stp nf_defrag_ipv4 vivaldi_fmap llc fuse configfs nfnetlink dmi_sysfs ext4 crc16 mbcache jbd2 dm_crypt encrypted_keys trusted asn1_encoder tee hid_logitech_hidpp input_leds led_class hid_logitech_dj hid_generic usbhid hid sd_mod ahci libahci nvme libata nvme_core xhci_pci nvme_keyring scsi_mod xhci_hcd aesni_intel nvme_auth scsi_common hkdf dm_snapshot dm_bufio dm_mod efivarfs autofs4 Apr 28 10:17:39 nixos kernel: CR2: 0000000000000030 Apr 28 10:17:39 nixos kernel: ---[ end trace 0000000000000000 ]--- Apr 28 10:17:39 nixos kernel: RIP: 0010:nvidia_vma_access+0x1b/0x350 [nvidia] Apr 28 10:17:39 nixos kernel: Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 41 57 41 56 41 55 41 54 55 53 48 83 ec 20 48 8b 47 58 <4c> 8b 0c 25 30 00 00 00 4c 8b 3f 48 8b 68 18 4c 89 c8 48 c1 e8 1b Apr 28 10:17:39 nixos kernel: RSP: 0018:ffffcbec19e57d30 EFLAGS: 00010286 Apr 28 10:17:39 nixos kernel: RAX: ffff8b2212f16e40 RBX: 00007f5bf938e000 RCX: 0000000000000040 Apr 28 10:17:39 nixos kernel: RDX: ffff8b22b3bdd000 RSI: 00007f5bf938e000 RDI: ffff8b2212f83000 Apr 28 10:17:39 nixos kernel: RBP: 0000000000000040 R08: 0000000000000000 R09: ffffffffc2014870 Apr 28 10:17:39 nixos kernel: R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000008 Apr 28 10:17:39 nixos kernel: R13: ffff8b22b3bdd000 R14: 0000000000000000 R15: ffff8b22b3bdd000 Apr 28 10:17:39 nixos kernel: FS: 00007f5c1f98b780(0000) GS:ffff8b2f5ab46000(0000) knlGS:0000000000000000 Apr 28 10:17:39 nixos kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Apr 28 10:17:39 nixos kernel: CR2: 0000000000000030 CR3: 00000003d8767000 CR4: 0000000000350ef0 Apr 28 10:17:39 nixos kernel: note: python3.14[28651] exited with irqs disabled

rldp avatar Apr 25 '26 10:04 rldp

Hi folks, I just want to give an FYI that we've root-caused this internally at Coreweave. TL;DRl this is an early 595 bug that was fixed after 595.71. See full RCA below if interested.

Full RCA

The problem happens in this function → open-gpu-kernel-modules/kernel-open/nvidia/nv-mmap.c at 595.44.05 · NVIDIA/open-gpu-kernel-modules

nv_alloc_mapping_context_t *mmap_context = NULL;
...
bIsNuma = pfn_valid(mmap_context->access_start >> PAGE_SHIFT);
...
pfile_mapping_list = nv_acquire_file_va(&nvlfp->nvfp, NV_FALSE);
...
mmap_context = &(*pfile_mapping_list)->context;
mmap_context is initialized to NULL

Before acquiring the file state or checking validity OR EVEN assign mmap_context it tries to evaluate mmap_context->access_start. This by itself doesn’t break anything (though a language like Rust would have caught this) - so the above dereference becomes: NULL(0x0) + offsetof(access_start)(0x30) = 0x30:

0x00 alloc
0x08 page_index
0x10 page_array
0x18 num_pages
0x20 memArea.pRanges
0x28 memArea.numRanges
0x30 access_start

So CPU tries to read address 0x30 (see CR2=0x30 in the registers of the failure).

The trigger for this was a python3 process doing a read(2) from /proc/<pid>/mem which must have been an address that belongs to an NVIDIA GPU VMA thus our stack trace:

read(/proc/<pid>/mem)
  -> mem_rw()
  -> access_remote_vm()
  -> __access_remote_vm()
  -> vma->vm_ops->access(...)
  -> nvidia_vma_access()
  -> NULL deref

Fix

NVIDIA must have hit this internally because the actual deref cannot happen in any version after 595.71.05 because the early mmap_context->access_start dereference is gone. The bug also doesn’t exist in any of the 580 branches so this is strictly an early 595 bug.

sdimitro avatar Jun 12 '26 13:06 sdimitro