From: mpi Date: Sat, 10 Feb 2018 10:25:44 +0000 (+0000) Subject: Revert previous & incorrect NULL dereference fix. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2555ef73519acb24f67f2fd6c04decab17fc8825;p=openbsd Revert previous & incorrect NULL dereference fix. This unbreak backtrace across interrupt frames. --- diff --git a/sys/arch/amd64/amd64/db_trace.c b/sys/arch/amd64/amd64/db_trace.c index f3234a70cb3..5b3e9e27487 100644 --- a/sys/arch/amd64/amd64/db_trace.c +++ b/sys/arch/amd64/amd64/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.37 2017/12/08 08:54:03 mpi Exp $ */ +/* $OpenBSD: db_trace.c,v 1.38 2018/02/10 10:25:44 mpi Exp $ */ /* $NetBSD: db_trace.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /* @@ -300,15 +300,14 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, continue; } - if (is_trap == INTERRUPT) { + if (is_trap == INTERRUPT && lastframe != NULL) { /* * Interrupt routines don't update %rbp, so it still * points to the frame that was interrupted. Pull * back to just above lastframe so we can find the * trapframe as with syscalls and traps. */ - frame = (struct callframe *)db_get_value( - (db_addr_t)&lastframe->f_retaddr, sizeof(long), 0); + frame = (struct callframe *)&lastframe->f_retaddr; arg0 = &frame->f_arg0; } @@ -397,9 +396,8 @@ db_save_stack_trace(struct db_stack_trace *st) if (lastframe == NULL) break; - frame = (struct callframe *)db_get_value( - (db_addr_t)&lastframe->f_retaddr, - sizeof(long), 0); + frame = + (struct callframe *)&lastframe->f_retaddr; } lastframe = frame;