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] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0811241624330.17720@vinegar-pot.mit.edu>
Date:	Mon, 24 Nov 2008 17:13:57 -0500 (EST)
From:	Tim Abbott <tabbott@....EDU>
To:	Christoph Hellwig <hch@...radead.org>
cc:	Jeff Arnold <jbarnold@....edu>, linux-kernel@...r.kernel.org,
	Anders Kaseorg <andersk@....edu>,
	Waseem Daher <wdaher@....edu>,
	Denys Vlasenko <vda.linux@...glemail.com>,
	Nikanth Karthikesan <knikanth@...e.de>
Subject: Re: [RFC v3 PATCH 6/7] Ksplice: Export symbols needed for Ksplice

On Sat, 22 Nov 2008, Christoph Hellwig wrote:

> On Fri, Nov 21, 2008 at 10:36:00PM -0500, Jeff Arnold wrote:
>> Ksplice uses init_mm to get access to the ranges of addresses
>> containing core kernel text and data.  It seems that init_mm was
>> scheduled to be unexported entirely in 2.6.26, so move it to
>> EXPORT_SYMBOL_GPL (rather than back to EXPORT_SYMBOL).
>
> Umm, no.  This is a very clear indicator that your code shouldn't be
> modular.

Well, it's easy to eliminate the use of init_mm in Ksplice by using a 
slightly different check for whether to use virt_to_page or 
vmalloc_to_page.  Here is a patch:

Remove use of init_mm from Ksplice

Since the input to map_writable is guaranteed to be a core kernel
address or a module address, we can use __module_text_address and
__module_data_address to determine whether the address is in the core
kernel or a module, and thus whether to use virt_to_page or
vmalloc_to_page.

Signed-off-by: Tim Abbott <tabbott@....edu>
---
 kernel/ksplice.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/ksplice.c b/kernel/ksplice.c
index 8a05123..d12a6db 100644
--- a/kernel/ksplice.c
+++ b/kernel/ksplice.c
@@ -949,11 +949,10 @@ static void *map_writable(void *addr, size_t len)
 {
 	void *vaddr;
 	int nr_pages = 2;
-	unsigned long laddr = (unsigned long)addr;
 	struct page *pages[2];

-	if ((laddr >= init_mm.start_code && laddr < init_mm.end_code) ||
-	    (laddr >= init_mm.start_data && laddr < init_mm.end_data)) {
+	if (__module_text_address((unsigned long)addr) == NULL &&
+	    __module_data_address((unsigned long)addr) == NULL) {
 		pages[0] = virt_to_page(addr);
 		WARN_ON(!PageReserved(pages[0]));
 		pages[1] = virt_to_page(addr + PAGE_SIZE);
-- 
1.5.6.5

--
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