summaryrefslogtreecommitdiff
path: root/lib/libexecinfo
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2019-01-30 22:46:49 +0000
committermrg <mrg@NetBSD.org>2019-01-30 22:46:49 +0000
commitdefb2b7d1ba7e944d4e53aa24a55de7742b30025 (patch)
treef9f8e4a159200b954418844a2a99e084223b180d /lib/libexecinfo
parenteac962909835b4c52a893f3d7bb41fa61fb755f6 (diff)
make the backtrace()'s tracer() return _URC_FOREIGN_EXCEPTION_CAUGHT
when the array is full. it won't be able to do any more work if so, and avoids infinite loops in unwinding as seen on arm64. XXX: lack of signal support here means that backtrace() is useless XXX: from a signal handler, such as attempting to display the stack XXX: when handling a SIGSEGV.
Diffstat (limited to 'lib/libexecinfo')
-rw-r--r--lib/libexecinfo/unwind.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libexecinfo/unwind.c b/lib/libexecinfo/unwind.c
index f2a27cef0be..fef24d90ceb 100644
--- a/lib/libexecinfo/unwind.c
+++ b/lib/libexecinfo/unwind.c
@@ -1,4 +1,4 @@
-/* $NetBSD: unwind.c,v 1.2 2014/03/24 21:26:01 joerg Exp $ */
+/* $NetBSD: unwind.c,v 1.3 2019/01/30 22:46:49 mrg Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -52,6 +52,8 @@ tracer(struct _Unwind_Context *ctx, void *arg)
}
if (t->n < t->len)
t->arr[t->n++] = (void *)_Unwind_GetIP(ctx);
+ else
+ return _URC_FOREIGN_EXCEPTION_CAUGHT;
return 0;
}