Cluster 2 (RMAPI/UVM/Locking/Memory P0s):
- Convert runtime_start_users to atomic_t so wait_event() in
nv_rs_rmapi_node_gpu_remove never calls mutex_lock while !TASK_RUNNING.
- Guard all 6 unlocked nv_rs_alloc_reg_find() call sites in rmapi_node.c with
nv_rs_rmapi_alloc_lock.
- Run nv_rs_rmapi_rc_recover_fault while nv_rs_rmapi_lock is held from
nv_rs_rmapi_node_trylock() in nv_rs_uvm_fault_work_fn (no blocking re-lock).
- Filter MANAGED_RANGES and PAGE_TREES by UvmFile owner in uvm_node.rs to
prevent cross-process managed_unmap UAF; use flush_gpu_tlb_trylock() +
TLB_FLUSH_PENDING deferral so .mmap/vm_ops->close never touch LIVE_ENGINES
without nv_rs_rmapi_lock.
- Pin FD-exported memory backings in memory::Table::export_pins and check via
shared backing_shares_resource() so export -> free original -> import never
UAFs; release orphaned backings on FD owner close.
- Fix Backing::System map_protection(flags), deduplicate video_allocated_bytes,
and unmap Backing::Register in drop_mappings.
Cluster 4 (Kernel Build Hygiene & Linux 5.15-7.3 Compat P0s):
- Factor shared kernel-open/compat_probes.mk for Kbuild + build_guest_test.sh
(fixing Linux 5.15 char *date probe and Linux 7.0+ guest_build).
- Extend tools/prepare_kernel_archive.py to strip all kernel-exported
compiler_builtins mem/string members (strlen/memcpy/memmove/memset/memcmp/bcmp)
and wire it into tools/vm/build_guest_test.sh.
- Fix tools/check_kernel_module.py no_unhardened_sls_return to check per-ret
int3 succession instead of file-wide has_int3.
- Set AR=llvm-ar / NM=llvm-nm under LLVM=1 in utils.mk, LC_ALL=C and non-rustup
fallback in verify_rust_guest.py/check_native_codegen.py, and 1024 MiB guest RAM.
Validated: cargo fmt/clippy/test (958+2), test_gate_cases.py (24/24),
test_kernel_archive.py (5/5), NV_RS_KERNEL_IBT=0 & 1 make modules +
check_kernel_module.py (largest_stack=1000), QEMU EDU verify_rust_guest.py.
GSP_SET_SYSTEM_INFO went to GSP-RM with acpiMethodData and bIsPrimary
left zero. On an Optimus laptop nouveau (r535/r570_gsp_acpi_info) and
OpenRM fill them from the GPU's ACPI node: the _DOD display list, the JT
_DSM capabilities and the NVOP Optimus capabilities. Do the same, at the
580.178.04 GspSystemInfo offsets (acpiMethodData 0xa0..0x344, bIsPrimary
0x380), and log what was found:
ga10x: ACPI sysinfo: primary=0 dod=0(n=1) jt=0(caps=20016003) opt=0(caps=19000059)
This did not by itself fix the GA107 boot (the sysmem flush page did,
programmed since #145),
and it has not been tested in isolation; it brings the system info in
line with what the other drivers send on Optimus systems. Only x86 with
CONFIG_ACPI evaluates the methods.
bIsPrimary comes from video_is_primary_device() where <asm/video.h> has
it (6.9+, probed in Kbuild) and from the VGA arbiter's default device
before that.
Also report an I/O BAR to GSP-RM only when PCI_COMMAND_IO is enabled:
the GA107 exposes an I/O BAR that the platform leaves disabled.
The C port (ga102_gsp.c, ga102_rm.c, ga102_glue.c) is replaced by Rust under src/nvidia/ with a thin MIT C adapter:
- src/nvidia/src/gpu/ga10x_gsp.rs (core, no unsafe): VBIOS / FWSEC / Booter parsing with every offset
bounds-checked, signature choice from the fuse version, FWSEC DMEM patch (FRTS, SB), FB and WPR2 layout, radix3,
LibOS arguments, queue headers, element framing and checksum, system info, registry, static info. Unit tests use
the 3090's numbers.
- src/nvidia/src/gpu/gsp_ucode.rs: GA10x bootloader and Booter Load/Unload from NVIDIA's MIT bindata at 580.178.04
(licenses/gsp-rm-boot-ga102-mit.txt).
- src/nvidia/kernel/ga10x_gsp.rs: the live boot (FWSEC-FRTS, Booter Load, RISC-V bootloader, LibOS, CPU sequencer,
INIT_DONE), the RPC transport on GSP-RM's shared-memory queues, and the unload (UNLOADING_GUEST_DRIVER,
FWSEC-SB, Booter Unload; falcons reset before any DMA memory is freed).
- src/nvidia/kernel/ga10x.rs: per-GPU state and RM RPCs. The slot table publishes a GPU with a release store only
after every field is written (FREE -> BOOTING -> ACTIVE -> ENDING); readers acquire; a second boot of the same
GPU backs off. This replaces install_external_session and its publication race.
- src/nvidia/kernel/ga10x_mem.rs, ga10x_objects.rs: the kernel side of split RM (heap split, BAR1 1:1, VA spaces,
TSG, ctxshare, channel, golden context, work submit token, time correlation).
- src/nvidia/kernel/ga10x_events.rs: RM events through irq_adapter (GA10x MSI; GV100 chained around
LIVE_IRQ_OPS), posted from the IRQ thread.
- src/nvidia/kernel/gsp_route.rs: routing of the client's RM calls, with NVIDIA's control flags enforced (INTERNAL
refused, PRIVILEGED needs admin, kernel-only refused, parameter size, owner).
- kernel-open/nvidia/ga10x_adapter.c: log lines, sleep, PCI info and config, BAR0 fill, CPU clocks, credentials,
three module parameters: ga10x_gsp (default 1; 0 leaves GA10x to gsp_bringup's own path), ga10x_events,
gsp_route_trace.
rmapi/gpu.rs: the usermode window (0xc561) is allowed on GA10x too; c9c4706 allowed the class but not the window.
Tested on an RTX 3090 + V100: CUDA on both, P2P both ways, NCCL all_reduce over P2P, blocking sync through RM
events, NVIDIA's 580 back after every unload, 0 Xid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
make counts every '(' inside $(shell ...) regardless of shell quoting, so
'pci_resize_resource\(struct pci_dev' leaves the ifeq unbalanced and every
build fails with 'Kbuild:5: *** invalid syntax in conditional'.
Match on the function name and let the existing -A2 context + grep for
exclude_bars keep the original intent.
Two independent upstream changes broke the kernel-open modules on current
kernels, both reported against this tree (issue #34 and #18):
- <linux/of_gpio.h> is gone from current headers, so uvm_bridge.c failed to
compile before any of its code was read. Probe for the header and fall back
to <linux/gpio/consumer.h>, where the legacy OF GPIO helpers now live; the
bridge itself references no of_* or gpio_* symbol, so either include keeps
the same declarations available.
- pahole cannot recode rustc's DWARF for BTF and aborts with
"tag__recode_dwarf_type: couldn't find ... (inlined_subroutine)", which fails
the BTF step of module linking on CONFIG_DEBUG_INFO_BTF kernels. Strip the
Rust object's debug info when BTF is enabled; code, relocations and exported
symbols are unchanged.
struct drm_driver.date needs no change: it was removed upstream in 6.14
(cb2e1c2136f7) and is already guarded, so nvidia_rs_drm.ko builds as-is.
Verified on Linux 7.3.0-11-generic: make modules (all four modules, checks
pass), make uvm-bridge now links nvidia_rs_uvm_bridge.ko, and pahole -J on the
linked nvidia_rs.ko exits 0 and writes .BTF where it previously aborted.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
exclude_bars arrived in 6.19 and was backported to 6.18 stable, so a
LINUX_VERSION_CODE >= 6.19 check misses those trees. Key the fourth
argument off the declaration in include/linux/pci.h, the same way
PCI_IRQ_INTX is keyed off the macro.
- kernel-open/Kbuild defines NV_RS_PCI_RESIZE_EXCLUDE_BARS when pci.h
declares exclude_bars.
- pci_adapter.c prefers that macro, then the 6.19 and Ubuntu checks.
- docs/KERNEL_COMPAT.md records the guard.
- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime
- Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after)
- Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps