This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH][bugfix?][kprobes][vunmap?]: use vm_map_ram() in text_poke()
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Nick Piggin <npiggin at suse dot de>, Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- Cc: LKML <linux-kernel at vger dot kernel dot org>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Jim Keniston <jkenisto at us dot ibm dot com>, systemtap-ml <systemtap at sources dot redhat dot com>, "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Tue, 27 Jan 2009 21:39:28 -0500
- Subject: [PATCH][bugfix?][kprobes][vunmap?]: use vm_map_ram() in text_poke()
- References: <497FC3B1.7050805@redhat.com>
Use vm_map_ram() instead of vmap() in text_poke(), because text_poke()
just want to map pages temporarily.
---
As far as I tested, this patch works fine for me.
However, there might be another hidden bug in the kernel...
We need to fix that too.
arch/x86/kernel/alternative.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: 2.6-rc/arch/x86/kernel/alternative.c
===================================================================
--- 2.6-rc.orig/arch/x86/kernel/alternative.c
+++ 2.6-rc/arch/x86/kernel/alternative.c
@@ -515,12 +515,12 @@ void *__kprobes text_poke(void *addr, co
BUG_ON(!pages[0]);
if (!pages[1])
nr_pages = 1;
- vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
+ vaddr = vm_map_ram(pages, nr_pages, -1, PAGE_KERNEL);
BUG_ON(!vaddr);
local_irq_save(flags);
memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len);
local_irq_restore(flags);
- vunmap(vaddr);
+ vm_unmap_ram(vaddr, nr_pages);
sync_core();
/* Could also do a CLFLUSH here to speed up CPU recovery; but
that causes hangs on some VIA CPUs. */
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com