Message ID | 1453941170-12319-1-git-send-email-yang.shi@linaro.org |
---|---|
State | New |
Headers | show |
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 99635dd..4464489 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c @@ -980,10 +980,12 @@ static void kgdbts_run_tests(void) int i; ptr = strchr(config, 'F'); - if (ptr) + if (ptr && + (!IS_ENABLED(CONFIG_DEBUG_RODATA) || !IS_ENABLED(CONFIG_KGDB_TESTS_ON_BOOT))) fork_test = simple_strtol(ptr + 1, NULL, 10); ptr = strchr(config, 'S'); - if (ptr) + if (ptr && + (!IS_ENABLED(CONFIG_DEBUG_RODATA) || !IS_ENABLED(CONFIG_KGDB_TESTS_ON_BOOT))) do_sys_open_test = simple_strtol(ptr + 1, NULL, 10); ptr = strchr(config, 'N'); if (ptr)
kgdbts do_fork and sys_open tests are scheduled before mark_rodata_ro gets called when kgdbts is run on boot. But, the breakpoint is removed by a kernel thread which may be scheduled after mark_rodata_ro is called. So, this will cause the below kernel panic: KGDB: BP remove failed: ffffffc0000c36a8 KGDB: re-enter exception: ALL breakpoints killed CPU: 0 PID: 2 Comm: kthreadd Not tainted 4.5.0-rc1 #110 Hardware name: Freescale Layerscape 2085a RDB Board (DT) Call trace: [<ffffffc00008a998>] dump_backtrace+0x0/0x1b0 [<ffffffc00008ab6c>] show_stack+0x24/0x30 [<ffffffc0004d2644>] dump_stack+0x8c/0xc8 [<ffffffc00017ca08>] kgdb_handle_exception+0x228/0x238 [<ffffffc000096a24>] kgdb_step_brk_fn+0x2c/0x40 [<ffffffc000083c2c>] single_step_handler+0x7c/0x108 [<ffffffc000082474>] do_debug_exception+0x54/0xb8 Exception stack(0xffffffc0797175b0 to 0xffffffc0797176d0) 75a0: ffffffc079714000 ffffffffffffffff 75c0: ffffffc079717770 ffffffc000085418 deadbeefdeadbeef deadbeefdeadbeef 75e0: deadbeefdeadbeef deadbeefdeadbeef deadbeefdeadbeef deadbeefdeadbeef 7600: deadbeefdeadbeef deadbeefdeadbeef deadbeefdeadbeef deadbeefdeadbeef 7620: deadbeefdeadbeef deadbeefdeadbeef deadbeefdeadbeef deadbeefdeadbeef 7640: deadbeefdeadbeef deadbeefdeadbeef ffffffc0000c36a8 000000009600004f 7660: 0000000000000004 00000000d4208000 ffffffc079709580 ffffffc0000c36ac 7680: ffffffc0000c36a8 622f2f2f2f626565 7f7f7f7f7f7f7f7f 63ff332b37603532 76a0: 7f7f7f7f7f7f7f7f 0101010101010101 0000000000000030 0000000000000000 76c0: 0000000000000000 ffffffc001abb11d [<ffffffc0000854b4>] el1_dbg+0x18/0x6c [<ffffffc000096dd4>] kgdb_arch_set_breakpoint+0x64/0xe8 [<ffffffc00017bc50>] kgdb_validate_break_address+0x28/0x68 [<ffffffc00017bdd0>] dbg_set_sw_break+0x20/0x118 [<ffffffc00017e440>] gdb_serial_stub+0xc60/0xcc0 [<ffffffc00017c3a8>] kgdb_cpu_enter+0x428/0x6c0 [<ffffffc00017c8e8>] kgdb_handle_exception+0x108/0x238 [<ffffffc000096a24>] kgdb_step_brk_fn+0x2c/0x40 [<ffffffc000083c2c>] single_step_handler+0x7c/0x108 [<ffffffc000082474>] do_debug_exception+0x54/0xb8 Exception stack(0xffffffc079717b50 to 0xffffffc079717c70) 7b40: 0000000000000611 ffffffc0000eab88 7b60: ffffffc079717d10 ffffffc000085598 ffffffc079717d10 00000000f2000400 7b80: ffffffc000cbd000 ffffffc000096a38 ffffffc000d84cf3 ffffffc00011a940 7ba0: 0000000500000001 0000000000000000 0000000000000000 0000000000000000 7bc0: 0000000000000000 0000000000000002 ffffffc079717d10 0000000000000000 7be0: ffffffc079717c00 ffffffc000096a60 0000000000800711 ffffffc0000eab88 7c00: ffffffc0763f0e00 0000000000000000 0000000000000000 0000000000000000 7c20: ffffffc079717e60 0000000000000000 0000000000000000 ffffffc000d2d000 7c40: 0000000000001150 010181a300000002 00000000bdb6099c ffffffc0017a96f0 7c60: ed81000001000000 ffffffc07630fb4c [<ffffffc0000854b4>] el1_dbg+0x18/0x6c [<ffffffc0000ebac0>] kthreadd+0x1d8/0x268 [<ffffffc000085cd0>] ret_from_fork+0x10/0x40 Kernel panic - not syncing: Recursive entry to debugger Disable do_fork and sys_open tests on boot, but they still can be run after the system is bootup. Signed-off-by: Yang Shi <yang.shi@linaro.org> --- drivers/misc/kgdbts.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.0.2