[PATCH][bugfix?][kprobes][vunmap?]: use vm_map_ram() in text_poke()

From: Masami Hiramatsu
Date: Tue Jan 27 2009 - 21:39:26 EST


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

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