Subject: + kernel-add-support-for-init_array-constructors-fix.patch added to -mm tree To: rusty@xxxxxxxxxxxxxxx,agospoda@xxxxxxxxxx,arnd@xxxxxxxx,fhrbata@xxxxxxxxxx,jstancek@xxxxxxxxxx,keescook@xxxxxxxxxxxx,peter.oberparleiter@xxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Mon, 23 Sep 2013 14:14:09 -0700 The patch titled Subject: kernel: add support for init_array constructors has been added to the -mm tree. Its filename is kernel-add-support-for-init_array-constructors-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kernel-add-support-for-init_array-constructors-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kernel-add-support-for-init_array-constructors-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Rusty Russell <rusty@xxxxxxxxxxxxxxx> Subject: kernel: add support for init_array constructors v2: - reuse mod->ctors for .init_array section for modules, because gcc uses .ctors or .init_array, but not both at the same time v3: - fail to load if that does happen somehow. Signed-off-by: Frantisek Hrbata <fhrbata@xxxxxxxxxx> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx> Cc: Jan Stancek <jstancek@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Peter Oberparleiter <peter.oberparleiter@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Andy Gospodarek <agospoda@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/module.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff -puN kernel/module.c~kernel-add-support-for-init_array-constructors-fix kernel/module.c --- a/kernel/module.c~kernel-add-support-for-init_array-constructors-fix +++ a/kernel/module.c @@ -2738,7 +2738,7 @@ static int check_modinfo(struct module * return 0; } -static void find_module_sections(struct module *mod, struct load_info *info) +static int find_module_sections(struct module *mod, struct load_info *info) { mod->kp = section_objs(info, "__param", sizeof(*mod->kp), &mod->num_kp); @@ -2771,6 +2771,15 @@ static void find_module_sections(struct if (!mod->ctors) mod->ctors = section_objs(info, ".init_array", sizeof(*mod->ctors), &mod->num_ctors); + else if (find_sec(info, ".init_array")) { + /* + * This shouldn't happen with same compiler and binutils + * building all parts of the module. + */ + printk(KERN_WARNING "%s: has both .ctors and .init_array.\n", + mod->name); + return -EINVAL; + } #endif #ifdef CONFIG_TRACEPOINTS @@ -2809,6 +2818,8 @@ static void find_module_sections(struct info->debug = section_objs(info, "__verbose", sizeof(*info->debug), &info->num_debug); + + return 0; } static int move_module(struct module *mod, struct load_info *info) @@ -3266,7 +3277,9 @@ static int load_module(struct load_info /* Now we've got everything in the final locations, we can * find optional sections. */ - find_module_sections(mod, info); + err = find_module_sections(mod, info); + if (err) + goto free_unload; err = check_module_license_and_versions(mod); if (err) _ Patches currently in -mm which might be from rusty@xxxxxxxxxxxxxxx are scripts-sortextable-support-objects-with-more-than-64k-sections.patch gcov-move-gcov-structs-definitions-to-a-gcc-version-specific-file.patch gcov-add-support-for-gcc-47-gcov-format.patch gcov-compile-specific-gcov-implementation-based-on-gcc-version.patch kernel-add-support-for-init_array-constructors.patch kernel-add-support-for-init_array-constructors-fix.patch kernel-gcov-fsc-use-pr_warn.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html