From: Jeffrey Brian Arnold <jbarnold@MIT.EDU>
To: linux-kernel@vger.kernel.org
Cc: Tim Abbott <tabbott@MIT.EDU>, Anders Kaseorg <andersk@MIT.EDU>,
Waseem Daher <wdaher@MIT.EDU>,
Denys Vlasenko <vda.linux@googlemail.com>
Subject: [RFC PATCH 2/9] Ksplice: Add module_data_address (the analogue of module_text_address)
Date: Sat, 13 Sep 2008 00:49:48 -0400 [thread overview]
Message-ID: <8cfda1c8f6c46e2f0fa9e9279aa2b2a213fba7a4.1221280912.git.jbarnold@mit.edu> (raw)
In-Reply-To: <bfbae790a8f63d8697062036d47e0756e9f3ad5f.1221280912.git.jbarnold@mit.edu>
In-Reply-To: <bfbae790a8f63d8697062036d47e0756e9f3ad5f.1221280912.git.jbarnold@mit.edu>
From: Tim Abbott <tabbott@mit.edu>
Ksplice's run-pre matching process needs to be able to determine the
module that contains a particular data address.
Signed-off-by: Tim Abbott <tabbott@mit.edu>
---
include/linux/module.h | 2 ++
kernel/module.c | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/include/linux/module.h b/include/linux/module.h
index 68e0955..b7cdfb4 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -362,6 +362,8 @@ static inline int module_is_live(struct module *mod)
/* Is this address in a module? (second is with no locks, for oops) */
struct module *module_text_address(unsigned long addr);
struct module *__module_text_address(unsigned long addr);
+struct module *module_data_address(unsigned long addr);
+struct module *__module_data_address(unsigned long addr);
int is_module_address(unsigned long addr);
/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
diff --git a/kernel/module.c b/kernel/module.c
index 8954556..dda2f80 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2682,6 +2682,34 @@ struct module *module_text_address(unsigned long addr)
return mod;
}
+struct module *__module_data_address(unsigned long addr)
+{
+ struct module *mod;
+
+ if (addr < module_addr_min || addr > module_addr_max)
+ return NULL;
+
+ list_for_each_entry(mod, &modules, list) {
+ if (within(addr, mod->module_core + mod->core_text_size,
+ mod->core_size - mod->core_text_size) ||
+ within(addr, mod->module_init + mod->init_text_size,
+ mod->init_size - mod->init_text_size))
+ return mod;
+ }
+ return NULL;
+}
+
+struct module *module_data_address(unsigned long addr)
+{
+ struct module *mod;
+
+ preempt_disable();
+ mod = __module_data_address(addr);
+ preempt_enable();
+
+ return mod;
+}
+
/* Don't grab lock, we're oopsing. */
void print_modules(void)
{
--
1.5.4.3
next prev parent reply other threads:[~2008-09-13 4:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-13 4:49 [RFC PATCH 0/9] Ksplice: Rebootless kernel updates Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 1/9] Ksplice: Make find_symbol return a struct kernel_symbol Jeffrey Brian Arnold
2008-09-13 4:49 ` Jeffrey Brian Arnold [this message]
2008-09-13 4:49 ` [RFC PATCH 3/9] Ksplice: Add functions for walking kallsyms symbols Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 4/9] Ksplice: Make needed symbol and module functions global Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 5/9] Ksplice: Architecture-independent core Jeffrey Brian Arnold
[not found] ` <8d86b7714a1012014ce3533aa24dc88704fe14a6.1221271644.git.jbarnold@mit.edu>
2008-09-13 4:49 ` [RFC PATCH 5/9] Ksplice core (architecture independent) Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 6/9] Ksplice: Documentation Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 6/9] Ksplice documentation Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 7/9] Ksplice: x86-32 and x86-64 support Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 8/9] Ksplice: ARM support Jeffrey Brian Arnold
2008-09-13 4:49 ` [RFC PATCH 9/9] Ksplice: Add support for building Ksplice as a module Jeffrey Brian Arnold
2008-09-13 5:12 ` [RFC PATCH 0/9] Ksplice: Rebootless kernel updates Alexey Dobriyan
2008-09-14 20:24 ` Jeff Arnold
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=8cfda1c8f6c46e2f0fa9e9279aa2b2a213fba7a4.1221280912.git.jbarnold@mit.edu \
--to=jbarnold@mit.edu \
--cc=andersk@MIT.EDU \
--cc=linux-kernel@vger.kernel.org \
--cc=tabbott@MIT.EDU \
--cc=vda.linux@googlemail.com \
--cc=wdaher@MIT.EDU \
/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
all inboxes | Powered by JetHome®