[PATCH 4/4] Fix kgdb/kdb to conform to int3 format

From: Jeffrey Merkey
Date: Fri Jan 29 2016 - 13:19:44 EST


If a breakpoint is triggered under x86 with an int3 that
kdb does not know about, it will report it as a catastrophic
error rather than just assuming it was told to enter the debugger.

The macro that defines the kgdb breakpoint also needs to
conform to the newer gas format without the numbers.

Signed-off-by: Jeffrey Merkey <jeffmerkey@xxxxxxxxx>
---
arch/x86/include/asm/kgdb.h | 2 +-
kernel/debug/kdb/kdb_debugger.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/kgdb.h b/arch/x86/include/asm/kgdb.h
index 332f98c..e24908a 100644
--- a/arch/x86/include/asm/kgdb.h
+++ b/arch/x86/include/asm/kgdb.h
@@ -77,7 +77,7 @@ enum regnames {

static inline void arch_kgdb_breakpoint(void)
{
- asm(" int $3");
+ asm volatile("int3");
}
#define BREAK_INSTR_SIZE 1
#define CACHE_FLUSH_IS_SAFE 1
diff --git a/kernel/debug/kdb/kdb_debugger.c b/kernel/debug/kdb/kdb_debugger.c
index 15e1a7a..d9b944d 100644
--- a/kernel/debug/kdb/kdb_debugger.c
+++ b/kernel/debug/kdb/kdb_debugger.c
@@ -55,7 +55,7 @@ int kdb_stub(struct kgdb_state *ks)
int error = 0;
kdb_bp_t *bp;
unsigned long addr = kgdb_arch_pc(ks->ex_vector, ks->linux_regs);
- kdb_reason_t reason = KDB_REASON_OOPS;
+ kdb_reason_t reason = KDB_REASON_KEYBOARD;
kdb_dbtrap_t db_result = KDB_DB_NOBPT;
int i;

--
1.8.3.1