mirror of
https://github.com/dynup/kpatch
synced 2025-03-07 19:28:12 +00:00
Have lookup_open() also parse Module.symvers and add the resulting symbols
and their objnames to the lookup table. This code was essentially
cherry-picked from Josh Poimboeuf's lookup code found here:
8cdca59c88
That patch was modified to fix a bug in obj_read() (calling elf_end()
without strdup'ing the symbol name strings, which was causing null
dereferences) and to fix up the module name after reading it from
Module.symvers (replacing '-' with '_' and stripping the path prefixes).
Also, add lookup_exported_symbol_objname(), which looks up the objname of
an exported symbol by making use of the objname information obtained from
Module.symvers.
22 lines
694 B
C
22 lines
694 B
C
#ifndef _LOOKUP_H_
|
|
#define _LOOKUP_H_
|
|
|
|
struct lookup_table;
|
|
|
|
struct lookup_result {
|
|
unsigned long value;
|
|
unsigned long size;
|
|
unsigned long pos;
|
|
};
|
|
|
|
struct lookup_table *lookup_open(char *obj_path, char *symvers_path);
|
|
void lookup_close(struct lookup_table *table);
|
|
int lookup_local_symbol(struct lookup_table *table, char *name, char *hint,
|
|
struct lookup_result *result);
|
|
int lookup_global_symbol(struct lookup_table *table, char *name,
|
|
struct lookup_result *result);
|
|
int lookup_is_exported_symbol(struct lookup_table *table, char *name);
|
|
char *lookup_exported_symbol_objname(struct lookup_table *table, char *name);
|
|
|
|
#endif /* _LOOKUP_H_ */
|