- Initialize new member at module_init()
- Make static SEC_FOUND to .data..percpu and .data.percpu sections
at store_section_data()
These can not read from /dev/mem or core file.
(not include in kallsyms nor module_core.)
- Install syms into st->mod_load_namespace at store_load_module_symbols()
module's percpu section include bfd of module object.
The syment.value is sum of bfd value and module.percpu.
Signed-off-by: Toshikazu Nakayama <nakayama.ts(a)ncos.nec.co.jp>
---
kernel.c | 1 +
symbols.c | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/kernel.c b/kernel.c
index 9ba0dc4..3439c5a 100755
--- a/kernel.c
+++ b/kernel.c
@@ -2694,6 +2694,7 @@ module_init(void)
MEMBER_OFFSET_INIT(module_init_size, "module", "init_size");
MEMBER_OFFSET_INIT(module_init_text_size, "module",
"init_text_size");
+ MEMBER_OFFSET_INIT(module_percpu, "module", "percpu");
/*
* Make sure to pick the kernel "modules" list_head symbol,
diff --git a/symbols.c b/symbols.c
index ec9c893..0a1d170 100755
--- a/symbols.c
+++ b/symbols.c
@@ -1349,6 +1349,7 @@ store_module_symbols_v2(ulong total, int mods_installed)
lm->mod_ext_symcnt = mcnt;
lm->mod_init_module_ptr = ULONG(modbuf +
OFFSET(module_module_init));
+ lm->mod_percpu = ULONG(modbuf + OFFSET(module_percpu));
if (THIS_KERNEL_VERSION >= LINUX(2,6,27)) {
lm->mod_etext_guess = lm->mod_base +
UINT(modbuf + OFFSET(module_core_text_size));
@@ -8346,6 +8347,10 @@ store_section_data(struct load_module *lm, bfd *bfd, asection
*section)
lm->mod_section_data[i].section = section;
lm->mod_section_data[i].priority = prio;
lm->mod_section_data[i].flags = section->flags & ~SEC_FOUND;
+ /* percpu section isn't included in kallsyms nor module_core area. */
+ if (lm->mod_percpu &&
+ (STREQ(name,".data.percpu") || STREQ(name, ".data..percpu")))
+ lm->mod_section_data[i].flags |= SEC_FOUND;
lm->mod_section_data[i].size = bfd_section_size(bfd, section);
lm->mod_section_data[i].offset = 0;
if (strlen(name) < MAX_MOD_SEC_NAME)
@@ -9314,7 +9319,12 @@ store_load_module_symbols(bfd *bfd, int dynamic, void *minisyms,
else if ((spx = kallsyms_module_symbol(lm, &syminfo))) {
syminfo.value = spx->value;
found = TRUE;
- } else {
+ } else if (lm->mod_percpu &&
+ (STREQ(secname, ".data.percpu") ||
+ STREQ(secname, ".data..percpu"))) {
+ syminfo.value += lm->mod_percpu;
+ found = TRUE;
+ } else {
syminfo.value +=
lm->mod_section_data[i].offset + lm->mod_base;
found = TRUE;
}
--
1.7.3.2.161.g3089c