Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/ia64 Don't check for unsigned variables being less ...



details:   https://anonhg.NetBSD.org/src/rev/634aad0a9b9d
branches:  trunk
changeset: 346745:634aad0a9b9d
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jul 31 19:10:54 2016 +0000

description:
Don't check for unsigned variables being less than 0 in
patchunwindframe(). Instead, check before subtracting, which in this
case means at the call site.

It would probably be better to change the call signature so the
subtraction happens inside patchunwindframe(), but since I don't
really know exactly what this code is trying to do I'm not comfortable
changing it.

Issue 1 in PR 51297 from David Binderman.

diffstat:

 sys/arch/ia64/ia64/db_trace.c     |  4 +++-
 sys/arch/ia64/unwind/stackframe.c |  4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r 9936a4dccc4e -r 634aad0a9b9d sys/arch/ia64/ia64/db_trace.c
--- a/sys/arch/ia64/ia64/db_trace.c     Sun Jul 31 18:27:26 2016 +0000
+++ b/sys/arch/ia64/ia64/db_trace.c     Sun Jul 31 19:10:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_trace.c,v 1.4 2008/04/28 20:23:25 martin Exp $      */
+/*     $NetBSD: db_trace.c,v 1.5 2016/07/31 19:10:54 dholland Exp $    */
 
 /* Inspired by reading alpha/db_trace.c */
 
@@ -99,6 +99,7 @@
                struct unwind_frame *uwf = &current_frame;
                debug_frame_dump_XXX(uwf);
 #endif
+               KASSERT(ip >= kernstart);
                patchunwindframe(&current_frame, ip - kernstart, kernstart);
 #ifdef UNWIND_DIAGNOSTIC
                debug_frame_dump_XXX(uwf);
@@ -186,6 +187,7 @@
 
        /* Stomp on rp and pfs 
         */
+       KASSERT(ip >= kernstart);
        patchunwindframe(uwf, ip - kernstart, kernstart);
 
 #ifdef UNWIND_DIAGNOSTIC
diff -r 9936a4dccc4e -r 634aad0a9b9d sys/arch/ia64/unwind/stackframe.c
--- a/sys/arch/ia64/unwind/stackframe.c Sun Jul 31 18:27:26 2016 +0000
+++ b/sys/arch/ia64/unwind/stackframe.c Sun Jul 31 19:10:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stackframe.c,v 1.5 2014/03/10 13:47:16 martin Exp $    */
+/*     $NetBSD: stackframe.c,v 1.6 2016/07/31 19:10:54 dholland Exp $  */
 
 /* Contributed to the NetBSD foundation by Cherry G. Mathew <cherry%mahiti.org@localhost>
  * This file contains routines to use decoded unwind descriptor entries
@@ -1169,10 +1169,12 @@
        struct uwtable_ent *uwt;
        uint64_t infoptr, procoffset, slotoffset;
 
+#if 0 /* does not work - moved to assertion at the call site */
        if (iprel < 0) {
                panic("unwind ip out of range!!! \n");
                return;
        }
+#endif
 
 
        uwt = get_unwind_table_entry(iprel);



Home | Main Index | Thread Index | Old Index