mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
Make the taint flags reliable
It's somewhat unlikely that it happens, but right now a race window between interrupts or machine checks or oopses could corrupt the tainted bitmap because it is modified in a non atomic fashion. Convert the taint variable to an unsigned long and use only atomic bit operations on it. Unfortunately this means the intvec sysctl functions cannot be used on it anymore. It turned out the taint sysctl handler could actually be simplified a bit (since it only increases capabilities) so this patch actually removes code. [akpm@linux-foundation.org: remove unneeded include] Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
889d51a107
commit
25ddbb18aa
6 changed files with 101 additions and 82 deletions
|
@ -100,7 +100,7 @@ static inline int strong_try_module_get(struct module *mod)
|
|||
static inline void add_taint_module(struct module *mod, unsigned flag)
|
||||
{
|
||||
add_taint(flag);
|
||||
mod->taints |= flag;
|
||||
mod->taints |= (1U << flag);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -923,7 +923,7 @@ static const char vermagic[] = VERMAGIC_STRING;
|
|||
static int try_to_force_load(struct module *mod, const char *symname)
|
||||
{
|
||||
#ifdef CONFIG_MODULE_FORCE_LOAD
|
||||
if (!(tainted & TAINT_FORCED_MODULE))
|
||||
if (!test_taint(TAINT_FORCED_MODULE))
|
||||
printk("%s: no version for \"%s\" found: kernel tainted.\n",
|
||||
mod->name, symname);
|
||||
add_taint_module(mod, TAINT_FORCED_MODULE);
|
||||
|
@ -1033,7 +1033,7 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
|
|||
const unsigned long *crc;
|
||||
|
||||
ret = find_symbol(name, &owner, &crc,
|
||||
!(mod->taints & TAINT_PROPRIETARY_MODULE), true);
|
||||
!(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
|
||||
if (!IS_ERR_VALUE(ret)) {
|
||||
/* use_module can fail due to OOM,
|
||||
or module initialization or unloading */
|
||||
|
@ -1634,7 +1634,7 @@ static void set_license(struct module *mod, const char *license)
|
|||
license = "unspecified";
|
||||
|
||||
if (!license_is_gpl_compatible(license)) {
|
||||
if (!(tainted & TAINT_PROPRIETARY_MODULE))
|
||||
if (!test_taint(TAINT_PROPRIETARY_MODULE))
|
||||
printk(KERN_WARNING "%s: module license '%s' taints "
|
||||
"kernel.\n", mod->name, license);
|
||||
add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
|
||||
|
@ -2552,9 +2552,9 @@ static char *module_flags(struct module *mod, char *buf)
|
|||
mod->state == MODULE_STATE_GOING ||
|
||||
mod->state == MODULE_STATE_COMING) {
|
||||
buf[bx++] = '(';
|
||||
if (mod->taints & TAINT_PROPRIETARY_MODULE)
|
||||
if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE))
|
||||
buf[bx++] = 'P';
|
||||
if (mod->taints & TAINT_FORCED_MODULE)
|
||||
if (mod->taints & (1 << TAINT_FORCED_MODULE))
|
||||
buf[bx++] = 'F';
|
||||
/*
|
||||
* TAINT_FORCED_RMMOD: could be added.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue