Re-xmit: Modules: Be stricter recognizing init&exit sesections
PATCH 1/1 Re-xmit: Modules: Be stricter recognizing init&exit sesections
Linus, please apply.
Name: .init sections must start with .init
Status: Booted on 2.6.0-test4-bk9
D: Someone pointed out that -ffunction-sections can cause a function
D: called "init<something>" to be put in the init section, and discarded.
D: This hurts PARISC badly. Get more fussy with identifying them.
kernel/module.c +5 -3
@@ -1194,7 +1194,8 @@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);
@@ -1209,7 +1210,8 @@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 );
@@ -1413,7 +1415,7 @@ }#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 }
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.