mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tiago Vignatti <vignatti@c3sl.ufpr.br>
To: linux-kernel@vger.kernel.org
Cc: Tiago Vignatti <vignatti@c3sl.ufpr.br>
Subject: [PATCH] Exports address to the page fault notifier.
Date: Fri, 27 Jul 2007 01:30:50 -0300	[thread overview]
Message-ID: <1185510650278-git-send-email-vignatti@c3sl.ufpr.br> (raw)
In-Reply-To: <11855106502612-git-send-email-vignatti@c3sl.ufpr.br>


Signed-off-by: Tiago Vignatti <vignatti@c3sl.ufpr.br>
---
 arch/i386/mm/fault.c   |    9 +++++----
 include/linux/kdebug.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 01ffdd4..c405802 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -47,14 +47,15 @@ int unregister_page_fault_notifier(struct notifier_block *nb)
 }
 EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
 
-static inline int notify_page_fault(struct pt_regs *regs, long err)
+static inline int notify_page_fault(struct pt_regs *regs, long err, unsigned long address)
 {
 	struct die_args args = {
 		.regs = regs,
 		.str = "page fault",
 		.err = err,
 		.trapnr = 14,
-		.signr = SIGSEGV
+		.signr = SIGSEGV,
+		.address = address
 	};
 	return atomic_notifier_call_chain(&notify_page_fault_chain,
 	                                  DIE_PAGE_FAULT, &args);
@@ -330,7 +331,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
 	if (unlikely(address >= TASK_SIZE)) {
 		if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
 			return;
-		if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
+		if (notify_page_fault(regs, error_code, address) == NOTIFY_STOP)
 			return;
 		/*
 		 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -339,7 +340,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
 		goto bad_area_nosemaphore;
 	}
 
-	if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
+	if (notify_page_fault(regs, error_code, address) == NOTIFY_STOP)
 		return;
 
 	/* It's safe to allow irq's after cr2 has been saved and the vmalloc
diff --git a/include/linux/kdebug.h b/include/linux/kdebug.h
index 5db38d6..e8005c2 100644
--- a/include/linux/kdebug.h
+++ b/include/linux/kdebug.h
@@ -9,6 +9,7 @@ struct die_args {
 	long err;
 	int trapnr;
 	int signr;
+	unsigned long address;
 };
 
 int register_die_notifier(struct notifier_block *nb);
-- 
1.5.2.4


      reply	other threads:[~2007-07-27  4:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27  4:30 Tiago Vignatti
2007-07-27  4:30 ` Tiago Vignatti [this message]

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=1185510650278-git-send-email-vignatti@c3sl.ufpr.br \
    --to=vignatti@c3sl.ufpr.br \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®