From: Rui Xiang <rui.xiang@huawei.com>
To: Rusty Russell <rusty@rustcorp.com.au>, <linux-kernel@vger.kernel.org>
Cc: Zefan Li <lizefan@huawei.com>, Andrew Morton <akpm@linux-foundation.org>
Subject: [BUG] A bug report between init_moudle and kallsyms_lookup_name
Date: Mon, 22 Dec 2014 18:19:12 +0800 [thread overview]
Message-ID: <5497F020.5080309@huawei.com> (raw)
Hi List,
We encounter a crash in kallsyms_lookup_name in our product, the kernel version is Linux 3.4.
It seems a kernel bug.
In the scene, some modules were loading in CPU A. But kallsyms_lookup_name was
executed to find an symbol name for each modules in CPU B.
The reason seems like that,
after the module was added to modules list in CPU A, then module_kallsyms_lookup_name
in CPU B would found the mod. The addrs of mod->strtab and mod->symtab would be saved in register.
After the module init, the mod_symtab, strtab and num_symtab are updated to core_***, and
the init memory will be free. It means the memory area of the old mod->strtab and mod->symtab
is also free. But in the mod_find_symname, the addr saved in the register is still old.
CPU A CPU B
module_kallsyms_lookup_name
load_module -->mod_find_symname
-->list_add_rcu(modules)
。。。 *save mod->symtab/strtab into register
do_one_initcall
。。。 strcmp(name, mod->strtab+mod->symtab[i].st_name) *OK
mod->num_symtab = mod->core_num_syms;
mod->symtab = mod->core_symtab;
mod->strtab = mod->core_strtab;
。。。
module_free(module_init)
strcmp(name, mod->strtab+mod->symtab[i].st_name) *old addr, crash
The same to other two functions in kernel. Using kallsyms_on_each_symbol or module_get_kallsym would
cause a crash, while loading an modules, too.
It seems like an old bug in kernel, and also exits in mainline. Right?
Any advice is welcome.
Thanks,
Rui
reply other threads:[~2014-12-22 10:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5497F020.5080309@huawei.com \
--to=rui.xiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox