Get file offset of the init_module function.
(self, elffile: ELFFile)
| 421 | self.ql.mem.write(vsyscall_addr + i * entry_size, entry.ljust(entry_size, b'\xcc')) |
| 422 | |
| 423 | def lkm_get_init(self, elffile: ELFFile) -> int: |
| 424 | """Get file offset of the init_module function. |
| 425 | """ |
| 426 | |
| 427 | symbol_tables = (sec for sec in elffile.iter_sections() if type(sec) is SymbolTableSection) |
| 428 | |
| 429 | for sec in symbol_tables: |
| 430 | syms = sec.get_symbol_by_name('init_module') |
| 431 | |
| 432 | if syms: |
| 433 | sym = syms[0] |
| 434 | addr = sym['st_value'] + elffile.get_section(sym['st_shndx'])['sh_offset'] |
| 435 | |
| 436 | return addr |
| 437 | |
| 438 | raise QlErrorELFFormat('invalid module: symbol init_module not found') |
| 439 | |
| 440 | def lkm_dynlinker(self, elffile: ELFFile, mem_start: int) -> Mapping[str, int]: |
| 441 | def __get_symbol(name: str) -> Optional[Symbol]: |
no test coverage detected