Merge kcrctab entry fixes from Ard Biesheuvel: "This is a followup to [0] 'modversions: redefine kcrctab entries as relative CRC pointers', but since relative CRC pointers do not work in modules, and are actually only needed by powerpc with CONFIG_RELOCATABLE=y, I have made it a Kconfig selectable feature instead. First it introduces the MODULE_REL_CRCS Kconfig symbol, and adds the kbuild handling of it, i.e., modpost, genksyms and kallsyms. Then it switches all architectures to 32-bit CRC entries in kcrctab, where all architectures except powerpc with CONFIG_RELOCATABLE=y use absolute ELF symbol references as before" [0] http://marc.info/?l=linux-arch&m=148493613415294&w=2 * emailed patches from Ard Biesheuvel: module: unify absolute krctab definitions for 32-bit and 64-bit modversions: treat symbol CRCs as 32 bit quantities kbuild: modversions: add infrastructure for emitting relative CRCs
Showing the changes to include/linux (2 of 12 files). Show all
Unified · Split
| @@ -43,12 +43,19 @@ extern struct module __this_module; · 42 unmodified lines | ||
| 43 | 43 | #ifdef CONFIG_MODVERSIONS |
| 44 | 44 | /* Mark the CRC weak since genksyms apparently decides not to |
| 45 | 45 | * generate a checksums for some symbols */ |
| 46 | +#if defined(CONFIG_MODULE_REL_CRCS) | |
| 46 | 47 | #define __CRC_SYMBOL(sym, sec) \ |
| 47 | − extern __visible void *__crc_##sym __attribute__((weak)); \ | |
| 48 | − static const unsigned long __kcrctab_##sym \ | |
| 49 | − __used \ | |
| 50 | − __attribute__((section("___kcrctab" sec "+" #sym), used)) \ | |
| 51 | − = (unsigned long) &__crc_##sym; | |
| 48 | + asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ | |
| 49 | + " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ | |
| 50 | + " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \ | |
| 51 | + " .previous \n"); | |
| 52 | +#else | |
| 53 | +#define __CRC_SYMBOL(sym, sec) \ | |
| 54 | + asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ | |
| 55 | + " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ | |
| 56 | + " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ | |
| 57 | + " .previous \n"); | |
| 58 | +#endif | |
| 52 | 59 | #else |
| 53 | 60 | #define __CRC_SYMBOL(sym, sec) |
| 54 | 61 | #endif |
| @@ -346,7 +346,7 @@ struct module { · 345 unmodified lines | ||
| 346 | 346 | |
| 347 | 347 | /* Exported symbols */ |
| 348 | 348 | const struct kernel_symbol *syms; |
| 349 | − const unsigned long *crcs; | |
| 349 | + const s32 *crcs; | |
| 350 | 350 | unsigned int num_syms; |
| 351 | 351 | |
| 352 | 352 | /* Kernel parameters. */ |
| @@ -359,18 +359,18 @@ struct module { · 6 unmodified lines | ||
| 359 | 359 | /* GPL-only exported symbols. */ |
| 360 | 360 | unsigned int num_gpl_syms; |
| 361 | 361 | const struct kernel_symbol *gpl_syms; |
| 362 | − const unsigned long *gpl_crcs; | |
| 362 | + const s32 *gpl_crcs; | |
| 363 | 363 | |
| 364 | 364 | #ifdef CONFIG_UNUSED_SYMBOLS |
| 365 | 365 | /* unused exported symbols. */ |
| 366 | 366 | const struct kernel_symbol *unused_syms; |
| 367 | − const unsigned long *unused_crcs; | |
| 367 | + const s32 *unused_crcs; | |
| 368 | 368 | unsigned int num_unused_syms; |
| 369 | 369 | |
| 370 | 370 | /* GPL-only, unused exported symbols. */ |
| 371 | 371 | unsigned int num_unused_gpl_syms; |
| 372 | 372 | const struct kernel_symbol *unused_gpl_syms; |
| 373 | − const unsigned long *unused_gpl_crcs; | |
| 373 | + const s32 *unused_gpl_crcs; | |
| 374 | 374 | #endif |
| 375 | 375 | |
| 376 | 376 | #ifdef CONFIG_MODULE_SIG |
| @@ -382,7 +382,7 @@ struct module { · 5 unmodified lines | ||
| 382 | 382 | |
| 383 | 383 | /* symbols that will be GPL-only in the near future. */ |
| 384 | 384 | const struct kernel_symbol *gpl_future_syms; |
| 385 | − const unsigned long *gpl_future_crcs; | |
| 385 | + const s32 *gpl_future_crcs; | |
| 386 | 386 | unsigned int num_gpl_future_syms; |
| 387 | 387 | |
| 388 | 388 | /* Exception table */ |
| @@ -523,7 +523,7 @@ struct module *find_module(const char *name); · 134 unmodified lines | ||
| 523 | 523 | |
| 524 | 524 | struct symsearch { |
| 525 | 525 | const struct kernel_symbol *start, *stop; |
| 526 | − const unsigned long *crcs; | |
| 526 | + const s32 *crcs; | |
| 527 | 527 | enum { |
| 528 | 528 | NOT_GPL_ONLY, |
| 529 | 529 | GPL_ONLY, |
| @@ -539,7 +539,7 @@ struct symsearch { · 9 unmodified lines | ||
| 539 | 539 | */ |
| 540 | 540 | const struct kernel_symbol *find_symbol(const char *name, |
| 541 | 541 | struct module **owner, |
| 542 | − const unsigned long **crc, | |
| 542 | + const s32 **crc, | |
| 543 | 543 | bool gplok, |
| 544 | 544 | bool warn); |
| 545 | 545 | |