[PATCH] Define MODVERSION in a more reproducable way.
by Mark Wielaard
We define MODVERSION to make sure the libebl backend modules match the
elfutils build when we dlopen them. Using hostname and date makes it very
hard to create reproducable builds. Define them a little more reproducable
using LIBEBL_SUBDIR, eu_version and ac_cv_build.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 5 +++++
configure.ac | 12 ++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c67894e..3444519 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-05-31 Mark Wielaard <mjw(a)redhat.com>
+ * configure.ac (MODVERSION): Define using LIBEBL_SUBDIR, eu_version
+ and ac_cv_build.
+
+2015-05-31 Mark Wielaard <mjw(a)redhat.com>
+
* configure.ac (use_undefined): Use AC_LINK_IFELSE. AC_DEFINE
CHECK_UNDEFINED.
diff --git a/configure.ac b/configure.ac
index 58366d5..f9fb5be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,12 +29,6 @@ dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests])
AM_MAINTAINER_MODE
-dnl Unique ID for this build.
-MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)"
-AC_SUBST([MODVERSION])
-AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
-AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
-
AC_CONFIG_SRCDIR([libelf/libelf.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h])
@@ -388,6 +382,12 @@ esac
# Round up to the next release API (x.y) version.
eu_version=$(( (eu_version + 999) / 1000 ))
+dnl Unique ID for this build.
+MODVERSION="Build for ${LIBEBL_SUBDIR} ${eu_version} ${ac_cv_build}"
+AC_SUBST([MODVERSION])
+AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
+AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
+
AC_CHECK_SIZEOF(long)
# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
--
2.4.2
8 years, 3 months
[PATCH] Fix sanitize-undefined config check. Don't ALLOW_UNALIGNED when checking.
by Mark Wielaard
The -fsanitize=undefined check need to use AC_LINK_IFELSE to make sure
libubsan is installed. When doing undefined checking we should disable
ALLOW_UNALIGNED memory accesses to catch issues where we do unaligned
accesses by accident.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 5 +++++
configure.ac | 12 +++++++++---
lib/ChangeLog | 4 ++++
lib/eu-config.h | 3 ++-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f281f98..c67894e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-31 Mark Wielaard <mjw(a)redhat.com>
+
+ * configure.ac (use_undefined): Use AC_LINK_IFELSE. AC_DEFINE
+ CHECK_UNDEFINED.
+
2015-05-30 Mark Wielaard <mjw(a)redhat.com>
* configure.ac: Check for bunzip2. Check flex and bison are
diff --git a/configure.ac b/configure.ac
index 6386e96..58366d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,13 +202,19 @@ if test "$use_undefined" = yes; then
old_CXXFLAGS="$CXXFLAGS"
# We explicitly use unaligned access when possible (see ALLOW_UNALIGNED)
# We want to fail immediately on first error, don't try to recover.
- CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=alignment -fno-sanitize-recover"
- CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-sanitize=alignment -fno-sanitize-recover"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], use_undefined=yes, use_undefined=no)
+ CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize-recover"
+ CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-sanitize-recover"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main (int argc, char **argv) { return 0; }])], use_undefined=yes, use_undefined=no)
AS_IF([test "x$use_undefined" != xyes],
AC_MSG_WARN([gcc undefined behaviour sanitizer not available])
CFLAGS="$old_CFLAGS" CXXFLAGS="$old_CXXFLAGS")
fi
+case $use_undefined in
+ yes) check_undefined_val=1 ;;
+ *) check_undefined_val=0 ;;
+esac
+AC_DEFINE_UNQUOTED(CHECK_UNDEFINED, $check_undefined_val,
+ [Building with -fsanitize=undefined or not])
AC_ARG_ENABLE([valgrind],
AS_HELP_STRING([--enable-valgrind],[run all tests under valgrind]),
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 166f047..d04bf17 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-31 Mark Wielaard <mjw(a)redhat.com>
+
+ * eu-config.h (ALLOW_UNALIGNED): Define when ! CHECK_UNDEFINED.
+
2015-04-23 Max Filippov <jcmvbkbc(a)gmail.com>
* eu-config.h: Use SYMBOL_VERSIONING as guard.
diff --git a/lib/eu-config.h b/lib/eu-config.h
index 5bb21c1..400cdc6 100644
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -73,7 +73,8 @@
/* Define ALLOW_UNALIGNED if the architecture allows operations on
unaligned memory locations. */
-#if defined __i386__ || defined __x86_64__
+#define SANITIZE_UNDEFINED 1
+#if (defined __i386__ || defined __x86_64__) && ! CHECK_UNDEFINED
# define ALLOW_UNALIGNED 1
#else
# define ALLOW_UNALIGNED 0
--
2.4.2
8 years, 3 months
[PATCH] libdwfl: Don't assume auxv or r_debug data is properly aligned in link_map.
by Mark Wielaard
core file data isn't guaranteed to be alligned properly. Use
read_(4|8)ubyte_unaligned_noncvt to read values, types and addresses.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 7 +++++++
libdwfl/link_map.c | 25 +++++++++++++++----------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index ffb34c0..f4e7484 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,12 @@
2015-05-30 Mark Wielaard <mjw(a)redhat.com>
+ * link_map.c (check32): Use read_4ubyte_unaligned_noncvt to read
+ type and value.
+ (read_addrs): Use read_(4|8)ubyte_unaligned_noncvt or to read
+ adresses.
+
+2015-05-30 Mark Wielaard <mjw(a)redhat.com>
+
* find-debuginfo.c (dwfl_standard_find_debuginfo): Check file_name is
not NULL before calling canonicalize_file_name.
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index a5a6968..030c600 100644
--- a/libdwfl/link_map.c
+++ b/libdwfl/link_map.c
@@ -58,8 +58,7 @@ auxv_format_probe (const void *auxv, size_t size,
inline bool check64 (size_t i)
{
/* The AUXV pointer might not even be naturally aligned for 64-bit
- data, because note payloads in a core file are not aligned.
- But we assume the data is 32-bit aligned. */
+ data, because note payloads in a core file are not aligned. */
uint64_t type = read_8ubyte_unaligned_noncvt (&u->a64[i].a_type);
uint64_t val = read_8ubyte_unaligned_noncvt (&u->a64[i].a_un.a_val);
@@ -83,15 +82,21 @@ auxv_format_probe (const void *auxv, size_t size,
inline bool check32 (size_t i)
{
- if (u->a32[i].a_type == BE32 (PROBE_TYPE)
- && u->a32[i].a_un.a_val == BE32 (PROBE_VAL32))
+ /* The AUXV pointer might not even be naturally aligned for 32-bit
+ data, because note payloads in a core file are not aligned. */
+
+ uint32_t type = read_4ubyte_unaligned_noncvt (&u->a32[i].a_type);
+ uint32_t val = read_4ubyte_unaligned_noncvt (&u->a32[i].a_un.a_val);
+
+ if (type == BE32 (PROBE_TYPE)
+ && val == BE32 (PROBE_VAL32))
{
*elfdata = ELFDATA2MSB;
return true;
}
- if (u->a32[i].a_type == LE32 (PROBE_TYPE)
- && u->a32[i].a_un.a_val == LE32 (PROBE_VAL32))
+ if (type == LE32 (PROBE_TYPE)
+ && val == LE32 (PROBE_VAL32))
{
*elfdata = ELFDATA2LSB;
return true;
@@ -285,19 +290,19 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
{
if (elfdata == ELFDATA2MSB)
for (size_t i = 0; i < n; ++i)
- addrs[i] = BE32 (in->a32[i]);
+ addrs[i] = BE32 (read_4ubyte_unaligned_noncvt (&in->a32[i]));
else
for (size_t i = 0; i < n; ++i)
- addrs[i] = LE32 (in->a32[i]);
+ addrs[i] = LE32 (read_4ubyte_unaligned_noncvt (&in->a32[i]));
}
else
{
if (elfdata == ELFDATA2MSB)
for (size_t i = 0; i < n; ++i)
- addrs[i] = BE64 (in->a64[i]);
+ addrs[i] = BE64 (read_8ubyte_unaligned_noncvt (&in->a64[i]));
else
for (size_t i = 0; i < n; ++i)
- addrs[i] = LE64 (in->a64[i]);
+ addrs[i] = LE64 (read_8ubyte_unaligned_noncvt (&in->a64[i]));
}
return false;
--
2.4.2
8 years, 3 months
Fix more unbounded stack usage when !ALLOW_UNALIGNED.
by Mark Wielaard
On architectures (like arm) that don't ALLOW_UNALIGNED there were a
couple more issues with possible unbounded stack usage. The following
3 patches fix those:
libelf: Fix unbounded stack usage in elf_getarsym
libelf: Fix possible unbounded stack usage in getphdr_wrlock.
libelf: Fix possible unbounded stack usage in load_shdr_wrlock.
8 years, 3 months
Fix gcc -fsanitize=nonnull-attribute issues
by Mark Wielaard
GCC 5.1 includes -fsanitize=nonnull-attribute in -fsanitize=undefined.
This showed a couple of places where we were passing a NULL argument
to functions not expecting them. Even though these functions might not
actually use the argument (if for example the size argument of a buffer
is zero), gcc might use the information to assume the passed in variables
are always nonnull, which might cause unexpected optimizations.
libdwfl: Check file_name is not NULL before calling canonicalize_file_name.
libelf: Don't call mempcpy with possible NULL d_buf.
libelf: Don't call memmove with possible NULL buffer.
elfcmp: Don't call memcmp with possible NULL d_buf.
8 years, 3 months
[PATCH] tests: Always print reason when skipping test.
by Mark Wielaard
Make sure the reason a test is SKIPPED is added to the test-suite.log.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
tests/ChangeLog | 13 +++++++++++++
tests/backtrace-subr.sh | 4 ++--
tests/run-addr2line-i-demangle-test.sh | 1 +
tests/run-backtrace-demangle.sh | 3 ++-
tests/run-backtrace-native-biarch.sh | 3 ++-
tests/run-backtrace-native-core-biarch.sh | 3 ++-
tests/run-stack-demangled-test.sh | 1 +
tests/test-subr.sh | 4 ++--
8 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 94ee1f7..19878ac 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,16 @@
+2015-05-30 Mark Wielaard <mjw(a)redhat.com>
+
+ * backtrace-subr.sh (check_native_core): Notice core file couldn't be
+ generated before skipping.
+ * run-addr2line-i-demangle-test.sh: Notice demangler is unsupported
+ before skipping.
+ * run-backtrace-demangle.sh: Likewise.
+ * run-stack-demangled-test.sh: Likewise.
+ * run-backtrace-native-biarch.sh: Notice biarch testing is disabled
+ before skipping.
+ * run-backtrace-native-core-biarch.sh: Likewise.
+ * test-subr.sh (testfiles): Notice how bunzip2 fails before skipping.
+
2015-05-20 Mark Wielaard <mjw(a)redhat.com>
* run-addr2line-i-test.sh: Add pretty test.
diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index f04721c..790b4f4 100644
--- a/tests/backtrace-subr.sh
+++ b/tests/backtrace-subr.sh
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Red Hat, Inc.
+# Copyright (C) 2013, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -135,7 +135,7 @@ check_native_core()
if [ -f core ]; then
mv core "$core"
fi
- if [ ! -f "$core" ]; then exit 77; fi
+ if [ ! -f "$core" ]; then echo "No $core file generated"; exit 77; fi
if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
VALGRIND_CMD="$SAVED_VALGRIND_CMD"
diff --git a/tests/run-addr2line-i-demangle-test.sh b/tests/run-addr2line-i-demangle-test.sh
index e709acf..1af8562 100755
--- a/tests/run-addr2line-i-demangle-test.sh
+++ b/tests/run-addr2line-i-demangle-test.sh
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
+ echo "demangler unsupported"
exit 77
fi
diff --git a/tests/run-backtrace-demangle.sh b/tests/run-backtrace-demangle.sh
index 6e18e77..71a7351 100755
--- a/tests/run-backtrace-demangle.sh
+++ b/tests/run-backtrace-demangle.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
+ echo "demangler unsupported"
exit 77
fi
diff --git a/tests/run-backtrace-native-biarch.sh b/tests/run-backtrace-native-biarch.sh
index 3a407c8..2afe38a 100755
--- a/tests/run-backtrace-native-biarch.sh
+++ b/tests/run-backtrace-native-biarch.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-# Copyright (C) 2013 Red Hat, Inc.
+# Copyright (C) 2013, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test -n "$ELFUTILS_DISABLE_BIARCH"; then
+ echo "biarch testing disabled"
exit 77
fi
diff --git a/tests/run-backtrace-native-core-biarch.sh b/tests/run-backtrace-native-core-biarch.sh
index fbd8025..02552ce 100755
--- a/tests/run-backtrace-native-core-biarch.sh
+++ b/tests/run-backtrace-native-core-biarch.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-# Copyright (C) 2013 Red Hat, Inc.
+# Copyright (C) 2013, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test -n "$ELFUTILS_DISABLE_BIARCH"; then
+ echo "biarch testing disabled"
exit 77
fi
diff --git a/tests/run-stack-demangled-test.sh b/tests/run-stack-demangled-test.sh
index 0d9f8f3..98f8ff8 100755
--- a/tests/run-stack-demangled-test.sh
+++ b/tests/run-stack-demangled-test.sh
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
+ echo "demangler unsupported"
exit 77
fi
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index 5e796b4..f397aed 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2005-2014 Red Hat, Inc.
+# Copyright (C) 2005-2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -47,7 +47,7 @@ tempfiles()
testfiles()
{
for file; do
- bunzip2 -c ${abs_srcdir}/${file}.bz2 > ${file} 2>/dev/null || exit 77
+ bunzip2 -c ${abs_srcdir}/${file}.bz2 > ${file} || exit 77
remove_files="$remove_files $file"
done
}
--
2.1.0
8 years, 3 months
[PATCH] configure: Add check for bunzip2 and maintainer-mode tools.
by Mark Wielaard
Without bunzip2 make check cannot be run. To generate all files in
maintainer-mode flex and bison are needed. Otherwise check that
libdw/known-dwarf.h is already generated.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 6 ++++++
configure.ac | 24 ++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 9d417f9..f281f98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-30 Mark Wielaard <mjw(a)redhat.com>
+
+ * configure.ac: Check for bunzip2. Check flex and bison are
+ installed in maintainer-mode. Otherwise check libdw/known-dwarf.h
+ is already generated.
+
2015-05-21 Mark Wielaard <mjw(a)redhat.com>
* configure.ac: Add --enable-sanitize-undefined.
diff --git a/configure.ac b/configure.ac
index e0adad7..6386e96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -404,6 +404,29 @@ utrace_BIARCH
CC_BIARCH="$CC $utrace_biarch"
AC_SUBST([CC_BIARCH])
+# In maintainer mode we really need flex and bison.
+# Otherwise we really need a release dir with maintainer files generated.
+if test "x$enable_maintainer_mode" = xyes; then
+ AC_CHECK_PROG(HAVE_FLEX, flex, yes, no)
+ if test "$HAVE_FLEX" = "no"; then
+ AC_MSG_ERROR([flex needed in maintainer mode])
+ fi
+ AC_CHECK_PROG(HAVE_BISON, bison, yes, no)
+ if test "$HAVE_BISON" = "no"; then
+ AC_MSG_ERROR([bison needed in maintainer mode])
+ fi
+else
+ if test ! -f ${srcdir}/libdw/known-dwarf.h; then
+ AC_MSG_ERROR([No libdw/known-dwarf.h. configure --enable-maintainer-mode])
+ fi
+fi
+
+# The testfiles are all compressed, we need bunzip2 when running make check
+AC_CHECK_PROG(HAVE_BUNZIP2, bunzip2, yes, no)
+if test "$HAVE_BUNZIP2" = "no"; then
+ AC_MSG_WARN([No bunzip2, needed to run make check])
+fi
+
AC_OUTPUT
AC_MSG_NOTICE([
@@ -434,6 +457,7 @@ AC_MSG_NOTICE([
Native language support : ${USE_NLS}
EXTRA TEST FEATURES (used with make check)
+ have bunzip2 installed (required) : ${HAVE_BUNZIP2}
debug branch prediction : ${use_debugpred}
gprof support : ${use_gprof}
gcov support : ${use_gcov}
--
2.1.0
8 years, 3 months
[PATCH] libdw: Fix overflow in read_encoded_value for the DW_EH_PE_indirect case.
by Mark Wielaard
If we are going to dereference a pointer there should be at least enough
data to hold a pointer. Found by afl-fuzz.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdw/ChangeLog | 5 +++++
libdw/encoded-value.h | 7 ++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 2757093..aa4d09c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-27 Mark Wielaard <mjw(a)redhat.com>
+
+ * encoded-value.h (read_encoded_value): Check data d_size contains
+ at least enough data to hold a pointer for DW_EH_PE_indirect.
+
2015-05-22 Mark Wielaard <mjw(a)redhat.com>
* dwarf_getsrclines.c (read_srclines): Limit stack usage of lines
diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h
index 0fa2018..48d868f 100644
--- a/libdw/encoded-value.h
+++ b/libdw/encoded-value.h
@@ -214,9 +214,10 @@ read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding,
if (unlikely (*result < cache->frame_vaddr))
return true;
*result -= cache->frame_vaddr;
- if (unlikely (*result > (cache->data->d.d_size
- - encoded_value_size (NULL, cache->e_ident,
- DW_EH_PE_absptr, NULL))))
+ size_t ptrsize = encoded_value_size (NULL, cache->e_ident,
+ DW_EH_PE_absptr, NULL);
+ if (unlikely (cache->data->d.d_size < ptrsize
+ || *result > (cache->data->d.d_size - ptrsize)))
return true;
const uint8_t *ptr = cache->data->d.d_buf + *result;
if (unlikely (__libdw_cfi_read_address_inc (cache, &ptr, 0, result)
--
1.8.3.1
8 years, 3 months
[PATCH] libdwfl: Check mod is not NULL in check_module.
by Mark Wielaard
check_module is called from dwfl_module_relocate_address and from
dwfl_module_address_section. Both could take a NULL Dwfl_Module if
an earlier error had occured. Make check_module return immediately
indicating an issue in that case.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/derelocate.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 90fc0f3..dec3405 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-24 Mark Wielaard <mjw(a)redhat.com>
+
+ * derelocate.c (check_module): Check mod is not NULL.
+
2015-05-22 Mark Wielaard <mjw(a)redhat.com>
* link_map.c (dwfl_link_map_report): Allocate phdrs and dyn with
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index cec9655..4e5a568 100644
--- a/libdwfl/derelocate.c
+++ b/libdwfl/derelocate.c
@@ -285,6 +285,9 @@ dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx,
static bool
check_module (Dwfl_Module *mod)
{
+ if (mod == NULL)
+ return true;
+
if (INTUSE(dwfl_module_getsymtab) (mod) < 0)
{
Dwfl_Error error = dwfl_errno ();
--
1.8.3.1
8 years, 4 months
Prevent unbounded stack usage in libraries
by Mark Wielaard
Hi,
The following patches makes sure we can use gcc -Wstack-usage
to check there is no unbounded stack usage. This is mostly done by
changing unbounded alloca or dynamic stack arrays into a fixed bounded
stack array or just calling malloc and free directly.
The last patch adds -Wstack-usage to eu.am enabled by default.
All the library code now compiles without stack-usage warnings.
Most of the src tools files don't yet. Exceptions have been added
to src/Makefile.am. I hope to eventually be able to build everything
with bounded stack usage that the compiler can check.
Cheers,
Mark
8 years, 4 months