Merge tag 'modules-for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux
Pull modules updates from Jessica Yu: "Code cleanups: more informative error messages and statically initialize init_free_wq to avoid a workqueue warning" * tag 'modules-for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux: module: statically initialize init section freeing data module: Add more error message for failed kernel module loading
This commit is contained in:
@@ -92,8 +92,9 @@ EXPORT_SYMBOL_GPL(module_mutex);
|
|||||||
static LIST_HEAD(modules);
|
static LIST_HEAD(modules);
|
||||||
|
|
||||||
/* Work queue for freeing init sections in success case */
|
/* Work queue for freeing init sections in success case */
|
||||||
static struct work_struct init_free_wq;
|
static void do_free_init(struct work_struct *w);
|
||||||
static struct llist_head init_free_list;
|
static DECLARE_WORK(init_free_wq, do_free_init);
|
||||||
|
static LLIST_HEAD(init_free_list);
|
||||||
|
|
||||||
#ifdef CONFIG_MODULES_TREE_LOOKUP
|
#ifdef CONFIG_MODULES_TREE_LOOKUP
|
||||||
|
|
||||||
@@ -2097,9 +2098,12 @@ static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < hdr->e_shnum; i++) {
|
for (i = 0; i < hdr->e_shnum; i++) {
|
||||||
if ((sechdrs[i].sh_flags & shf_wx) == shf_wx)
|
if ((sechdrs[i].sh_flags & shf_wx) == shf_wx) {
|
||||||
|
pr_err("%s: section %s (index %d) has invalid WRITE|EXEC flags\n",
|
||||||
|
mod->name, secstrings + sechdrs[i].sh_name, i);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3591,14 +3595,6 @@ static void do_free_init(struct work_struct *w)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init modules_wq_init(void)
|
|
||||||
{
|
|
||||||
INIT_WORK(&init_free_wq, do_free_init);
|
|
||||||
init_llist_head(&init_free_list);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
module_init(modules_wq_init);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is where the real work happens.
|
* This is where the real work happens.
|
||||||
*
|
*
|
||||||
@@ -3841,8 +3837,10 @@ static int load_module(struct load_info *info, const char __user *uargs,
|
|||||||
char *after_dashes;
|
char *after_dashes;
|
||||||
|
|
||||||
err = elf_header_check(info);
|
err = elf_header_check(info);
|
||||||
if (err)
|
if (err) {
|
||||||
|
pr_err("Module has invalid ELF header\n");
|
||||||
goto free_copy;
|
goto free_copy;
|
||||||
|
}
|
||||||
|
|
||||||
err = setup_load_info(info, flags);
|
err = setup_load_info(info, flags);
|
||||||
if (err)
|
if (err)
|
||||||
@@ -3850,6 +3848,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
|
|||||||
|
|
||||||
if (blacklisted(info->name)) {
|
if (blacklisted(info->name)) {
|
||||||
err = -EPERM;
|
err = -EPERM;
|
||||||
|
pr_err("Module %s is blacklisted\n", info->name);
|
||||||
goto free_copy;
|
goto free_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user