Now that we have the load_info struct all initialized (including info->name, which contains the name of the module) before module_sig_check(), make the load_info struct and hence module name available to mod_verify_sig() so that we can log the module name in the event of an error.
Showing the changes to kernel/module.c (1 of 3 files). Show all
Unified · Split
| @@ -307,26 +307,6 @@ int unregister_module_notifier(struct notifier_block *nb) · 306 unmodified lines | |||
| 307 | } | 307 | } |
| 308 | EXPORT_SYMBOL(unregister_module_notifier); | 308 | EXPORT_SYMBOL(unregister_module_notifier); |
| 309 | 309 | ||
| 310 | struct load_info { | ||
| 311 | const char *name; | ||
| 312 | /* pointer to module in temporary copy, freed at end of load_module() */ | ||
| 313 | struct module *mod; | ||
| 314 | Elf_Ehdr *hdr; | ||
| 315 | unsigned long len; | ||
| 316 | Elf_Shdr *sechdrs; | ||
| 317 | char *secstrings, *strtab; | ||
| 318 | unsigned long symoffs, stroffs; | ||
| 319 | struct _ddebug *debug; | ||
| 320 | unsigned int num_debug; | ||
| 321 | bool sig_ok; | ||
| 322 | #ifdef CONFIG_KALLSYMS | ||
| 323 | unsigned long mod_kallsyms_init_off; | ||
| 324 | #endif | ||
| 325 | struct { | ||
| 326 | unsigned int sym, str, mod, vers, info, pcpu; | ||
| 327 | } index; | ||
| 328 | }; | ||
| 329 | |||
| 330 | /* | 310 | /* |
| 331 | * We require a truly strong try_module_get(): 0 means success. | 311 | * We require a truly strong try_module_get(): 0 means success. |
| 332 | * Otherwise an error is returned due to ongoing or failed | 312 | * Otherwise an error is returned due to ongoing or failed |
| @@ -2778,7 +2758,7 @@ static int module_sig_check(struct load_info *info, int flags) · 2445 unmodified lines | |||
| 2778 | memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) { | 2758 | memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) { |
| 2779 | /* We truncate the module to discard the signature */ | 2759 | /* We truncate the module to discard the signature */ |
| 2780 | info->len -= markerlen; | 2760 | info->len -= markerlen; |
| 2781 | err = mod_verify_sig(mod, &info->len); | 2761 | err = mod_verify_sig(mod, info); |
| 2782 | } | 2762 | } |
| 2783 | 2763 | ||
| 2784 | if (!err) { | 2764 | if (!err) { |