Commit 4cf01742 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Modules: Be stricter recognizing init&exit sesections

Someone pointed out that -ffunction-sections can cause a function called
"init<something>" to be put in the init section, and discarded.  This
hurts PARISC badly.  Get more fussy with identifying them.
parent 2b0c1a2b
......@@ -1211,7 +1211,8 @@ static void layout_sections(struct module *mod,
if ((s->sh_flags & masks[m][0]) != masks[m][0]
|| (s->sh_flags & masks[m][1])
|| s->sh_entsize != ~0UL
|| strstr(secstrings + s->sh_name, ".init"))
|| strncmp(secstrings + s->sh_name,
".init", 5) == 0)
continue;
s->sh_entsize = get_offset(&mod->core_size, s);
DEBUGP("\t%s\n", secstrings + s->sh_name);
......@@ -1228,7 +1229,8 @@ static void layout_sections(struct module *mod,
if ((s->sh_flags & masks[m][0]) != masks[m][0]
|| (s->sh_flags & masks[m][1])
|| s->sh_entsize != ~0UL
|| !strstr(secstrings + s->sh_name, ".init"))
|| strncmp(secstrings + s->sh_name,
".init", 5) != 0)
continue;
s->sh_entsize = (get_offset(&mod->init_size, s)
| INIT_OFFSET_MASK);
......@@ -1434,7 +1436,7 @@ static struct module *load_module(void __user *umod,
}
#ifndef CONFIG_MODULE_UNLOAD
/* Don't load .exit sections */
if (strstr(secstrings+sechdrs[i].sh_name, ".exit"))
if (strncmp(secstrings+sechdrs[i].sh_name, ".exit", 5) == 0)
sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC;
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment