Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+11 -12
+11 -12
kernel/module.c
··· 92 92 static LIST_HEAD(modules); 93 93 94 94 /* Work queue for freeing init sections in success case */ 95 - static struct work_struct init_free_wq; 96 - static struct llist_head init_free_list; 95 + static void do_free_init(struct work_struct *w); 96 + static DECLARE_WORK(init_free_wq, do_free_init); 97 + static LLIST_HEAD(init_free_list); 97 98 98 99 #ifdef CONFIG_MODULES_TREE_LOOKUP 99 100 ··· 2098 2097 int i; 2099 2098 2100 2099 for (i = 0; i < hdr->e_shnum; i++) { 2101 - if ((sechdrs[i].sh_flags & shf_wx) == shf_wx) 2100 + if ((sechdrs[i].sh_flags & shf_wx) == shf_wx) { 2101 + pr_err("%s: section %s (index %d) has invalid WRITE|EXEC flags\n", 2102 + mod->name, secstrings + sechdrs[i].sh_name, i); 2102 2103 return -ENOEXEC; 2104 + } 2103 2105 } 2104 2106 2105 2107 return 0; ··· 3595 3591 } 3596 3592 } 3597 3593 3598 - static int __init modules_wq_init(void) 3599 - { 3600 - INIT_WORK(&init_free_wq, do_free_init); 3601 - init_llist_head(&init_free_list); 3602 - return 0; 3603 - } 3604 - module_init(modules_wq_init); 3605 - 3606 3594 /* 3607 3595 * This is where the real work happens. 3608 3596 * ··· 3837 3841 char *after_dashes; 3838 3842 3839 3843 err = elf_header_check(info); 3840 - if (err) 3844 + if (err) { 3845 + pr_err("Module has invalid ELF header\n"); 3841 3846 goto free_copy; 3847 + } 3842 3848 3843 3849 err = setup_load_info(info, flags); 3844 3850 if (err) ··· 3848 3850 3849 3851 if (blacklisted(info->name)) { 3850 3852 err = -EPERM; 3853 + pr_err("Module %s is blacklisted\n", info->name); 3851 3854 goto free_copy; 3852 3855 } 3853 3856