Skip to content

Commit

Permalink
module: Always have struct mod_tree_root
Browse files Browse the repository at this point in the history
In order to separate text and data, we need to setup
two rb trees.

This means that struct mod_tree_root is required even without
MODULES_TREE_LOOKUP.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
  • Loading branch information
Christophe Leroy authored and Luis Chamberlain committed Apr 5, 2022
1 parent 7337f92 commit 80b8bf4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 3 additions & 1 deletion kernel/module/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,17 @@ static inline void module_decompress_cleanup(struct load_info *info)
}
#endif

#ifdef CONFIG_MODULES_TREE_LOOKUP
struct mod_tree_root {
#ifdef CONFIG_MODULES_TREE_LOOKUP
struct latch_tree_root root;
#endif
unsigned long addr_min;
unsigned long addr_max;
};

extern struct mod_tree_root mod_tree;

#ifdef CONFIG_MODULES_TREE_LOOKUP
void mod_tree_insert(struct module *mod);
void mod_tree_remove_init(struct module *mod);
void mod_tree_remove(struct module *mod);
Expand Down
5 changes: 0 additions & 5 deletions kernel/module/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,13 @@ static void do_free_init(struct work_struct *w);
static DECLARE_WORK(init_free_wq, do_free_init);
static LLIST_HEAD(init_free_list);

#ifdef CONFIG_MODULES_TREE_LOOKUP
struct mod_tree_root mod_tree __cacheline_aligned = {
.addr_min = -1UL,
};

#define module_addr_min mod_tree.addr_min
#define module_addr_max mod_tree.addr_max

#else /* !CONFIG_MODULES_TREE_LOOKUP */
static unsigned long module_addr_min = -1UL, module_addr_max;
#endif /* CONFIG_MODULES_TREE_LOOKUP */

struct symsearch {
const struct kernel_symbol *start, *stop;
const s32 *crcs;
Expand Down

0 comments on commit 80b8bf4

Please sign in to comment.