Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24109
b: refs/heads/master
c: 2326c77
h: refs/heads/master
i:
  24107: 4a1db83
v: v3
  • Loading branch information
bibo,mao authored and Linus Torvalds committed Mar 26, 2006
1 parent e64cbf2 commit 47f51e0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c6fd91f0bdcd294a0ae0ba2b2a7f7456ef4b7144
refs/heads/master: 2326c77017c79fd6d55c69d8a49a57a252921bcd
19 changes: 6 additions & 13 deletions trunk/arch/i386/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,31 +203,21 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
{
struct kprobe *p;
int ret = 0;
kprobe_opcode_t *addr = NULL;
unsigned long *lp;
kprobe_opcode_t *addr;
struct kprobe_ctlblk *kcb;
#ifdef CONFIG_PREEMPT
unsigned pre_preempt_count = preempt_count();
#endif /* CONFIG_PREEMPT */

addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));

/*
* We don't want to be preempted for the entire
* duration of kprobe processing
*/
preempt_disable();
kcb = get_kprobe_ctlblk();

/* Check if the application is using LDT entry for its code segment and
* calculate the address by reading the base address from the LDT entry.
*/
if ((regs->xcs & 4) && (current->mm)) {
lp = (unsigned long *) ((unsigned long)((regs->xcs >> 3) * 8)
+ (char *) current->mm->context.ldt);
addr = (kprobe_opcode_t *) (get_desc_base(lp) + regs->eip -
sizeof(kprobe_opcode_t));
} else {
addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));
}
/* Check we're not actually recursing */
if (kprobe_running()) {
p = get_kprobe(addr);
Expand Down Expand Up @@ -579,6 +569,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
struct die_args *args = (struct die_args *)data;
int ret = NOTIFY_DONE;

if (args->regs && user_mode(args->regs))
return ret;

switch (val) {
case DIE_INT3:
if (kprobe_handler(args->regs))
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/ia64/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
struct die_args *args = (struct die_args *)data;
int ret = NOTIFY_DONE;

if (args->regs && user_mode(args->regs))
return ret;

switch(val) {
case DIE_BREAK:
/* err is break number from ia64_bad_break() */
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/powerpc/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
struct die_args *args = (struct die_args *)data;
int ret = NOTIFY_DONE;

if (args->regs && user_mode(args->regs))
return ret;

switch (val) {
case DIE_BPT:
if (kprobe_handler(args->regs))
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/sparc64/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
struct die_args *args = (struct die_args *)data;
int ret = NOTIFY_DONE;

if (args->regs && user_mode(args->regs))
return ret;

switch (val) {
case DIE_DEBUG:
if (kprobe_handler(args->regs))
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/x86_64/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
struct die_args *args = (struct die_args *)data;
int ret = NOTIFY_DONE;

if (args->regs && user_mode(args->regs))
return ret;

switch (val) {
case DIE_INT3:
if (kprobe_handler(args->regs))
Expand Down

0 comments on commit 47f51e0

Please sign in to comment.