Re: [PATCH 2/2] move unneeded data to initdata section

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric W. Biederman
Date: Thursday, November 15, 2007 - 7:32 am

"Denis V. Lunev" <den@openvz.org> writes:


Ok.  This patch is technically safe because none of the touched
code can live in a module and so we never touch the exit code path.

However in the general case and as a code idiom this __net_initdata
on struct pernet_operations is fundamentally horribly broken.

Look at what happens if we use this idiom in module.  There
is only one definition of __initdata ".init.data".  The module
loader places all sections that begin with .init in a region of
memory that will be discarded after module initialization.  

So in register_pernet_operations we pass in the a pointer to struct
pernet_operations and call the init method.  Later when we remove the
module we again pass in the pointer to struct pernet_operations which
lived in an init section so it has been discarded.  We dereference
that pointer to find the exit method and KABOOM!!!!

So I'm still opposed to __net_initdata on the grounds that at best
it is like putting our head under a guillotine and reaching up and
sawing at the row that holds the blade up with a pocket knife.  It is
a think rope and a puny knife so you are safe for a while....

Eric
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/2] move unneeded data to initdata section, Denis V. Lunev, (Wed Nov 7, 5:01 am)
Re: [PATCH 2/2] move unneeded data to initdata section, David Miller, (Tue Nov 13, 4:24 am)
Re: [PATCH 2/2] move unneeded data to initdata section, Eric W. Biederman, (Thu Nov 15, 7:32 am)
Re: [PATCH 2/2] move unneeded data to initdata section, Denis V. Lunev, (Thu Nov 15, 7:42 am)
Re: [PATCH 2/2] move unneeded data to initdata section, Sam Ravnborg, (Thu Nov 15, 8:14 am)
Re: [PATCH 2/2] move unneeded data to initdata section, Eric W. Biederman, (Thu Nov 15, 11:19 am)
Re: [PATCH 2/2] move unneeded data to initdata section, Sam Ravnborg, (Thu Nov 15, 11:43 am)
Re: [PATCH 2/2] move unneeded data to initdata section, Denis V. Lunev, (Thu Nov 15, 12:17 pm)
Re: [PATCH 2/2] move unneeded data to initdata section, Sam Ravnborg, (Thu Nov 15, 12:34 pm)