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

Configure Feed

Select the types of activity you want to include in your feed.

module: deprecate usage of *_gpl sections in module loader

The *_gpl section are not being used populated by modpost anymore. Hence
the module loader doesn't need to find and process these sections in
modules.

This patch also simplifies symbol finding logic in module loader since
*_gpl sections don't have to be searched anymore.

Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>

authored by

Siddharth Nayyar and committed by
Sami Tolvanen
b4760ff2 55fcb926

+18 -34
-3
include/linux/module.h
··· 435 435 unsigned int num_kp; 436 436 437 437 /* GPL-only exported symbols. */ 438 - unsigned int num_gpl_syms; 439 - const struct kernel_symbol *gpl_syms; 440 - const u32 *gpl_crcs; 441 438 bool using_gplonly_symbols; 442 439 443 440 #ifdef CONFIG_MODULE_SIG
-3
kernel/module/internal.h
··· 53 53 /* Provided by the linker */ 54 54 extern const struct kernel_symbol __start___ksymtab[]; 55 55 extern const struct kernel_symbol __stop___ksymtab[]; 56 - extern const struct kernel_symbol __start___ksymtab_gpl[]; 57 - extern const struct kernel_symbol __stop___ksymtab_gpl[]; 58 56 extern const u32 __start___kcrctab[]; 59 - extern const u32 __start___kcrctab_gpl[]; 60 57 extern const u8 __start___kflagstab[]; 61 58 62 59 #define KMOD_PATH_LEN 256
+18 -28
kernel/module/main.c
··· 1495 1495 */ 1496 1496 static int verify_exported_symbols(struct module *mod) 1497 1497 { 1498 - unsigned int i; 1499 1498 const struct kernel_symbol *s; 1500 - struct { 1501 - const struct kernel_symbol *sym; 1502 - unsigned int num; 1503 - } arr[] = { 1504 - { mod->syms, mod->num_syms }, 1505 - { mod->gpl_syms, mod->num_gpl_syms }, 1506 - }; 1507 - 1508 - for (i = 0; i < ARRAY_SIZE(arr); i++) { 1509 - for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { 1510 - struct find_symbol_arg fsa = { 1511 - .name = kernel_symbol_name(s), 1512 - .gplok = true, 1513 - }; 1514 - if (find_symbol(&fsa)) { 1515 - pr_err("%s: exports duplicate symbol %s" 1516 - " (owned by %s)\n", 1517 - mod->name, kernel_symbol_name(s), 1518 - module_name(fsa.owner)); 1519 - return -ENOEXEC; 1520 - } 1499 + for (s = mod->syms; s < mod->syms + mod->num_syms; s++) { 1500 + struct find_symbol_arg fsa = { 1501 + .name = kernel_symbol_name(s), 1502 + .gplok = true, 1503 + }; 1504 + if (find_symbol(&fsa)) { 1505 + pr_err("%s: exports duplicate symbol %s (owned by %s)\n", 1506 + mod->name, kernel_symbol_name(s), 1507 + module_name(fsa.owner)); 1508 + return -ENOEXEC; 1521 1509 } 1522 1510 } 1523 1511 return 0; ··· 2663 2675 mod->syms = section_objs(info, "__ksymtab", 2664 2676 sizeof(*mod->syms), &mod->num_syms); 2665 2677 mod->crcs = section_addr(info, "__kcrctab"); 2666 - mod->gpl_syms = section_objs(info, "__ksymtab_gpl", 2667 - sizeof(*mod->gpl_syms), 2668 - &mod->num_gpl_syms); 2669 - mod->gpl_crcs = section_addr(info, "__kcrctab_gpl"); 2670 2678 mod->flagstab = section_addr(info, "__kflagstab"); 2679 + 2680 + if (section_addr(info, "__ksymtab_gpl")) 2681 + pr_warn("%s: ignoring obsolete section __ksymtab_gpl\n", 2682 + mod->name); 2683 + if (section_addr(info, "__kcrctab_gpl")) 2684 + pr_warn("%s: ignoring obsolete section __kcrctab_gpl\n", 2685 + mod->name); 2671 2686 2672 2687 #ifdef CONFIG_CONSTRUCTORS 2673 2688 mod->ctors = section_objs(info, ".ctors", ··· 2881 2890 return -ENOEXEC; 2882 2891 } 2883 2892 #ifdef CONFIG_MODVERSIONS 2884 - if ((mod->num_syms && !mod->crcs) || 2885 - (mod->num_gpl_syms && !mod->gpl_crcs)) { 2893 + if (mod->num_syms && !mod->crcs) { 2886 2894 return try_to_force_load(mod, 2887 2895 "no versions for exported symbols"); 2888 2896 }