Commit d54ce615 authored by Sumit Garg's avatar Sumit Garg Committed by Linus Torvalds
Browse files

kgdb: fix to kill breakpoints on initmem after boot

Currently breakpoints in kernel .init.text section are not handled
correctly while allowing to remove them even after corresponding pages
have been freed.

Fix it via killing .init.text section breakpoints just prior to initmem
pages being freed.

Doug: "HW breakpoints aren't handled by this patch but it's probably
not such a big deal".


Signed-off-by: default avatarSumit Garg <>
Suggested-by: default avatarDoug Anderson <>
Acked-by: default avatarDoug Anderson <>
Acked-by: default avatarDaniel Thompson <>
Tested-by: default avatarDaniel Thompson <>
Cc: Masami Hiramatsu <>
Cc: Steven Rostedt (VMware) <>
Cc: Jason Wessel <>
Cc: Peter Zijlstra <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent db7fbf49
......@@ -359,9 +359,11 @@ extern atomic_t kgdb_active;
extern bool dbg_is_early;
extern void __init dbg_late_init(void);
extern void kgdb_panic(const char *msg);
extern void kgdb_free_init_mem(void);
#else /* ! CONFIG_KGDB */
#define in_dbg_master() (0)
#define dbg_late_init()
static inline void kgdb_panic(const char *msg) {}
static inline void kgdb_free_init_mem(void) { }
#endif /* ! CONFIG_KGDB */
#endif /* _KGDB_H_ */
......@@ -1426,6 +1426,7 @@ static int __ref kernel_init(void *unused)
......@@ -455,6 +455,17 @@ int dbg_remove_all_break(void)
return 0;
void kgdb_free_init_mem(void)
int i;
/* Clear init memory breakpoints. */
for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) {
if (init_section_contains((void *)kgdb_break[i].bpt_addr, 0))
kgdb_break[i].state = BP_UNDEFINED;
void kdb_dump_stack_on_cpu(int cpu)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment