summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLassi Tuura <lat@cern.ch>2010-04-24 19:24:49 -0700
committerArun Sharma <arun@sharma-home.net>2010-04-24 19:24:49 -0700
commit045c55b2a296988c16a4c1b90f3d8b7e8b78752b (patch)
tree7d2be91450ead7e845f04d6b03788a054654879e
parentd4fbc8326a91d246af29ff17131a12ed7ae87140 (diff)
downloadlibunwind-045c55b2a296988c16a4c1b90f3d8b7e8b78752b.tar.gz
Be conservative in all pointer derefrences by default.
Since most people can't completely control their compile or runtime environment, it becomes hard to ensure that unwind data is perfect.
-rw-r--r--configure.in6
-rw-r--r--src/x86_64/Ginit_local.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index fcc88137..e42445b2 100644
--- a/configure.in
+++ b/configure.in
@@ -169,6 +169,12 @@ if test x$enable_block_signals = xyes; then
AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations])
fi
+AC_ARG_ENABLE(conservative_checks,
+[ --enable-conservative-checks Validate all memory addresses before use],
+[enable_conservative_checks=$enableval], [enable_conservative_checks=yes])
+if test x$enable_conservative_checks = xyes; then
+ CPPFLAGS="${CPPFLAGS} -DCONSERVATIVE_CHECKS"
+fi
LIBUNWIND___THREAD
diff --git a/src/x86_64/Ginit_local.c b/src/x86_64/Ginit_local.c
index 70bef3e1..18b3d989 100644
--- a/src/x86_64/Ginit_local.c
+++ b/src/x86_64/Ginit_local.c
@@ -51,7 +51,11 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
c->dwarf.as = unw_local_addr_space;
c->dwarf.as_arg = c;
c->uc = uc;
+#if CONSERVATIVE_CHECKS
+ c->validate = 1;
+#else
c->validate = 0;
+#endif
return common_init (c, 1);
}