]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Add configure --disable-textrelcheck option to enable CC=afl-fuzz on 32bit.
authorMark Wielaard <mjw@redhat.com>
Thu, 27 Nov 2014 22:53:30 +0000 (23:53 +0100)
committerMark Wielaard <mjw@redhat.com>
Thu, 4 Dec 2014 13:38:18 +0000 (14:38 +0100)
Using american fuzzy lop has found a lot of issues. It would be nice to
make using it a bit easier. Our build files make sure that no shared
library uses text relocations, but afl-gcc will insert some on i686.
http://www.akkadia.org/drepper/textrelocs.html

Now CC=afl-gcc ./configure --disable-textrelcheck will allow them so
that afl can instrument the libraries.

Don't try to use or install them except with afl-fuzz. When selinux is
enabled it might prevent loading the libraries with DT_TEXTREL set.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
ChangeLog
config/ChangeLog
config/eu.am
configure.ac
libasm/ChangeLog
libasm/Makefile.am
libdw/ChangeLog
libdw/Makefile.am
libelf/ChangeLog
libelf/Makefile.am

index 0947608d373b01fc7d9e8ef5369ebde416cd2d21..8eeaa08e49d7cde301634ac8dc86c63854cf84ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-27  Mark Wielaard  <mjw@redhat.com>
+
+       * configure.ac: Add --disable-textrelcheck.
+
 2014-10-06  Mark Wielaard  <mjw@redhat.com>
 
        * NEWS: New section 0.161. Add dwarf_peel_type.
index 9ebf14f4b3a7f6b7007f6afe5268e1b5049cd41d..a05f5522cc638908aab3393ccdb5bc03c5d80d11 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-27  Mark Wielaard  <mjw@redhat.com>
+
+       * eu.am: Define textrel_msg, textrel_found and textrel_check based
+       on FATAL_TEXTREL.
+
 2014-08-25  Mark Wielaard  <mjw@redhat.com>
 
        * elfutils.spec.in: Update for 0.160.
index c3b00e08dffc09470de769d4853e0f39bcad33ae..faf8add488cc0b4701cdb68450e3b7b87bbd13a9 100644 (file)
@@ -52,4 +52,10 @@ endif
 
 CLEANFILES = *.gcno *.gcda
 
-textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
+textrel_msg = echo "WARNING: TEXTREL found in '$@'"
+if FATAL_TEXTREL
+textrel_found = $(textrel_msg); exit 1
+else
+textrel_found = $(textrel_msg)
+endif
+textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi
index 76a172def243511ca259fec8cc94a3614bc511dc..9bc83c54f00bb2705cad7c449bdab902f05b623e 100644 (file)
@@ -212,6 +212,11 @@ AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
 AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
 AM_CONDITIONAL(DEMANGLE, test "$ac_cv_lib_stdcpp___cxa_demangle" = yes)
 
+AC_ARG_ENABLE([textrelcheck],
+AS_HELP_STRING([--disable-textrelcheck],
+               [Disable textrelcheck being a fatal error]))
+AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"])
+
 dnl The directories with content.
 
 dnl Documentation.
index 2613610f40b2a6f6a68197652a3e6a37761281b7..034a64da5fff09049a11350fb6eb6f28a2a5714e 100644 (file)
@@ -1,3 +1,7 @@
+2014-01127  Mark Wielaard  <mjw@redhat.com>
+
+       * Makefile.am (libasm.so): Use textrel_check.
+
 2014-04-13  Mark Wielaard  <mjw@redhat.com>
 
        * Makefile.am: Remove !MUDFLAP conditions.
index 3d6a2e589e8e64c6811881ca43f6e20e31dbe61b..88c2530bb14ddc50b50948d689097c05d602bf2e 100644 (file)
@@ -66,7 +66,7 @@ libasm.so$(EXEEXT): libasm_pic.a libasm.map
                -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
                -Wl,--soname,$@.$(VERSION) \
                ../libebl/libebl.a ../libelf/libelf.so  $(libasm_so_LDLIBS)
-       if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       $(textrel_check)
        ln -fs $@ $@.$(VERSION)
 
 install: install-am libasm.so
index c199707d960c511d34a876e96b70faa071164935..bab02e5948cfd568dcb77f521800001533c66a81 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-27  Mark Wielaard  <mjw@redhat.com>
+
+       * Makefile.am (libdw.so): Use textrel_check.
+
 2014-11-27  Mark Wielaard  <mjw@redhat.com>
 
        * dwarf_getcfi_elf.c (getcfi_gnu_eh_frame): Initialize
index 852d2c84458c2462c17a81d61d31e5b90a3ecad1..7a2a25d3a3283cd6d9006aa8a547e2f3a5408207 100644 (file)
@@ -113,7 +113,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
                -Wl,--version-script,$<,--no-undefined \
                -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
                -ldl $(zip_LIBS)
-       if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       $(textrel_check)
        ln -fs $@ $@.$(VERSION)
 
 install: install-am libdw.so
index 68fb0fc1f80691e33cc2503db4587a49b523ac6d..e03ee09f2867008c7ac9818104e87f2fcda02f43 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-27  Mark Wielaard  <mjw@redhat.com>
+
+       * Makefile.am (libelf.so): Use textrel_check.
+
 2014-11-23  Mark Wielaard  <mjw@redhat.com>
 
        * elf_getdata_rawchunk.c (elf_getdata_rawchunk): Change signed
index 493e4ec1e4ae827b32efc7cc1eeca699b3fb32a4..6888529338231af8d39e9c7223225485d3418592 100644 (file)
@@ -103,7 +103,7 @@ libelf.so$(EXEEXT): libelf_pic.a libelf.map
        $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
                -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
                -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
-       if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       $(textrel_check)
        ln -fs $@ $@.$(VERSION)
 
 install: install-am libelf.so