public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Nick Piggin <npiggin@suse.de>,
	        Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: LKML <linux-kernel@vger.kernel.org>,
	        Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	        Jim Keniston <jkenisto@us.ibm.com>,
	        systemtap-ml <systemtap@sources.redhat.com>,
	        "Frank Ch. Eigler" <fche@redhat.com>
Subject: [PATCH][bugfix?][kprobes][vunmap?]: use vm_map_ram() in text_poke()
Date: Wed, 28 Jan 2009 15:48:00 -0000	[thread overview]
Message-ID: <497FC560.2000204@redhat.com> (raw)
In-Reply-To: <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

  reply	other threads:[~2009-01-28  2:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28  5:10 [BUG][kprobes][vunmap?]: kprobes may cause memory corruption Masami Hiramatsu
2009-01-28 15:48 ` Masami Hiramatsu [this message]
2009-01-28 16:23 ` Masami Hiramatsu
2009-01-28 16:52   ` Mathieu Desnoyers
2009-01-28 16:59     ` Mathieu Desnoyers
2009-01-28 17:58     ` Masami Hiramatsu
2009-01-28 18:11       ` Mathieu Desnoyers
2009-01-28 18:12         ` Masami Hiramatsu
2009-01-28 18:13           ` Mathieu Desnoyers
2009-02-06  0:02             ` [BUGFIX][PATCH -rc/-mm] prevent kprobes from catching spurious page faults Masami Hiramatsu
2009-02-06  0:29               ` Ingo Molnar
2009-02-06  1:44                 ` Mathieu Desnoyers
2009-02-06  3:00                   ` Ingo Molnar
2009-02-06  3:42                     ` Ingo Molnar
2009-02-06 20:53                   ` Masami Hiramatsu
2009-02-06 16:30                 ` Masami Hiramatsu
2009-03-17 13:22             ` [BUGFIX][PATCH] prevent boosting kprobes on exception address Masami Hiramatsu
2009-01-28 20:21           ` [BUG][kprobes][vunmap?]: kprobes may cause memory corruption Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=497FC560.2000204@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=fche@redhat.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=npiggin@suse.de \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).