about summary refs log tree commit diff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/afl++-keep-all-crashes.patch17
-rw-r--r--patches/bugs/coreutils-unfix-bug-25003.patch13
-rw-r--r--patches/coreutils-gnulib-glibc-2.25.patch65
-rw-r--r--patches/coreutils-gnulib-glibc-2.28.patch169
-rw-r--r--patches/evocatio-argv-fuzz-amd64-only.patch30
-rw-r--r--patches/jasper-no-define-int-types.patch19
6 files changed, 305 insertions, 8 deletions
diff --git a/patches/afl++-keep-all-crashes.patch b/patches/afl++-keep-all-crashes.patch
index e3ce8f6..2b1f57d 100644
--- a/patches/afl++-keep-all-crashes.patch
+++ b/patches/afl++-keep-all-crashes.patch
@@ -1,16 +1,16 @@
 diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c
-index f05bb7db59d5..de275e374ff1 100644
+index 19cdf511149f..dd7cb510b62c 100644
 --- a/src/afl-fuzz-bitmap.c
 +++ b/src/afl-fuzz-bitmap.c
-@@ -556,7 +556,6 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault, u8 inc) {
-     if (likely(!new_bits && !new_paths)) {
+@@ -639,7 +639,6 @@ u8 __attribute__((hot)) save_if_interesting(afl_state_t *afl, void *mem,
+       if (san_fault == FSRV_RUN_OK) {
  
-       if (unlikely(afl->crash_mode)) { ++afl->total_crashes; }
--      return 0;
+         if (unlikely(afl->crash_mode)) { ++afl->total_crashes; }
+-        return 0;
  
-     }
+       } else {
  
-@@ -837,16 +836,12 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault, u8 inc) {
+@@ -934,8 +933,6 @@ may_save_fault:
  
        ++afl->total_crashes;
  
@@ -18,7 +18,8 @@ index f05bb7db59d5..de275e374ff1 100644
 -
        if (likely(!afl->non_instrumented_mode)) {
  
-         if (!classified) { classify_counts(&afl->fsrv); }
+         if (unlikely(!classified)) {
+@@ -947,8 +944,6 @@ may_save_fault:
  
          simplify_trace(afl, afl->fsrv.trace_bits);
  
diff --git a/patches/bugs/coreutils-unfix-bug-25003.patch b/patches/bugs/coreutils-unfix-bug-25003.patch
new file mode 100644
index 0000000..0a5e4de
--- /dev/null
+++ b/patches/bugs/coreutils-unfix-bug-25003.patch
@@ -0,0 +1,13 @@
+diff --git a/src/split.c b/src/split.c
+index 9a0704c26184..f9c99db43f9b 100644
+--- a/src/split.c
++++ b/src/split.c
+@@ -982,7 +982,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
+   start = (k - 1) * (file_size / n);
+   end = (k == n) ? file_size : k * (file_size / n);
+ 
+-  if (start < initial_read)
++  if (initial_read != SIZE_MAX || start < initial_read)
+     {
+       memmove (buf, buf + start, initial_read - start);
+       initial_read -= start;
diff --git a/patches/coreutils-gnulib-glibc-2.25.patch b/patches/coreutils-gnulib-glibc-2.25.patch
new file mode 100644
index 0000000..4a9d83d
--- /dev/null
+++ b/patches/coreutils-gnulib-glibc-2.25.patch
@@ -0,0 +1,65 @@
+commit 4da63c5881f60f71999a943612da9112232b9161
+Author: Eric Blake <eblake@redhat.com>
+Date:   2016-09-14 19:21:42 -0500
+
+    mountlist: include sysmacros.h for glibc
+    
+    On Fedora rawhide (glibc 2.25), './gnulib-tool --test mountlist'
+    reports:
+    ../../gllib/mountlist.c: In function 'read_file_system_list':
+    ../../gllib/mountlist.c:534:13: warning: '__makedev_from_sys_types' is deprecated:
+      In the GNU C Library, `makedev' is defined by <sys/sysmacros.h>.
+      For historical compatibility, it is currently defined by
+      <sys/types.h> as well, but we plan to remove this soon.
+      To use `makedev', include <sys/sysmacros.h> directly.
+      If you did not intend to use a system-defined macro `makedev',
+      you should #undef it after including <sys/types.h>.
+      [-Wdeprecated-declarations]
+                 me->me_dev = makedev (devmaj, devmin);
+                 ^~
+    In file included from /usr/include/features.h:397:0,
+                     from /usr/include/sys/types.h:25,
+                     from ./sys/types.h:28,
+                     from ../../gllib/mountlist.h:23,
+                     from ../../gllib/mountlist.c:20:
+    /usr/include/sys/sysmacros.h:89:1: note: declared here
+     __SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_FST_IMPL_TEMPL)
+     ^
+    
+    Fix it by including the right headers.  We also need a fix to
+    autoconf's AC_HEADER_MAJOR, but that's a separate patch.
+    
+    * m4/mountlist.m4 (gl_PREREQ_MOUTLIST_EXTRA): Include
+    AC_HEADER_MAJOR.
+    * lib/mountlist.c (includes): Use correct headers.
+    
+    Signed-off-by: Eric Blake <eblake@redhat.com>
+
+diff --git a/lib/mountlist.c b/lib/mountlist.c
+index bb4e4ee21097..cf4020e2ab75 100644
+--- a/lib/mountlist.c
++++ b/lib/mountlist.c
+@@ -37,6 +37,12 @@
+ # include <sys/param.h>
+ #endif
+ 
++#if MAJOR_IN_MKDEV
++# include <sys/mkdev.h>
++#elif MAJOR_IN_SYSMACROS
++# include <sys/sysmacros.h>
++#endif
++
+ #if defined MOUNTED_GETFSSTAT   /* OSF_1 and Darwin1.3.x */
+ # if HAVE_SYS_UCRED_H
+ #  include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
+diff --git a/m4/mountlist.m4 b/m4/mountlist.m4
+index 2e2ca37fbf0c..b6724fa33b87 100644
+--- a/m4/mountlist.m4
++++ b/m4/mountlist.m4
+@@ -15,5 +15,6 @@ AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
+ [
+   dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h.
+   AC_CHECK_HEADERS([sys/mntent.h])
++  AC_HEADER_MAJOR()dnl for use of makedev ()
+   gl_FSTYPENAME
+ ])
diff --git a/patches/coreutils-gnulib-glibc-2.28.patch b/patches/coreutils-gnulib-glibc-2.28.patch
new file mode 100644
index 0000000..6281c0d
--- /dev/null
+++ b/patches/coreutils-gnulib-glibc-2.28.patch
@@ -0,0 +1,169 @@
+commit 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date:   2018-03-05 10:56:29 -0800
+
+    fflush: adjust to glibc 2.28 libio.h removal
+    
+    Problem reported by Daniel P. Berrangé in:
+    https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
+    * lib/fflush.c (clear_ungetc_buffer_preserving_position)
+    (disable_seek_optimization, rpl_fflush):
+    * lib/fpurge.c (fpurge):
+    * lib/freadahead.c (freadahead):
+    * lib/freading.c (freading):
+    * lib/freadptr.c (freadptr):
+    * lib/freadseek.c (freadptrinc):
+    * lib/fseeko.c (fseeko):
+    * lib/fseterr.c (fseterr):
+    Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
+    * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
+    Define if not already defined.
+
+diff --git a/lib/fflush.c b/lib/fflush.c
+index 983ade0ffbd9..a6edfa105b01 100644
+--- a/lib/fflush.c
++++ b/lib/fflush.c
+@@ -33,7 +33,7 @@
+ #undef fflush
+ 
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+ /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+ static void
+@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
+ 
+ #endif
+ 
+-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+ 
+ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
+   if (stream == NULL || ! freading (stream))
+     return fflush (stream);
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+   clear_ungetc_buffer_preserving_position (stream);
+ 
+diff --git a/lib/fpurge.c b/lib/fpurge.c
+index b1d417c7a2b0..3aedcc373468 100644
+--- a/lib/fpurge.c
++++ b/lib/fpurge.c
+@@ -62,7 +62,7 @@ fpurge (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_IO_read_end = fp->_IO_read_ptr;
+   fp->_IO_write_ptr = fp->_IO_write_base;
+   /* Avoid memory leak when there is an active ungetc buffer.  */
+diff --git a/lib/freadahead.c b/lib/freadahead.c
+index c2ecb5b28a81..23ec76ee5391 100644
+--- a/lib/freadahead.c
++++ b/lib/freadahead.c
+@@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *);
+ size_t
+ freadahead (FILE *fp)
+ {
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_write_ptr > fp->_IO_write_base)
+     return 0;
+   return (fp->_IO_read_end - fp->_IO_read_ptr)
+diff --git a/lib/freading.c b/lib/freading.c
+index 73c28acddfdc..c24d0c88abf6 100644
+--- a/lib/freading.c
++++ b/lib/freading.c
+@@ -31,7 +31,7 @@ freading (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return ((fp->_flags & _IO_NO_WRITES) != 0
+           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+               && fp->_IO_read_base != NULL));
+diff --git a/lib/freadptr.c b/lib/freadptr.c
+index 5aeadf3da1e5..ffb8010392e2 100644
+--- a/lib/freadptr.c
++++ b/lib/freadptr.c
+@@ -29,7 +29,7 @@ freadptr (FILE *fp, size_t *sizep)
+   size_t size;
+ 
+   /* Keep this code in sync with freadahead!  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_write_ptr > fp->_IO_write_base)
+     return NULL;
+   size = fp->_IO_read_end - fp->_IO_read_ptr;
+diff --git a/lib/freadseek.c b/lib/freadseek.c
+index e7b0c7bdb32b..5fd2dd7cac23 100644
+--- a/lib/freadseek.c
++++ b/lib/freadseek.c
+@@ -36,7 +36,7 @@ freadptrinc (FILE *fp, size_t increment)
+   /* Keep this code in sync with freadptr!  */
+ #if HAVE___FREADPTRINC              /* musl libc */
+   __freadptrinc (fp, increment);
+-#elif defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#elif defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_IO_read_ptr += increment;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+diff --git a/lib/fseeko.c b/lib/fseeko.c
+index 0101ab55f703..193f4e8ce515 100644
+--- a/lib/fseeko.c
++++ b/lib/fseeko.c
+@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+ #endif
+ 
+   /* These tests are based on fpurge.c.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_read_end == fp->_IO_read_ptr
+       && fp->_IO_write_ptr == fp->_IO_write_base
+       && fp->_IO_save_base == NULL)
+@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+           return -1;
+         }
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+       fp->_flags &= ~_IO_EOF_SEEN;
+       fp->_offset = pos;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+diff --git a/lib/fseterr.c b/lib/fseterr.c
+index 82649c3ac1bf..adb637256dcf 100644
+--- a/lib/fseterr.c
++++ b/lib/fseterr.c
+@@ -29,7 +29,7 @@ fseterr (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_flags |= _IO_ERR_SEEN;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
+index 78d896e9f552..05c5752a2436 100644
+--- a/lib/stdio-impl.h
++++ b/lib/stdio-impl.h
+@@ -18,6 +18,12 @@
+    the same implementation of stdio extension API, except that some fields
+    have different naming conventions, or their access requires some casts.  */
+ 
++/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
++   problem by defining it ourselves.  FIXME: Do not rely on glibc
++   internals.  */
++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
++# define _IO_IN_BACKUP 0x100
++#endif
+ 
+ /* BSD stdio derived implementations.  */
+ 
diff --git a/patches/evocatio-argv-fuzz-amd64-only.patch b/patches/evocatio-argv-fuzz-amd64-only.patch
new file mode 100644
index 0000000..7956f84
--- /dev/null
+++ b/patches/evocatio-argv-fuzz-amd64-only.patch
@@ -0,0 +1,30 @@
+diff --git a/bug-severity-AFLplusplus/utils/argv_fuzzing/Makefile b/bug-severity-AFLplusplus/utils/argv_fuzzing/Makefile
+index 5a0ac6e609c0..20dcb5b9f57b 100644
+--- a/bug-severity-AFLplusplus/utils/argv_fuzzing/Makefile
++++ b/bug-severity-AFLplusplus/utils/argv_fuzzing/Makefile
+@@ -16,9 +16,10 @@
+ PREFIX     ?= /usr/local
+ BIN_PATH    = $(PREFIX)/bin
+ HELPER_PATH = $(PREFIX)/lib/afl
++INCLUDE_PATH = $(PREFIX)/include/afl
+ 
+-CFLAGS = -fPIC -Wall -Wextra
+-LDFLAGS = -shared
++CFLAGS += -fPIC -Wall -Wextra -D__x86_64__ -D__LP64__
++LDFLAGS += -shared
+ 
+ UNAME_SAYS_LINUX=$(shell uname | grep -E '^Linux|^GNU' >/dev/null; echo $$?)
+ UNAME_SAYS_LINUX:sh=uname | grep -E '^Linux|^GNU' >/dev/null; echo $$?
+@@ -47,9 +48,10 @@ argvfuzz32.so: argvfuzz.c
+ 	-@$(CC) $(M32FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "argvfuzz32 build failure (that's fine)"
+ 
+ argvfuzz64.so: argvfuzz.c
+-	-@$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "argvfuzz64 build failure (that's fine)"
++	$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@
+ 
+-install: argvfuzz32.so argvfuzz64.so
++install: argv-fuzz-inl.h argvfuzz32.so argvfuzz64.so
++	install -Dm 755 argv-fuzz-inl.h $(DESTDIR)$(INCLUDE_PATH)/argv-fuzz-inl.h
+ 	install -d -m 755 $(DESTDIR)$(HELPER_PATH)/
+ 	if [ -f argvfuzz32.so ]; then set -e; install -m 755 argvfuzz32.so $(DESTDIR)$(HELPER_PATH)/; fi
+ 	if [ -f argvfuzz64.so ]; then set -e; install -m 755 argvfuzz64.so $(DESTDIR)$(HELPER_PATH)/; fi
diff --git a/patches/jasper-no-define-int-types.patch b/patches/jasper-no-define-int-types.patch
new file mode 100644
index 0000000..d6a5b0a
--- /dev/null
+++ b/patches/jasper-no-define-int-types.patch
@@ -0,0 +1,19 @@
+--- a/src/libjasper/include/jasper/jas_config.h.in
++++ b/src/libjasper/include/jasper/jas_config.h.in
+@@ -152,6 +152,7 @@
+ #undef inline
+ #endif
+ 
++#if 0
+ /* Define to `long long' if <sys/types.h> does not define. */
+ #undef longlong
+ 
+@@ -175,7 +176,7 @@
+ 
+ /* Define to `unsigned short' if <sys/types.h> does not define. */
+ #undef ushort
+-
++#endif
+ 
+ #else
+ /* A configure-based build is not being used. */