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: <alpine.LFD.2.00.0810130752020.3288@nehalem.linux-foundation.org>
Date:	Mon, 13 Oct 2008 08:03:47 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
cc:	Jiri Slaby <jirislaby@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: GIT head no longer boots on x86-64



On Mon, 13 Oct 2008, Alan Cox wrote:

> On Mon, 13 Oct 2008 12:56:54 +0200
> Jiri Slaby <jirislaby@...il.com> wrote:
> 
> > Could you try the debug patch below to see what address is text_poke trying
> > to translate?
> 
> BUG? vmalloc_to_page (from text_poke+0x30/0x14a): ffffffffa01e40b1

Hmm. Last page of code being fixed up, perhaps?

Does this fix it?

(Totally untested. Of course.)

			Linus

---
 arch/x86/kernel/alternative.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index fb04e49..f4a8870 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -498,23 +498,22 @@ void *text_poke_early(void *addr, const void *opcode, size_t len)
  */
 void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
 {
-	unsigned long flags;
+	unsigned long flags, offset;
 	char *vaddr;
-	int nr_pages = 2;
 	struct page *pages[2];
-	int i;
+	int i, nr_pages;
 
+	offset = (unsigned long) addr & ~PAGE_MASK;
+	nr_pages = (offset + len) > PAGE_SIZE ? 2 : 1;
 	if (!core_kernel_text((unsigned long)addr)) {
 		pages[0] = vmalloc_to_page(addr);
-		pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
+		pages[1] = vmalloc_to_page(addr + len - 1);
 	} else {
 		pages[0] = virt_to_page(addr);
 		WARN_ON(!PageReserved(pages[0]));
-		pages[1] = virt_to_page(addr + PAGE_SIZE);
+		pages[1] = pages[0]+1;
 	}
 	BUG_ON(!pages[0]);
-	if (!pages[1])
-		nr_pages = 1;
 	vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
 	BUG_ON(!vaddr);
 	local_irq_save(flags);
--
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