From 045c55b2a296988c16a4c1b90f3d8b7e8b78752b Mon Sep 17 00:00:00 2001 From: Lassi Tuura Date: Sat, 24 Apr 2010 19:24:49 -0700 Subject: [PATCH] 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. --- configure.in | 6 ++++++ src/x86_64/Ginit_local.c | 4 ++++ 2 files changed, 10 insertions(+) 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); }