diff options
-rw-r--r-- | include/linux/kgdb.h | 2 | ||||
-rw-r--r-- | init/main.c | 1 | ||||
-rw-r--r-- | kernel/debug/debug_core.c | 11 |
3 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 0d6cf64c8bb1..3c755f6eaefd 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -360,9 +360,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_ */ diff --git a/init/main.c b/init/main.c index 9d964511fe0c..d9d914111251 100644 --- a/init/main.c +++ b/init/main.c @@ -1417,6 +1417,7 @@ static int __ref kernel_init(void *unused) async_synchronize_full(); kprobe_free_init_mem(); ftrace_free_init_mem(); + kgdb_free_init_mem(); free_initmem(); mark_readonly(); diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 1e75a8923a8d..8661eb2b1771 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -456,6 +456,17 @@ setundefined: 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; + } +} + #ifdef CONFIG_KGDB_KDB void kdb_dump_stack_on_cpu(int cpu) { |