MCPcopy Create free account
hub / github.com/qilingframework/qiling / lkm_get_init

Method lkm_get_init

qiling/loader/elf.py:423–438  ·  view source on GitHub ↗

Get file offset of the init_module function.

(self, elffile: ELFFile)

Source from the content-addressed store, hash-verified

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]:

Callers 1

load_driverMethod · 0.95

Calls 1

QlErrorELFFormatClass · 0.90

Tested by

no test coverage detected