kgdb,x86: fix regression in detach handling
The fix from ba773f7c51
(x86,kgdb: Fix hw breakpoint regression) was not entirely complete.
The kgdb_remove_all_hw_break() function also needs to call the
hw_break_release_slot() or else a breakpoint can get activated again
after the debugger has detached.
The kgdb test suite exposes the behavior in the form of either a hang
or repetitive failure. The kernel config that exposes the problem
contains all of the following:
CONFIG_DEBUG_RODATA=y
CONFIG_KGDB_TESTS=y
CONFIG_KGDB_TESTS_ON_BOOT=y
CONFIG_KGDB_TESTS_BOOT_STRING="V1F100"
Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Tested-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
parent
5450d90405
commit
10a6e67648
|
@ -315,14 +315,18 @@ static void kgdb_remove_all_hw_break(void)
|
||||||
if (!breakinfo[i].enabled)
|
if (!breakinfo[i].enabled)
|
||||||
continue;
|
continue;
|
||||||
bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
|
bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
|
||||||
if (bp->attr.disabled == 1)
|
if (!bp->attr.disabled) {
|
||||||
|
arch_uninstall_hw_breakpoint(bp);
|
||||||
|
bp->attr.disabled = 1;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (dbg_is_early)
|
if (dbg_is_early)
|
||||||
early_dr7 &= ~encode_dr7(i, breakinfo[i].len,
|
early_dr7 &= ~encode_dr7(i, breakinfo[i].len,
|
||||||
breakinfo[i].type);
|
breakinfo[i].type);
|
||||||
else
|
else if (hw_break_release_slot(i))
|
||||||
arch_uninstall_hw_breakpoint(bp);
|
printk(KERN_ERR "KGDB: hw bpt remove failed %lx\n",
|
||||||
bp->attr.disabled = 1;
|
breakinfo[i].addr);
|
||||||
|
breakinfo[i].enabled = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue