Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96230
b: refs/heads/master
c: 91e37a7
h: refs/heads/master
v: v3
  • Loading branch information
Rusty Russell authored and Linus Torvalds committed May 9, 2008
1 parent dc2a2fb commit 36b6259
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a5dd69707424a35d2d2cc094e870f595ad61e916
refs/heads/master: 91e37a793b5a9436a2d12b2f0a8f52db3a133e1d
6 changes: 3 additions & 3 deletions trunk/init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,9 @@ config MODULE_FORCE_LOAD
depends on MODULES
default n
help
This option allows loading of modules even if that would set the
'F' (forced) taint, due to lack of version info. Which is
usually a really bad idea.
Allow loading of modules without version information (ie. modprobe
--force). Forced module loading sets the 'F' (forced) taint flag and
is usually a really bad idea.

config MODULE_UNLOAD
bool "Module unloading"
Expand Down
16 changes: 10 additions & 6 deletions trunk/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,11 +957,14 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
return check_version(sechdrs, versindex, "struct_module", mod, crc);
}

/* First part is kernel version, which we ignore. */
static inline int same_magic(const char *amagic, const char *bmagic)
/* First part is kernel version, which we ignore if module has crcs. */
static inline int same_magic(const char *amagic, const char *bmagic,
bool has_crcs)
{
amagic += strcspn(amagic, " ");
bmagic += strcspn(bmagic, " ");
if (has_crcs) {
amagic += strcspn(amagic, " ");
bmagic += strcspn(bmagic, " ");
}
return strcmp(amagic, bmagic) == 0;
}
#else
Expand All @@ -981,7 +984,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
return 1;
}

static inline int same_magic(const char *amagic, const char *bmagic)
static inline int same_magic(const char *amagic, const char *bmagic,
bool has_crcs)
{
return strcmp(amagic, bmagic) == 0;
}
Expand Down Expand Up @@ -1874,7 +1878,7 @@ static struct module *load_module(void __user *umod,
err = try_to_force_load(mod, "magic");
if (err)
goto free_hdr;
} else if (!same_magic(modmagic, vermagic)) {
} else if (!same_magic(modmagic, vermagic, versindex)) {
printk(KERN_ERR "%s: version magic '%s' should be '%s'\n",
mod->name, modmagic, vermagic);
err = -ENOEXEC;
Expand Down

0 comments on commit 36b6259

Please sign in to comment.