mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
- 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
18 lines
2.5 KiB
Python
18 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Check the built diagnostic module before any load; no hardware access."""
|
|
import hashlib,json,re,subprocess
|
|
from pathlib import Path
|
|
root=Path(__file__).resolve().parents[1]
|
|
obj=root/'kernel-open/nvidia/nv-rust.o_binary';module=root/'kernel-open/nvidia_rs.ko'
|
|
def run(*args):return subprocess.check_output(args,text=True)
|
|
assembly=run('objdump','-drC',str(obj));relocs=run('readelf','-rW',str(module));sections=run('readelf','-SW',str(obj));symbols=run('nm','--defined-only',str(obj));undefined=run('nm','-u',str(module));frames={};fn=''
|
|
for line in assembly.splitlines():
|
|
m=re.search(r'^[0-9a-f]+ <(.+)>:$',line)
|
|
if m:fn=m[1]
|
|
m=re.search(r'\bsub\s+\$0x([0-9a-f]+),%rsp',line)
|
|
if m:frames[fn]=frames.get(fn,0)+int(m[1],16)
|
|
if re.search(r'\bpush\s',line):frames[fn]=frames.get(fn,0)+8
|
|
checks={'no_unresolved_private_or_Rust_runtime_symbols':not re.search(r'\b(?:nv_rs_|_RNv|_ZN|__rust_|rust_eh_personality)',undefined),'no_unsupported_GOT_relocations':'GOT'not in relocs,'no_SIMD_x87_registers':not re.search(r'%(?:[xyz]mm\d+|mm\d+|st(?:\(|\b))',assembly),'no_Rust_unwind_sections':not re.search(r'\.eh_frame|\.gcc_except_table',sections),'bounded_fixed_function_stack':max(frames.values(),default=0)<=1024,'no_dynamic_RSP_subtraction':not re.search(r'\bsub\s+%[^,]+,%rsp',assembly),'no_RSP_redzone_reference':not re.search(r'-0x[\da-f]+\(%rsp\)',assembly),'protocol_exports_present':all('nv_rs_'+s in symbols for s in ['protocol_version','gpu_capabilities','event_selftest','gpu_prepare_owned','gpu_set_probe_identity','gpu_registry_publish','gpu_registry_retire','sysmem_prepare','sysmem_close']),'distinct_diagnostic_module_name':run('modinfo','-F','name',str(module)).strip()=='nvidia_rs','no_PCI_aliases':not run('modinfo','-F','alias',str(module)).strip()}
|
|
report={'passed':all(checks.values()),'checks':checks,'largest_conservative_function_stack_bytes':max(frames.values(),default=0),'object_sha256':hashlib.sha256(obj.read_bytes()).hexdigest(),'module_sha256':hashlib.sha256(module.read_bytes()).hexdigest(),'undefined_kernel_symbols':undefined.splitlines(),'scope':'Static codegen/export checks for the current diagnostic module only. Per-function stack accounting is not a full call-chain proof; this does not prove GPU initialization, CUDA, hardware ownership or parity.'}
|
|
(root/'reports/kernel-module-codegen-validation.json').write_text(json.dumps(report,indent=2)+'\n');print(json.dumps({'passed':report['passed'],'checks':checks,'largest_stack':report['largest_conservative_function_stack_bytes']}));raise SystemExit(0 if report['passed']else 1)
|