mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prasanna S Panchamukhi <prasanna@in.ibm.com>
To: linux-kernel@vger.kernel.org, systemtap@sources.redhat.com
Cc: akpm@osdl.org, Andi Kleen <ak@suse.de>,
	davem@davemloft.net, suparna@in.ibm.com,
	richardj_moore@uk.ibm.com
Subject: Re: [RFC] [PATCH 2/6] Kprobes: Get one pagetable entry
Date: Tue, 9 May 2006 12:31:06 +0530	[thread overview]
Message-ID: <20060509070106.GB22493@in.ibm.com> (raw)
In-Reply-To: <20060509065917.GA22493@in.ibm.com>

This patch provide a wrapper routine to allocate one page
table entry for a given virtual address address. Kprobe's
user-space probe mechanism uses this routine to get one
page table entry. As Nick Piggin suggested, this generic
routine can be used by routines like get_user_pages,
find_*_page, and other standard APIs.

Signed-off-by: Prasanna S Panchamukhi <prasanna@in.ibm.com>


 mm/memory.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+)

diff -puN mm/memory.c~kprobes_userspace_probes-get-one-pagetable-entry mm/memory.c
--- linux-2.6.17-rc3-mm1/mm/memory.c~kprobes_userspace_probes-get-one-pagetable-entry	2006-05-09 10:08:44.000000000 +0530
+++ linux-2.6.17-rc3-mm1-prasanna/mm/memory.c	2006-05-09 10:08:44.000000000 +0530
@@ -48,6 +48,7 @@
 #include <linux/rmap.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/kprobes.h>
 
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
@@ -417,6 +418,34 @@ struct page *vm_normal_page(struct vm_ar
 }
 
 /*
+ * This routines get the pte of the page containing the specified address.
+ */
+pte_t  __kprobes *get_one_pte(unsigned long address)
+{
+	pgd_t *pgd;
+	pud_t *pud;
+	pmd_t *pmd;
+	pte_t *pte = NULL;
+
+	pgd = pgd_offset(current->mm, address);
+	if (!pgd)
+		goto out;
+
+	pud = pud_offset(pgd, address);
+	if (!pud)
+		goto out;
+
+	pmd = pmd_offset(pud, address);
+	if (!pmd)
+		goto out;
+
+	pte = pte_alloc_map(current->mm, pmd, address);
+
+out:
+	return pte;
+}
+
+/*
  * copy one vm_area from one task to the other. Assumes the page tables
  * already present in the new task to be cleared in the whole range
  * covered by this vma.

_
-- 
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Email: prasanna@in.ibm.com
Ph: 91-80-41776329

  reply	other threads:[~2006-05-09  7:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09  6:54 [RFC] [PATCH 0/6] Kprobes: User-space probes support for i386 Prasanna S Panchamukhi
2006-05-09  6:59 ` [RFC] [PATCH 1/6] Kprobes: Allow/deny exclusive write access to inodes Prasanna S Panchamukhi
2006-05-09  7:01   ` Prasanna S Panchamukhi [this message]
2006-05-09  7:05     ` [RFC] [PATCH 3/6] Kprobes: New interfaces for user-space probes Prasanna S Panchamukhi
2006-05-09  7:09       ` [RFC] [PATCH 4/6] Kprobes: Insert probes on non-memory resident pages Prasanna S Panchamukhi
2006-05-09  7:12         ` [RFC] [PATCH 5/6] Kprobes: Single step the original instruction out-of-line Prasanna S Panchamukhi
2006-05-09  7:15           ` [RFC] [PATCH 6/6] Kprobes: Remove breakpoints from the copied pages Prasanna S Panchamukhi
2006-05-09 17:04             ` Hugh Dickins
2006-05-10 12:17               ` Prasanna S Panchamukhi
2006-05-10 15:17                 ` Hugh Dickins
2006-05-09  9:38           ` [RFC] [PATCH 5/6] Kprobes: Single step the original instruction out-of-line Christoph Hellwig
2006-05-10  0:47           ` bibo,mao
2006-05-10 14:19             ` Richard J Moore
2006-05-09  9:37         ` [RFC] [PATCH 4/6] Kprobes: Insert probes on non-memory resident pages Christoph Hellwig
2006-05-09  9:36       ` [RFC] [PATCH 3/6] Kprobes: New interfaces for user-space probes Christoph Hellwig
2006-05-09 15:11         ` Richard J Moore
2006-05-09 15:18           ` Christoph Hellwig
2006-05-09 17:41             ` Frank Ch. Eigler
2006-05-09 20:40               ` Adrian Bunk
2006-05-09 20:58                 ` Frank Ch. Eigler
2006-05-09 22:35                   ` Christoph Hellwig
2006-05-09  9:34     ` [RFC] [PATCH 2/6] Kprobes: Get one pagetable entry Christoph Hellwig

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=20060509070106.GB22493@in.ibm.com \
    --to=prasanna@in.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardj_moore@uk.ibm.com \
    --cc=suparna@in.ibm.com \
    --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

Powered by JetHome