mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
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.
45 lines
1.9 KiB
Makefile
45 lines
1.9 KiB
Makefile
# Shared Linux kernel header compatibility probes (5.15 through 7.3+).
|
|
# Included by kernel-open/Kbuild, kernel-open/uvm_bridge/Kbuild, and tools/vm/build_guest_test.sh.
|
|
ccflags-y += -DNV_RS_KBUILD_PROBED
|
|
|
|
NV_RS_PCI_H := $(srctree)/include/linux/pci.h
|
|
ifeq ($(shell grep -A2 -E 'pci_resize_resource' $(NV_RS_PCI_H) 2>/dev/null | grep -q exclude_bars && echo y),y)
|
|
ccflags-y += -DNV_RS_PCI_RESIZE_EXCLUDE_BARS
|
|
endif
|
|
|
|
NV_RS_TIMER_H := $(srctree)/include/linux/timer.h
|
|
ifeq ($(shell grep -q 'timer_delete_sync' $(NV_RS_TIMER_H) 2>/dev/null && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_TIMER_DELETE_SYNC
|
|
endif
|
|
|
|
NV_RS_MM_HEADERS := $(srctree)/include/linux/mm.h $(srctree)/include/linux/mm_types.h
|
|
ifeq ($(shell grep -qs 'vm_flags_set' $(NV_RS_MM_HEADERS) && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_VM_FLAGS_SET
|
|
endif
|
|
ifeq ($(shell grep -qs 'vma_flags_set_word' $(NV_RS_MM_HEADERS) && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_VMA_FLAGS_SET_WORD
|
|
endif
|
|
ifeq ($(shell grep -qs 'vma_start_write' $(NV_RS_MM_HEADERS) && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_VMA_START_WRITE
|
|
endif
|
|
|
|
# video_is_primary_device() moved to <asm/video.h> in 6.9 (fb_is_primary_device() before)
|
|
ifeq ($(shell grep -qs 'video_is_primary_device' $(srctree)/arch/$(SRCARCH)/include/asm/video.h $(srctree)/include/asm-generic/video.h && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_VIDEO_IS_PRIMARY_DEVICE
|
|
endif
|
|
|
|
NV_RS_MODULE_H := $(srctree)/include/linux/module.h
|
|
ifeq ($(shell grep -Eq 'MODULE_INFO\(import_ns,[[:space:]]*ns\)' $(NV_RS_MODULE_H) 2>/dev/null && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_MODULE_IMPORT_NS_STR
|
|
endif
|
|
|
|
NV_RS_HRTIMER_H := $(srctree)/include/linux/hrtimer.h
|
|
ifeq ($(shell grep -q 'hrtimer_setup' $(NV_RS_HRTIMER_H) 2>/dev/null && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_HRTIMER_SETUP
|
|
endif
|
|
|
|
NV_RS_DRM_DRV_H := $(srctree)/include/drm/drm_drv.h
|
|
ifeq ($(shell grep -Eq '(const[[:space:]]+)?char[[:space:]]+\*date;' $(NV_RS_DRM_DRV_H) 2>/dev/null && echo y),y)
|
|
ccflags-y += -DNV_RS_HAVE_DRM_DRIVER_DATE
|
|
endif
|