#!/usr/bin/env python3 """Execute exact selected fault-buffer HAL instructions; mock only MMIO/memset/logging.""" import argparse,hashlib,json,struct,warnings from pathlib import Path warnings.filterwarnings('ignore',category=UserWarning,module='unicorn') from elftools.elf.elffile import ELFFile from unicorn import Uc,UC_ARCH_X86,UC_MODE_64,UC_HOOK_CODE from unicorn.x86_const import * parser=argparse.ArgumentParser();parser.add_argument('--check',action='store_true');args=parser.parse_args() R=Path(__file__).resolve().parents[1] P=Path('/home/geodd/nvidia-driver/analysis-580.178.04/extracted/kernel/nvidia/nv-kernel.o_binary') TEXT=0x10000000;DATA=0x30000000;STACK=0x40000000;STUB=0x50000000;STOP=0x60000000 GPU=DATA;FB=DATA+0x10000;DESCRIPTOR=DATA+0x20000;BUFFER=DATA+0x30000 names=['_nv040647rm','_nv040712rm','_nv040984rm'];hooks={} with P.open('rb') as f: e=ELFFile(f);syms=list(e.get_section_by_name('.symtab').iter_symbols());defined={s.name:s for s in syms};text=bytearray(e.get_section_by_name('.text').data());ti=e.get_section_index('.text');functions={n:(defined[n]['st_value'],defined[n]['st_size']) for n in names};undef={} for rel in e.get_section_by_name('.rela.text').iter_relocations(): o=rel['r_offset'] if not any(a<=o