lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8cfda1c8f6c46e2f0fa9e9279aa2b2a213fba7a4.1221282535.git.jbarnold@mit.edu>
Date:	Sat, 13 Sep 2008 01:14:38 -0400
From:	Jeffrey Brian Arnold <jbarnold@....EDU>
To:	linux-kernel@...r.kernel.org
Cc:	Tim Abbott <tabbott@....edu>, Anders Kaseorg <andersk@....edu>,
	Waseem Daher <wdaher@....edu>,
	Denys Vlasenko <vda.linux@...glemail.com>
Subject: [RFC v2 PATCH 2/9] Ksplice: Add module_data_address (the analogue of module_text_address)

From: Tim Abbott <tabbott@....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@....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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ