diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2006-03-16 17:30:16 -0800 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-01-19 09:52:34 +1100 |
commit | c0cdf4791676b423766cad9fdb8129cee0662794 (patch) | |
tree | d3fbc7b491221cfd489d34cc2f8616e894060332 /init | |
parent | 7a64bf1b6370628b834f4986f9fa148f6e007600 (diff) |
warn when statically-allocated kobjects are used
One of the top ten sysfs problems is that users use statically
allocated kobjects. This patch reminds them that this is a
naughty thing.
One _really_ nice thing this patch does, is us the kallsyms
mechanism to print out exactly which symbol is being complained
about:
The kobject at, or inside 'statickobj.2'@(0xc040d020) is not dynamically allocated.
This patch replaces the previous implementation's use of a
_sdata symbol in favor of using kallsyms_lookup(). If a
kobject's address is a resolvable symbol, then it isn't
dynamically allocated.
The one exception to this is init symbols. The patch also
checks to see whether __init memory has been freed and if
it has will allow kobjects in those sections.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c index 844209453c02..17ceaacc96f6 100644 --- a/init/main.c +++ b/init/main.c @@ -782,6 +782,14 @@ static void run_init_process(char *init_filename) kernel_execve(init_filename, argv_init, envp_init); } +/* + * __init/__init_data sections are turned into normal + * dynamically allocated memory later in boot. When + * this is 0, the memory is for the __init purposes, + * when it it some other value, the memory is dynamic. + */ +int initmem_now_dynamic; + /* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ @@ -790,6 +798,7 @@ static noinline int init_post(void) /* need to finish all async __init code before freeing the memory */ async_synchronize_full(); free_initmem(); + initmem_now_dynamic = 1; unlock_kernel(); mark_rodata_ro(); system_state = SYSTEM_RUNNING; |