diff options
-rw-r--r-- | init/Kconfig | 6 | ||||
-rw-r--r-- | kernel/module.c | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/init/Kconfig b/init/Kconfig index 3b5adbf228c7..6135d07f31ec 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -845,9 +845,9 @@ config MODULE_FORCE_LOAD | |||
845 | depends on MODULES | 845 | depends on MODULES |
846 | default n | 846 | default n |
847 | help | 847 | help |
848 | This option allows loading of modules even if that would set the | 848 | Allow loading of modules without version information (ie. modprobe |
849 | 'F' (forced) taint, due to lack of version info. Which is | 849 | --force). Forced module loading sets the 'F' (forced) taint flag and |
850 | usually a really bad idea. | 850 | is usually a really bad idea. |
851 | 851 | ||
852 | config MODULE_UNLOAD | 852 | config MODULE_UNLOAD |
853 | bool "Module unloading" | 853 | bool "Module unloading" |
diff --git a/kernel/module.c b/kernel/module.c index 2584c0e2762d..f5e9491ef7ac 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -957,11 +957,14 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
957 | return check_version(sechdrs, versindex, "struct_module", mod, crc); | 957 | return check_version(sechdrs, versindex, "struct_module", mod, crc); |
958 | } | 958 | } |
959 | 959 | ||
960 | /* First part is kernel version, which we ignore. */ | 960 | /* First part is kernel version, which we ignore if module has crcs. */ |
961 | static inline int same_magic(const char *amagic, const char *bmagic) | 961 | static inline int same_magic(const char *amagic, const char *bmagic, |
962 | bool has_crcs) | ||
962 | { | 963 | { |
963 | amagic += strcspn(amagic, " "); | 964 | if (has_crcs) { |
964 | bmagic += strcspn(bmagic, " "); | 965 | amagic += strcspn(amagic, " "); |
966 | bmagic += strcspn(bmagic, " "); | ||
967 | } | ||
965 | return strcmp(amagic, bmagic) == 0; | 968 | return strcmp(amagic, bmagic) == 0; |
966 | } | 969 | } |
967 | #else | 970 | #else |
@@ -981,7 +984,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
981 | return 1; | 984 | return 1; |
982 | } | 985 | } |
983 | 986 | ||
984 | static inline int same_magic(const char *amagic, const char *bmagic) | 987 | static inline int same_magic(const char *amagic, const char *bmagic, |
988 | bool has_crcs) | ||
985 | { | 989 | { |
986 | return strcmp(amagic, bmagic) == 0; | 990 | return strcmp(amagic, bmagic) == 0; |
987 | } | 991 | } |
@@ -1874,7 +1878,7 @@ static struct module *load_module(void __user *umod, | |||
1874 | err = try_to_force_load(mod, "magic"); | 1878 | err = try_to_force_load(mod, "magic"); |
1875 | if (err) | 1879 | if (err) |
1876 | goto free_hdr; | 1880 | goto free_hdr; |
1877 | } else if (!same_magic(modmagic, vermagic)) { | 1881 | } else if (!same_magic(modmagic, vermagic, versindex)) { |
1878 | printk(KERN_ERR "%s: version magic '%s' should be '%s'\n", | 1882 | printk(KERN_ERR "%s: version magic '%s' should be '%s'\n", |
1879 | mod->name, modmagic, vermagic); | 1883 | mod->name, modmagic, vermagic); |
1880 | err = -ENOEXEC; | 1884 | err = -ENOEXEC; |