diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-31 15:05:34 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 22:35:34 -0400 |
commit | 8c8ef42aee8fcfb4128bb94c50d55c9f80ade525 (patch) | |
tree | 58141fdd1afc0887dcc3cb91ab4c7609df0963e7 | |
parent | 9cb610d8e35fe3ec95a2fe2030b02f85aeea83c1 (diff) |
module: include other structures in module version check
With CONFIG_MODVERSIONS, we version 'struct module' using a dummy
export, but other things matter too:
1) 'struct modversion_info' determines the layout of the __versions section,
2) 'struct kernel_param' determines the layout of the __params section,
3) 'struct kernel_symbol' determines __ksymtab*.
4) 'struct marker' determines __markers.
5) 'struct tracepoint' determines __tracepoints.
So we rename 'struct_module' to 'module_layout' and include these in
the signature. Now it's general we can add others later on without
confusion.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 18 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 4 |
2 files changed, 15 insertions, 7 deletions
diff --git a/kernel/module.c b/kernel/module.c index 784bf6d8f8c4..e8cf636e614b 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1052,9 +1052,9 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
1052 | { | 1052 | { |
1053 | const unsigned long *crc; | 1053 | const unsigned long *crc; |
1054 | 1054 | ||
1055 | if (!find_symbol("struct_module", NULL, &crc, true, false)) | 1055 | if (!find_symbol("module_layout", NULL, &crc, true, false)) |
1056 | BUG(); | 1056 | BUG(); |
1057 | return check_version(sechdrs, versindex, "struct_module", mod, crc); | 1057 | return check_version(sechdrs, versindex, "module_layout", mod, crc); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | /* First part is kernel version, which we ignore if module has crcs. */ | 1060 | /* First part is kernel version, which we ignore if module has crcs. */ |
@@ -2858,9 +2858,17 @@ void print_modules(void) | |||
2858 | } | 2858 | } |
2859 | 2859 | ||
2860 | #ifdef CONFIG_MODVERSIONS | 2860 | #ifdef CONFIG_MODVERSIONS |
2861 | /* Generate the signature for struct module here, too, for modversions. */ | 2861 | /* Generate the signature for all relevant module structures here. |
2862 | void struct_module(struct module *mod) { return; } | 2862 | * If these change, we don't want to try to parse the module. */ |
2863 | EXPORT_SYMBOL(struct_module); | 2863 | void module_layout(struct module *mod, |
2864 | struct modversion_info *ver, | ||
2865 | struct kernel_param *kp, | ||
2866 | struct kernel_symbol *ks, | ||
2867 | struct marker *marker, | ||
2868 | struct tracepoint *tp) | ||
2869 | { | ||
2870 | } | ||
2871 | EXPORT_SYMBOL(module_layout); | ||
2864 | #endif | 2872 | #endif |
2865 | 2873 | ||
2866 | #ifdef CONFIG_MARKERS | 2874 | #ifdef CONFIG_MARKERS |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 7e62303133dc..8cc70612984c 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1607,12 +1607,12 @@ static void read_symbols(char *modname) | |||
1607 | 1607 | ||
1608 | parse_elf_finish(&info); | 1608 | parse_elf_finish(&info); |
1609 | 1609 | ||
1610 | /* Our trick to get versioning for struct_module - it's | 1610 | /* Our trick to get versioning for module struct etc. - it's |
1611 | * never passed as an argument to an exported function, so | 1611 | * never passed as an argument to an exported function, so |
1612 | * the automatic versioning doesn't pick it up, but it's really | 1612 | * the automatic versioning doesn't pick it up, but it's really |
1613 | * important anyhow */ | 1613 | * important anyhow */ |
1614 | if (modversions) | 1614 | if (modversions) |
1615 | mod->unres = alloc_symbol("struct_module", 0, mod->unres); | 1615 | mod->unres = alloc_symbol("module_layout", 0, mod->unres); |
1616 | } | 1616 | } |
1617 | 1617 | ||
1618 | #define SZ 500 | 1618 | #define SZ 500 |