aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-12-02 01:32:16 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-02 03:59:03 -0500
commit1cedae72904b85462082dbcfd5190309ba37f8bd (patch)
tree43c5873e8b8c1d65acd62fd5a609117fdee7c0da /arch/x86
parent6b62fe019e39edfd1dbe3f224ecd0a87d9365223 (diff)
hw-breakpoints: Keep track of user disabled breakpoints
When we disable a breakpoint through dr7, we unregister it right away, making us lose track of its corresponding address register value. It means that the following sequence would be unsupported: - set address in dr0 - enable it through dr7 - disable it through dr7 - enable it through dr7 because we lost the address register value when we disabled the breakpoint. Don't unregister the disabled breakpoints but rather disable them. Reported-by: "K.Prasad" <prasad@linux.vnet.ibm.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <1259735536-9236-1-git-send-regression-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/ptrace.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 2941b32ea666..04d182a7cfdb 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -595,7 +595,7 @@ static unsigned long ptrace_get_dr7(struct perf_event *bp[])
595 595
596static struct perf_event * 596static struct perf_event *
597ptrace_modify_breakpoint(struct perf_event *bp, int len, int type, 597ptrace_modify_breakpoint(struct perf_event *bp, int len, int type,
598 struct task_struct *tsk) 598 struct task_struct *tsk, int disabled)
599{ 599{
600 int err; 600 int err;
601 int gen_len, gen_type; 601 int gen_len, gen_type;
@@ -616,7 +616,7 @@ ptrace_modify_breakpoint(struct perf_event *bp, int len, int type,
616 attr = bp->attr; 616 attr = bp->attr;
617 attr.bp_len = gen_len; 617 attr.bp_len = gen_len;
618 attr.bp_type = gen_type; 618 attr.bp_type = gen_type;
619 attr.disabled = 0; 619 attr.disabled = disabled;
620 620
621 return modify_user_hw_breakpoint(bp, &attr, bp->callback, tsk); 621 return modify_user_hw_breakpoint(bp, &attr, bp->callback, tsk);
622} 622}
@@ -655,13 +655,21 @@ restore:
655 */ 655 */
656 if (!second_pass) 656 if (!second_pass)
657 continue; 657 continue;
658
658 thread->ptrace_bps[i] = NULL; 659 thread->ptrace_bps[i] = NULL;
659 unregister_hw_breakpoint(bp); 660 bp = ptrace_modify_breakpoint(bp, len, type,
661 tsk, 1);
662 if (IS_ERR(bp)) {
663 rc = PTR_ERR(bp);
664 thread->ptrace_bps[i] = NULL;
665 break;
666 }
667 thread->ptrace_bps[i] = bp;
660 } 668 }
661 continue; 669 continue;
662 } 670 }
663 671
664 bp = ptrace_modify_breakpoint(bp, len, type, tsk); 672 bp = ptrace_modify_breakpoint(bp, len, type, tsk, 0);
665 673
666 /* Incorrect bp, or we have a bug in bp API */ 674 /* Incorrect bp, or we have a bug in bp API */
667 if (IS_ERR(bp)) { 675 if (IS_ERR(bp)) {