Revert previous & incorrect NULL dereference fix.
authormpi <mpi@openbsd.org>
Sat, 10 Feb 2018 10:25:44 +0000 (10:25 +0000)
committermpi <mpi@openbsd.org>
Sat, 10 Feb 2018 10:25:44 +0000 (10:25 +0000)
This unbreak backtrace across interrupt frames.

sys/arch/amd64/amd64/db_trace.c

index f3234a7..5b3e9e2 100644 (file)
@@ -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;