mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
20 lines
1.7 KiB
Python
20 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Recover the exact original status-table row used by error-init group10."""
|
|
from pathlib import Path
|
|
import hashlib,json,struct
|
|
from elftools.elf.elffile import ELFFile
|
|
root=Path(__file__).resolve().parent.parent
|
|
source=Path('/home/geodd/nvidia-driver/analysis-580.178.04/extracted/kernel/nvidia/nv-kernel.o_binary')
|
|
with source.open('rb') as stream:
|
|
elf=ELFFile(stream);symbols=elf.get_section_by_name('.symtab')
|
|
function=next(s for s in symbols.iter_symbols() if s.name=='_nv031134rm')
|
|
rel=next(r for r in elf.get_section_by_name('.rela.text').iter_relocations() if r['r_offset']==function['st_value']+0x5a)
|
|
target=symbols.get_symbol(rel['r_info_sym']);section=elf.get_section(target['st_shndx'])
|
|
assert section.name=='.data'
|
|
offset=target['st_value']+rel['r_addend'];rows=[struct.unpack_from('<6I',section.data(),offset+i*24) for i in range(32)]
|
|
matches=[(i,row) for i,row in enumerate(rows) if row[0]==10]
|
|
assert matches==[(10,(10,0,8,3,0,0))]
|
|
report={'source_sha256':hashlib.sha256(source.read_bytes()).hexdigest(),'source_function':'_nv031134rm','original_text_relocation_offset':hex(function['st_value']+0x5a),'relative_function_relocation_offset':'0x5a','section':'.data','table_offset':hex(offset),'record_bytes':24,'rows':[list(row) for row in rows],'selected_group':10,'selected_row':list(matches[0][1]),'gpu_word_offset':'0x6d90','rust_update':'(old & !0x300) | 0x100','limits':'Only the exact group10 / sentinelb33b1500 / value1 call is implemented; other groups still require their actual state owners.'}
|
|
(root/'reports/gpu-gv100-error-policy-table.json').write_text(json.dumps(report,indent=2)+'\n')
|
|
print('Original relocation-backed group10 row verified:',matches[0])
|