From: "Gui,Jian" <guij@cn.ibm.com>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH][kprobe] disallow kprobes on emulate_step and branch_taken
Date: Wed, 01 Nov 2006 10:50:15 +0800 [thread overview]
Message-ID: <45480B67.2080904@cn.ltcfwd.linux.ibm.com> (raw)
Probing on emulate_step function will crash 2.6.18.1 when it is
triggered. This problem is powerpc dependent.
When kprobe is triggered, emulate_step() is on its kernel path and
will cause recursive kprobe fault. And branch_taken() is called
in emulate_step(). This patch can disallow kprobes on both of them.
diff -Nur orig/arch/powerpc/lib/sstep.c linux-2.6.18.1/arch/powerpc/lib/sstep.c
--- orig/arch/powerpc/lib/sstep.c 2006-11-01 08:45:06.000000000 -0500
+++ linux-2.6.18.1/arch/powerpc/lib/sstep.c 2006-11-01 08:50:19.000000000 -0500
@@ -9,6 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/kernel.h>
+#include <linux/kprobes.h>
#include <linux/ptrace.h>
#include <asm/sstep.h>
#include <asm/processor.h>
@@ -25,7 +26,7 @@
/*
* Determine whether a conditional branch instruction would branch.
*/
-static int branch_taken(unsigned int instr, struct pt_regs *regs)
+static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
{
unsigned int bo = (instr >> 21) & 0x1f;
unsigned int bi;
@@ -51,7 +52,7 @@
* or -1 if the instruction is one that should not be stepped,
* such as an rfid, or a mtmsrd that would clear MSR_RI.
*/
-int emulate_step(struct pt_regs *regs, unsigned int instr)
+int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
{
unsigned int opcode, rd;
unsigned long int imm;
reply other threads:[~2006-11-01 2:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=45480B67.2080904@cn.ltcfwd.linux.ibm.com \
--to=guij@cn.ibm.com \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).