mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
kallsyms: only build {,module_}kallsyms_on_each_symbol when required
kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used by the livepatching code, so don't build them if livepatching is not enabled. Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jessica Yu <jeyu@kernel.org>
This commit is contained in:
parent
013c1667cf
commit
3e3552056a
4 changed files with 12 additions and 25 deletions
|
@ -71,15 +71,14 @@ static inline void *dereference_symbol_descriptor(void *ptr)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KALLSYMS
|
|
||||||
/* Lookup the address for a symbol. Returns 0 if not found. */
|
|
||||||
unsigned long kallsyms_lookup_name(const char *name);
|
|
||||||
|
|
||||||
/* Call a function on each kallsyms symbol in the core kernel */
|
|
||||||
int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
|
int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
|
||||||
unsigned long),
|
unsigned long),
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
|
#ifdef CONFIG_KALLSYMS
|
||||||
|
/* Lookup the address for a symbol. Returns 0 if not found. */
|
||||||
|
unsigned long kallsyms_lookup_name(const char *name);
|
||||||
|
|
||||||
extern int kallsyms_lookup_size_offset(unsigned long addr,
|
extern int kallsyms_lookup_size_offset(unsigned long addr,
|
||||||
unsigned long *symbolsize,
|
unsigned long *symbolsize,
|
||||||
unsigned long *offset);
|
unsigned long *offset);
|
||||||
|
@ -108,14 +107,6 @@ static inline unsigned long kallsyms_lookup_name(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
|
||||||
struct module *,
|
|
||||||
unsigned long),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int kallsyms_lookup_size_offset(unsigned long addr,
|
static inline int kallsyms_lookup_size_offset(unsigned long addr,
|
||||||
unsigned long *symbolsize,
|
unsigned long *symbolsize,
|
||||||
unsigned long *offset)
|
unsigned long *offset)
|
||||||
|
|
|
@ -608,10 +608,6 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
|
||||||
/* Look for this name: can be of form module:name. */
|
/* Look for this name: can be of form module:name. */
|
||||||
unsigned long module_kallsyms_lookup_name(const char *name);
|
unsigned long module_kallsyms_lookup_name(const char *name);
|
||||||
|
|
||||||
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
|
||||||
struct module *, unsigned long),
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
extern void __noreturn __module_put_and_exit(struct module *mod,
|
extern void __noreturn __module_put_and_exit(struct module *mod,
|
||||||
long code);
|
long code);
|
||||||
#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code)
|
#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code)
|
||||||
|
@ -795,14 +791,6 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
|
||||||
struct module *,
|
|
||||||
unsigned long),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int register_module_notifier(struct notifier_block *nb)
|
static inline int register_module_notifier(struct notifier_block *nb)
|
||||||
{
|
{
|
||||||
/* no events will happen anyway, so this can always succeed */
|
/* no events will happen anyway, so this can always succeed */
|
||||||
|
@ -891,4 +879,8 @@ static inline bool module_sig_ok(struct module *module)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MODULE_SIG */
|
#endif /* CONFIG_MODULE_SIG */
|
||||||
|
|
||||||
|
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
||||||
|
struct module *, unsigned long),
|
||||||
|
void *data);
|
||||||
|
|
||||||
#endif /* _LINUX_MODULE_H */
|
#endif /* _LINUX_MODULE_H */
|
||||||
|
|
|
@ -177,6 +177,7 @@ unsigned long kallsyms_lookup_name(const char *name)
|
||||||
return module_kallsyms_lookup_name(name);
|
return module_kallsyms_lookup_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIVEPATCH
|
||||||
/*
|
/*
|
||||||
* Iterate over all symbols in vmlinux. For symbols from modules use
|
* Iterate over all symbols in vmlinux. For symbols from modules use
|
||||||
* module_kallsyms_on_each_symbol instead.
|
* module_kallsyms_on_each_symbol instead.
|
||||||
|
@ -198,6 +199,7 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_LIVEPATCH */
|
||||||
|
|
||||||
static unsigned long get_symbol_pos(unsigned long addr,
|
static unsigned long get_symbol_pos(unsigned long addr,
|
||||||
unsigned long *symbolsize,
|
unsigned long *symbolsize,
|
||||||
|
|
|
@ -4488,6 +4488,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIVEPATCH
|
||||||
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
||||||
struct module *, unsigned long),
|
struct module *, unsigned long),
|
||||||
void *data)
|
void *data)
|
||||||
|
@ -4518,6 +4519,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
||||||
mutex_unlock(&module_mutex);
|
mutex_unlock(&module_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_LIVEPATCH */
|
||||||
#endif /* CONFIG_KALLSYMS */
|
#endif /* CONFIG_KALLSYMS */
|
||||||
|
|
||||||
/* Maximum number of characters written by module_flags() */
|
/* Maximum number of characters written by module_flags() */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue