Skip to contentSkip to conversation

kdb: Fix btc (backtrace on each cpu) crash

PATCH In review Douglas Anderson 2 participants 3 messages Oct 30, 2018 – Oct 31, 2018

Subsystems (2)
lore
Share & tools
lore

Douglas Anderson

author reviewer
#0 lore raw

PATCH 1/1 kdb: Fix btc (backtrace on each cpu) crash

Typing 'btc' on kdb doing all sorts of fail. Sometimes it would crash, sometimes display nothing, and sometimes hang.

Bisect tracked this down to the commit ad67b74d2469 ("printk: hash addresses printed with %p"), suggesting an obvious fix. The pointer used internally in kdb shouldn't be hashed, so switch it to %px.

Fixes ad67b74d2469 ("printk: hash addresses printed with %p")

---

 kernel/debug/kdb/kdb_bt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/debug/kdb/kdb_bt.c +2 -2
index 6ad4a9fcbd6f..7921ae4fca8d 100644
@@ -179,14 +179,14 @@ kdb_bt(int argc, const char **argv)
 				kdb_printf("no process for cpu %ld\n", cpu);
 				return 0;
 			}
-			sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu));
+			sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu));
 			kdb_parse(buf);
 			return 0;
 		}
 		kdb_printf("btc: cpu status: ");
 		kdb_parse("cpu\n");
 		for_each_online_cpu(cpu) {
-			sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu));
+			sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu));
 			kdb_parse(buf);
 			touch_nmi_watchdog();
 		}
Signature · 1 line
2.19.1.568.g152ad8e336-goog
#1 lore raw
Quoted 10 lines · Douglas Anderson

Typing 'btc' on kdb doing all sorts of fail. Sometimes it would crash, sometimes display nothing, and sometimes hang.

Bisect tracked this down to the commit ad67b74d2469 ("printk: hash addresses printed with %p"), suggesting an obvious fix. The pointer used internally in kdb shouldn't be hashed, so switch it to %px.

Fixes ad67b74d2469 ("printk: hash addresses printed with %p")

I think we've already got a fix for this:
https://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git/commit/?h=kgdb-next&id=a0ca72c2d1ac83d0853a23ffde8f3624648b1ee8

Daniel.

Quoted 29 lines

---

 kernel/debug/kdb/kdb_bt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/debug/kdb/kdb_bt.c +2 -2
index 6ad4a9fcbd6f..7921ae4fca8d 100644
@@ -179,14 +179,14 @@ kdb_bt(int argc, const char **argv)
 				kdb_printf("no process for cpu %ld\n", cpu);
 				return 0;
 			}
-			sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu));
+			sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu));
 			kdb_parse(buf);
 			return 0;
 		}
 		kdb_printf("btc: cpu status: ");
 		kdb_parse("cpu\n");
 		for_each_online_cpu(cpu) {
-			sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu));
+			sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu));
 			kdb_parse(buf);
 			touch_nmi_watchdog();
 		}
Signature · 1 line
2.19.1.568.g152ad8e336-goog
author reviewer
#2 lore raw

Hi,

Quoted 9 lines · Daniel Thompson
Quoted 7 lines · Douglas Anderson

Typing 'btc' on kdb doing all sorts of fail. Sometimes it would crash, sometimes display nothing, and sometimes hang.

Bisect tracked this down to the commit ad67b74d2469 ("printk: hash addresses printed with %p"), suggesting an obvious fix. The pointer used internally in kdb shouldn't be hashed, so switch it to %px.

Quoted 6 lines
Quoted 3 lines
Fixes ad67b74d2469 ("printk: hash addresses printed with %p")

I think we've already got a fix for this:
https://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git/commit/?h=kgdb-next&id=a0ca72c2d1ac83d0853a23ffde8f3624648b1ee8

Ah ha. Nice! Sorry for not noticing this. The newest I tested was 4.19.

-Doug