From fc05535175df8f582b92ceb7aa3e1b3ffe3da604 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 4 Mar 2015 00:49:23 -0500 Subject: [PATCH] Updated all the patches to other projects to work with modern versions. --- patches/binutils.diff | 229 ++++++++++++++------------------ patches/gdb.diff | 105 ++++++--------- patches/glibc.diff | 62 ++++----- patches/linux-kernel.diff | 268 ++++++++++++++++++-------------------- 4 files changed, 289 insertions(+), 375 deletions(-) diff --git a/patches/binutils.diff b/patches/binutils.diff index b2361d3..ee67b8c 100644 --- a/patches/binutils.diff +++ b/patches/binutils.diff @@ -1,54 +1,45 @@ -diff -ru binutils-2.19.1-orig/bfd/bfd.c binutils-2.19.1/bfd/bfd.c ---- binutils-2.19.1-orig/bfd/bfd.c 2008-08-16 23:12:49.000000000 -0400 -+++ binutils-2.19.1/bfd/bfd.c 2009-10-02 01:01:48.000000000 -0400 -@@ -278,6 +278,10 @@ +diff -ruBb binutils-2.24.90.20141014-orig/bfd/bfd.c binutils-2.24.90.20141014/bfd/bfd.c +--- binutils-2.24.90.20141014-orig/bfd/bfd.c 2014-07-04 02:51:31.000000000 -0700 ++++ binutils-2.24.90.20141014/bfd/bfd.c 2015-02-27 21:20:16.069835438 -0800 +@@ -200,6 +200,10 @@ + . {* Set if this is the linker output BFD. *} + . unsigned int is_linker_output : 1; . - . {* Set if this is a thin archive. *} - . unsigned int is_thin_archive : 1; -+. +. {* Base offset, in bytes, of object inside a container file, such as FatELF, +. or a Mach-O Universal Binary. This will be zero for most things. *} +. ufile_ptr base_offset; - .}; - . - */ -diff -ru binutils-2.19.1-orig/bfd/bfd-in2.h binutils-2.19.1/bfd/bfd-in2.h ---- binutils-2.19.1-orig/bfd/bfd-in2.h 2008-08-20 19:28:57.000000000 -0400 -+++ binutils-2.19.1/bfd/bfd-in2.h 2009-10-02 01:01:48.000000000 -0400 -@@ -4823,6 +4823,10 @@ ++. + . {* Currently my_archive is tested before adding origin to + . anything. I believe that this can become always an add of + . origin, with origin set to 0 for non archive files. *} +diff -ruBb binutils-2.24.90.20141014-orig/bfd/bfd-in2.h binutils-2.24.90.20141014/bfd/bfd-in2.h +--- binutils-2.24.90.20141014-orig/bfd/bfd-in2.h 2014-09-17 18:36:55.000000000 -0700 ++++ binutils-2.24.90.20141014/bfd/bfd-in2.h 2015-02-27 21:18:57.193833087 -0800 +@@ -6430,6 +6430,10 @@ + /* Set if this is the linker output BFD. */ + unsigned int is_linker_output : 1; - /* Set if this is a thin archive. */ - unsigned int is_thin_archive : 1; -+ + /* Base offset, in bytes, of object inside a container file, such as FatELF, + or a Mach-O Universal Binary. This will be zero for most things. */ + ufile_ptr base_offset; - }; - - typedef enum bfd_error -diff -ru binutils-2.19.1-orig/bfd/bfdio.c binutils-2.19.1/bfd/bfdio.c ---- binutils-2.19.1-orig/bfd/bfdio.c 2008-02-20 12:42:35.000000000 -0500 -+++ binutils-2.19.1/bfd/bfdio.c 2009-10-02 01:01:48.000000000 -0400 -@@ -281,7 +281,7 @@ - bim = abfd->iostream; - - if (direction == SEEK_SET) -- abfd->where = position; -+ abfd->where = position + abfd->base_offset; - else - abfd->where += position; - -@@ -337,6 +337,9 @@ - } ++ + /* Currently my_archive is tested before adding origin to + anything. I believe that this can become always an add of + origin, with origin set to 0 for non archive files. */ +diff -ruBb binutils-2.24.90.20141014-orig/bfd/bfdio.c binutils-2.24.90.20141014/bfd/bfdio.c +--- binutils-2.24.90.20141014-orig/bfd/bfdio.c 2014-03-26 01:28:52.000000000 -0700 ++++ binutils-2.24.90.20141014/bfd/bfdio.c 2015-02-27 21:23:09.953840620 -0800 +@@ -311,6 +311,9 @@ file_position = position; -+ if (direction == SEEK_SET) + if (direction == SEEK_SET) + file_position += abfd->base_offset; + - if (direction == SEEK_SET && abfd->my_archive != NULL) - file_position += abfd->origin; ++ if (direction == SEEK_SET) + { + bfd *parent_bfd = abfd; -@@ -366,7 +369,7 @@ +@@ -347,7 +350,7 @@ { /* Adjust `where' field. */ if (direction == SEEK_SET) @@ -57,34 +48,23 @@ diff -ru binutils-2.19.1-orig/bfd/bfdio.c binutils-2.19.1/bfd/bfdio.c else abfd->where += position; } -diff -ru binutils-2.19.1-orig/bfd/elfcode.h binutils-2.19.1/bfd/elfcode.h ---- binutils-2.19.1-orig/bfd/elfcode.h 2009-10-02 15:47:18.000000000 -0400 -+++ binutils-2.19.1/bfd/elfcode.h 2009-10-02 15:16:51.000000000 -0400 -@@ -479,7 +479,6 @@ - target vectors, most of which will not match. We have to avoid leaving - any side effects in ABFD, or any data it points to (like tdata), if the - file does not match the target vector. */ -- - const bfd_target * - elf_object_p (bfd *abfd) - { -@@ -495,9 +494,14 @@ +diff -ruBb binutils-2.24.90.20141014-orig/bfd/elfcode.h binutils-2.24.90.20141014/bfd/elfcode.h +--- binutils-2.24.90.20141014-orig/bfd/elfcode.h 2014-09-18 10:24:41.000000000 -0700 ++++ binutils-2.24.90.20141014/bfd/elfcode.h 2015-02-27 21:24:25.753842879 -0800 +@@ -497,6 +496,12 @@ + asection *s; bfd_size_type amt; const bfd_target *target; - const bfd_target * const *target_ptr; -- + const FatElf_External_Hdr *x_fathdr = (FatElf_External_Hdr *) &x_ehdr; + bfd_vma base_offset = 0; - preserve.marker = NULL; - ++ + ebd = get_elf_backend_data (abfd); + if (ebd->s->arch_size != ARCH_SIZE) + goto got_wrong_format_error; -+ + /* Read in the ELF header in external format. */ - if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) -@@ -508,6 +512,102 @@ +@@ -508,6 +513,102 @@ goto got_no_match; } @@ -187,7 +167,7 @@ diff -ru binutils-2.19.1-orig/bfd/elfcode.h binutils-2.19.1/bfd/elfcode.h /* Now check to see if we have a valid ELF file, and one that BFD can make use of. The magic number must match, the address size ('class') and byte-swapping must match our XVEC entry, and it must have a -@@ -573,10 +673,6 @@ +@@ -569,10 +670,6 @@ if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0) goto got_wrong_format_error; @@ -198,10 +178,10 @@ diff -ru binutils-2.19.1-orig/bfd/elfcode.h binutils-2.19.1/bfd/elfcode.h /* Check that the ELF e_machine field matches what this particular BFD format expects. */ if (ebd->elf_machine_code != i_ehdrp->e_machine -diff -ru binutils-2.19.1-orig/binutils/readelf.c binutils-2.19.1/binutils/readelf.c ---- binutils-2.19.1-orig/binutils/readelf.c 2008-09-17 05:00:44.000000000 -0400 -+++ binutils-2.19.1/binutils/readelf.c 2009-10-02 01:01:49.000000000 -0400 -@@ -10957,6 +10957,98 @@ +diff -ruBb binutils-2.24.90.20141014-orig/binutils/readelf.c binutils-2.24.90.20141014/binutils/readelf.c +--- binutils-2.24.90.20141014-orig/binutils/readelf.c 2014-10-14 02:28:42.000000000 -0700 ++++ binutils-2.24.90.20141014/binutils/readelf.c 2015-02-27 21:38:05.901867322 -0800 +@@ -14839,6 +14839,98 @@ } static int @@ -297,10 +277,10 @@ diff -ru binutils-2.19.1-orig/binutils/readelf.c binutils-2.19.1/binutils/readel +} + +static int - process_file (char *file_name) + process_file (char * file_name) { - FILE *file; -@@ -10994,7 +11086,12 @@ + FILE * file; +@@ -14876,7 +14968,12 @@ return 1; } @@ -311,12 +291,12 @@ diff -ru binutils-2.19.1-orig/binutils/readelf.c binutils-2.19.1/binutils/readel + ret = process_fatelf (file_name, file); + } + else if (memcmp (armag, ARMAG, SARMAG) == 0) - ret = process_archive (file_name, file); - else - { -diff -ru binutils-2.19.1-orig/elfcpp/elfcpp.h binutils-2.19.1/elfcpp/elfcpp.h ---- binutils-2.19.1-orig/elfcpp/elfcpp.h 2008-06-12 12:58:40.000000000 -0400 -+++ binutils-2.19.1/elfcpp/elfcpp.h 2009-10-02 01:01:49.000000000 -0400 + ret = process_archive (file_name, file, FALSE); + else if (memcmp (armag, ARMAGT, SARMAG) == 0) + ret = process_archive (file_name, file, TRUE); +diff -ruBb binutils-2.24.90.20141014-orig/elfcpp/elfcpp.h binutils-2.24.90.20141014/elfcpp/elfcpp.h +--- binutils-2.24.90.20141014-orig/elfcpp/elfcpp.h 2014-07-31 04:27:10.000000000 -0700 ++++ binutils-2.24.90.20141014/elfcpp/elfcpp.h 2015-02-27 21:17:46.449830979 -0800 @@ -75,6 +75,40 @@ typedef int64_t Elf_Swxword; }; @@ -358,12 +338,38 @@ diff -ru binutils-2.19.1-orig/elfcpp/elfcpp.h binutils-2.19.1/elfcpp/elfcpp.h // Offsets within the Ehdr e_ident field. const int EI_MAG0 = 0; -diff -ru binutils-2.19.1-orig/gold/object.cc binutils-2.19.1/gold/object.cc ---- binutils-2.19.1-orig/gold/object.cc 2008-07-22 18:08:43.000000000 -0400 -+++ binutils-2.19.1/gold/object.cc 2009-10-02 01:01:49.000000000 -0400 -@@ -1824,6 +1824,98 @@ - namespace gold - { +diff -ruBb binutils-2.24.90.20141014-orig/gold/object.cc binutils-2.24.90.20141014/gold/object.cc +--- binutils-2.24.90.20141014-orig/gold/object.cc 2014-09-30 15:26:28.000000000 -0700 ++++ binutils-2.24.90.20141014/gold/object.cc 2015-02-27 21:45:55.013881304 -0800 +@@ -3099,12 +3099,124 @@ + + const unsigned char* p = input_file->file().get_view(offset, 0, want, + true, false); ++ ++ static const unsigned char fatelfmagic[4] = ++ { ++ elfcpp::FATELFMAG0, elfcpp::FATELFMAG1, ++ elfcpp::FATELFMAG2, elfcpp::FATELFMAG3 ++ }; ++ ++ if ((want > 4) && (memcmp(p, fatelfmagic, 4) == 0)) ++ { ++ // This is a FatELF file. Seek to correct ELF object now. ++ off_t base_offset = parse_fatelf_records(input_file->filename(), ++ input_file, p, want); ++ if (base_offset < 0) ++ return false; ++ ++ // read the actual ELF header. ++ p = input_file->file().get_view(base_offset + offset, 0, want, ++ true, false); ++ } ++ + *start = p; + *read_size = want; + + return elfcpp::Elf_recognizer::is_elf_file(p, want); + } +static inline uint16_t fatelf_convert16(const unsigned char *buf) +{ @@ -460,12 +466,12 @@ diff -ru binutils-2.19.1-orig/gold/object.cc binutils-2.19.1/gold/object.cc // Read an ELF file and return the appropriate instance of Object. Object* -diff -ru binutils-2.19.1-orig/gold/object.h binutils-2.19.1/gold/object.h ---- binutils-2.19.1-orig/gold/object.h 2008-07-25 00:25:49.000000000 -0400 -+++ binutils-2.19.1/gold/object.h 2009-10-02 01:01:49.000000000 -0400 -@@ -1808,6 +1808,15 @@ - location(size_t relnum, off_t reloffset) const; - }; +diff -ruBb binutils-2.24.90.20141014-orig/gold/object.h binutils-2.24.90.20141014/gold/object.h +--- binutils-2.24.90.20141014-orig/gold/object.h 2014-09-03 13:39:34.000000000 -0700 ++++ binutils-2.24.90.20141014/gold/object.h 2015-02-27 21:17:46.453830979 -0800 +@@ -2906,6 +2906,15 @@ + is_elf_object(Input_file* input_file, off_t offset, + const unsigned char** start, int* read_size); +// Parse a FatELF header, and return the base offset of the desired system's +// ELF binary. Returns -1 on error, or if there isn't a compatible ELF object @@ -477,57 +483,12 @@ diff -ru binutils-2.19.1-orig/gold/object.h binutils-2.19.1/gold/object.h + const unsigned char* p, section_offset_type bytes); + // Return an Object appropriate for the input file. P is BYTES long, - // and holds the ELF header. - -diff -ru binutils-2.19.1-orig/gold/readsyms.cc binutils-2.19.1/gold/readsyms.cc ---- binutils-2.19.1-orig/gold/readsyms.cc 2008-08-07 13:02:11.000000000 -0400 -+++ binutils-2.19.1/gold/readsyms.cc 2009-10-02 01:01:49.000000000 -0400 -@@ -161,17 +161,40 @@ - - if (read_size >= 4) - { -+ off_t base_offset = 0; -+ -+ static unsigned char fatelfmagic[4] = -+ { -+ elfcpp::FATELFMAG0, elfcpp::FATELFMAG1, -+ elfcpp::FATELFMAG2, elfcpp::FATELFMAG3 -+ }; -+ -+ if (memcmp(ehdr, fatelfmagic, 4) == 0) -+ { -+ // This is a FatELF file. Seek to correct ELF object now. -+ base_offset = parse_fatelf_records(input_file->filename(), -+ input_file, ehdr, read_size); -+ if (base_offset < 0) -+ return false; -+ -+ // read the actual ELF header. -+ ehdr = input_file->file().get_view(base_offset, 0, read_size, -+ true, false); -+ } -+ - static unsigned char elfmagic[4] = - { - elfcpp::ELFMAG0, elfcpp::ELFMAG1, - elfcpp::ELFMAG2, elfcpp::ELFMAG3 - }; -+ - if (memcmp(ehdr, elfmagic, 4) == 0) - { - // This is an ELF object. - - Object* obj = make_elf_object(input_file->filename(), -- input_file, 0, ehdr, read_size); -+ input_file, base_offset, ehdr, -+ read_size); - if (obj == NULL) - return false; - -diff -ru binutils-2.19.1-orig/include/elf/external.h binutils-2.19.1/include/elf/external.h ---- binutils-2.19.1-orig/include/elf/external.h 2008-03-12 04:36:58.000000000 -0400 -+++ binutils-2.19.1/include/elf/external.h 2009-10-02 01:01:49.000000000 -0400 -@@ -285,4 +285,35 @@ + // and holds the ELF header. If PUNCONFIGURED is not NULL, then if + // this sees an object the linker is not configured to support, it +diff -ruBb binutils-2.24.90.20141014-orig/include/elf/external.h binutils-2.24.90.20141014/include/elf/external.h +--- binutils-2.24.90.20141014-orig/include/elf/external.h 2014-03-26 01:28:53.000000000 -0700 ++++ binutils-2.24.90.20141014/include/elf/external.h 2015-02-27 21:17:46.453830979 -0800 +@@ -284,4 +284,35 @@ #define GRP_ENTRY_SIZE 4 diff --git a/patches/gdb.diff b/patches/gdb.diff index e4842fd..8abe8de 100644 --- a/patches/gdb.diff +++ b/patches/gdb.diff @@ -1,54 +1,43 @@ -diff -ru gdb-6.8-orig/bfd/bfd.c gdb-6.8/bfd/bfd.c ---- gdb-6.8-orig/bfd/bfd.c 2008-01-25 11:18:40.000000000 -0500 -+++ gdb-6.8/bfd/bfd.c 2009-10-02 16:25:17.000000000 -0400 -@@ -199,6 +199,10 @@ - . struct objalloc *, but we use void * to avoid requiring the inclusion - . of objalloc.h. *} - . void *memory; +diff -ruBb gdb-7.8-orig/bfd/bfd.c gdb-7.8/bfd/bfd.c +--- gdb-7.8-orig/bfd/bfd.c 2014-07-29 05:37:42.000000000 -0700 ++++ gdb-7.8/bfd/bfd.c 2015-02-27 23:33:08.210073035 -0800 +@@ -309,6 +309,10 @@ + . {* Set if only required symbols should be added in the link hash table for + . this object. Used by VMS linkers. *} + . unsigned int selective_search : 1; +. +. {* Base offset, in bytes, of object inside a container file, such as FatELF, +. or a Mach-O Universal Binary. This will be zero for most things. *} +. ufile_ptr base_offset; .}; . - */ -diff -ru gdb-6.8-orig/bfd/bfd-in2.h gdb-6.8/bfd/bfd-in2.h ---- gdb-6.8-orig/bfd/bfd-in2.h 2008-02-20 10:17:56.000000000 -0500 -+++ gdb-6.8/bfd/bfd-in2.h 2009-10-02 16:25:17.000000000 -0400 -@@ -4772,6 +4772,10 @@ - struct objalloc *, but we use void * to avoid requiring the inclusion - of objalloc.h. */ - void *memory; + .{* See note beside bfd_set_section_userdata. *} +diff -ruBb gdb-7.8-orig/bfd/bfd-in2.h gdb-7.8/bfd/bfd-in2.h +--- gdb-7.8-orig/bfd/bfd-in2.h 2014-07-29 05:37:42.000000000 -0700 ++++ gdb-7.8/bfd/bfd-in2.h 2015-02-27 23:33:56.670074479 -0800 +@@ -6484,6 +6484,10 @@ + /* Set if only required symbols should be added in the link hash table for + this object. Used by VMS linkers. */ + unsigned int selective_search : 1; + + /* Base offset, in bytes, of object inside a container file, such as FatELF, + or a Mach-O Universal Binary. This will be zero for most things. */ + ufile_ptr base_offset; }; - typedef enum bfd_error -diff -ru gdb-6.8-orig/bfd/bfdio.c gdb-6.8/bfd/bfdio.c ---- gdb-6.8-orig/bfd/bfdio.c 2008-02-20 12:42:35.000000000 -0500 -+++ gdb-6.8/bfd/bfdio.c 2009-10-02 16:25:17.000000000 -0400 -@@ -281,7 +281,7 @@ - bim = abfd->iostream; - - if (direction == SEEK_SET) -- abfd->where = position; -+ abfd->where = position + abfd->base_offset; - else - abfd->where += position; - -@@ -337,6 +337,9 @@ - } - - file_position = position; -+ if (direction == SEEK_SET) -+ file_position += abfd->base_offset; -+ - if (direction == SEEK_SET && abfd->my_archive != NULL) - file_position += abfd->origin; + /* See note beside bfd_set_section_userdata. */ +diff -ruBb gdb-7.8-orig/bfd/bfdio.c gdb-7.8/bfd/bfdio.c +--- gdb-7.8-orig/bfd/bfdio.c 2014-06-11 09:34:40.000000000 -0700 ++++ gdb-7.8/bfd/bfdio.c 2015-02-27 23:35:20.190076968 -0800 +@@ -314,6 +314,7 @@ + { + bfd *parent_bfd = abfd; -@@ -366,7 +369,7 @@ ++ file_position += abfd->base_offset; + while (parent_bfd->my_archive != NULL) + { + file_position += parent_bfd->origin; +@@ -347,7 +348,7 @@ { /* Adjust `where' field. */ if (direction == SEEK_SET) @@ -57,34 +46,23 @@ diff -ru gdb-6.8-orig/bfd/bfdio.c gdb-6.8/bfd/bfdio.c else abfd->where += position; } -diff -ru gdb-6.8-orig/bfd/elfcode.h gdb-6.8/bfd/elfcode.h ---- gdb-6.8-orig/bfd/elfcode.h 2007-12-24 11:55:39.000000000 -0500 -+++ gdb-6.8/bfd/elfcode.h 2009-10-02 16:27:05.000000000 -0400 -@@ -496,7 +496,6 @@ - target vectors, most of which will not match. We have to avoid leaving - any side effects in ABFD, or any data it points to (like tdata), if the - file does not match the target vector. */ -- - const bfd_target * - elf_object_p (bfd *abfd) - { -@@ -512,9 +511,14 @@ +diff -ruBb gdb-7.8-orig/bfd/elfcode.h gdb-7.8/bfd/elfcode.h +--- gdb-7.8-orig/bfd/elfcode.h 2015-02-27 23:31:58.000000000 -0800 ++++ gdb-7.8/bfd/elfcode.h 2015-02-27 23:37:34.262080964 -0800 +@@ -497,6 +496,12 @@ + asection *s; bfd_size_type amt; const bfd_target *target; - const bfd_target * const *target_ptr; -- + const FatElf_External_Hdr *x_fathdr = (FatElf_External_Hdr *) &x_ehdr; + bfd_vma base_offset = 0; - preserve.marker = NULL; - ++ + ebd = get_elf_backend_data (abfd); + if (ebd->s->arch_size != ARCH_SIZE) + goto got_wrong_format_error; -+ + /* Read in the ELF header in external format. */ - if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) -@@ -525,6 +529,102 @@ +@@ -508,6 +513,102 @@ goto got_no_match; } @@ -187,19 +165,21 @@ diff -ru gdb-6.8-orig/bfd/elfcode.h gdb-6.8/bfd/elfcode.h /* Now check to see if we have a valid ELF file, and one that BFD can make use of. The magic number must match, the address size ('class') and byte-swapping must match our XVEC entry, and it must have a -@@ -590,8 +690,6 @@ +@@ -569,10 +670,6 @@ if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0) goto got_wrong_format_error; - ebd = get_elf_backend_data (abfd); +- if (ebd->s->arch_size != ARCH_SIZE) +- goto got_wrong_format_error; - /* Check that the ELF e_machine field matches what this particular BFD format expects. */ if (ebd->elf_machine_code != i_ehdrp->e_machine -diff -ru gdb-6.8-orig/include/elf/external.h gdb-6.8/include/elf/external.h ---- gdb-6.8-orig/include/elf/external.h 2006-12-06 09:36:41.000000000 -0500 -+++ gdb-6.8/include/elf/external.h 2009-10-02 16:25:17.000000000 -0400 -@@ -272,4 +272,35 @@ +diff -ruBb gdb-7.8-orig/include/elf/external.h gdb-7.8/include/elf/external.h +--- gdb-7.8-orig/include/elf/external.h 2014-06-11 09:34:41.000000000 -0700 ++++ gdb-7.8/include/elf/external.h 2015-02-27 23:32:33.726072007 -0800 +@@ -284,4 +284,35 @@ #define GRP_ENTRY_SIZE 4 @@ -235,3 +215,4 @@ diff -ru gdb-6.8-orig/include/elf/external.h gdb-6.8/include/elf/external.h + + #endif /* _ELF_EXTERNAL_H */ + diff --git a/patches/glibc.diff b/patches/glibc.diff index 68b9bef..3d929b8 100644 --- a/patches/glibc.diff +++ b/patches/glibc.diff @@ -1,8 +1,7 @@ -diff --git a/elf/dl-load.c b/elf/dl-load.c -index 0b896d9..4a44c41 100644 ---- a/elf/dl-load.c -+++ b/elf/dl-load.c -@@ -27,6 +27,7 @@ +diff -ruBb glibc-2.19-orig/elf/dl-load.c glibc-2.19/elf/dl-load.c +--- glibc-2.19-orig/elf/dl-load.c 2015-02-28 06:52:37.000000000 -0800 ++++ glibc-2.19/elf/dl-load.c 2015-02-28 06:51:36.442857109 -0800 +@@ -26,6 +26,7 @@ #include #include #include @@ -10,7 +9,7 @@ index 0b896d9..4a44c41 100644 #include #include #include -@@ -131,6 +132,7 @@ struct filebuf +@@ -131,6 +132,7 @@ # define FILEBUF_SIZE 832 #endif char buf[FILEBUF_SIZE] __attribute__ ((aligned (__alignof (ElfW(Ehdr))))); @@ -18,7 +17,7 @@ index 0b896d9..4a44c41 100644 }; /* This is the decomposed LD_LIBRARY_PATH search path. */ -@@ -985,7 +987,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, +@@ -1078,7 +1080,7 @@ else { phdr = alloca (maplength); @@ -27,7 +26,7 @@ index 0b896d9..4a44c41 100644 if ((size_t) __libc_read (fd, (void *) phdr, maplength) != maplength) { errstring = N_("cannot read file data"); -@@ -1196,7 +1198,7 @@ cannot allocate TLS data structures for initial thread"); +@@ -1293,7 +1295,7 @@ l->l_map_start = (ElfW(Addr)) __mmap ((void *) mappref, maplength, c->prot, MAP_COPY|MAP_FILE, @@ -36,7 +35,7 @@ index 0b896d9..4a44c41 100644 if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0)) { map_error: -@@ -1247,7 +1249,7 @@ cannot allocate TLS data structures for initial thread"); +@@ -1344,7 +1346,7 @@ && (__mmap ((void *) (l->l_addr + c->mapstart), c->mapend - c->mapstart, c->prot, MAP_FIXED|MAP_COPY|MAP_FILE, @@ -45,16 +44,16 @@ index 0b896d9..4a44c41 100644 == MAP_FAILED)) goto map_error; -@@ -1551,6 +1553,85 @@ print_search_path (struct r_search_path_elem **list, - _dl_debug_printf_c ("\t\t(%s)\n", what); +@@ -1862,6 +1864,85 @@ } + +#define ELF32_CLASS ELFCLASS32 +#define ELF64_CLASS ELFCLASS64 +#ifndef VALID_ELF_HEADER +# define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0) +# define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV) -+# define VALID_ELF_ABIVERSION(ver) (ver == 0) ++# define VALID_ELF_ABIVERSION(osabi,ver) (ver == 0) +#endif +#if BYTE_ORDER == BIG_ENDIAN +#define le16_to_cpu(x) __bswap_16(x) @@ -110,7 +109,7 @@ index 0b896d9..4a44c41 100644 + /* if we fail a test here, we just jump to the next record. */ + if (!VALID_ELF_OSABI(record->osabi)) + continue; -+ else if (!VALID_ELF_ABIVERSION(record->osabi_version)) ++ else if (!VALID_ELF_ABIVERSION(record->osabi, record->osabi_version)) + continue; + else if (!elf_machine_matches_host(&ehdr)) + continue; @@ -131,34 +130,18 @@ index 0b896d9..4a44c41 100644 /* Open a file and verify it is an ELF file for this architecture. We ignore only ELF files for other architectures. Non-ELF files and ELF files with different header information cause fatal errors since -@@ -1561,13 +1642,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, - int whatcode, bool *found_other_class, bool free_name) - { - /* This is the expected ELF header. */ --#define ELF32_CLASS ELFCLASS32 --#define ELF64_CLASS ELFCLASS64 --#ifndef VALID_ELF_HEADER --# define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0) --# define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV) --# define VALID_ELF_ABIVERSION(ver) (ver == 0) --#elif defined MORE_ELF_HEADER_DATA -+#if defined MORE_ELF_HEADER_DATA - MORE_ELF_HEADER_DATA; - #endif - static const unsigned char expected[EI_PAD] = -@@ -1632,6 +1707,11 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, +@@ -1952,6 +2033,10 @@ + } + while (__builtin_expect (fbp->len < sizeof (ElfW(Ehdr)), 0)); - /* This is where the ELF header is loaded. */ - assert (sizeof (fbp->buf) > sizeof (ElfW(Ehdr))); -+ + errstring = examine_fatelf(fd, fbp); + if (errstring) + goto call_lose; + + /* This is where the ELF header is loaded. */ ehdr = (ElfW(Ehdr) *) fbp->buf; - /* Now run the tests. */ -@@ -1727,7 +1807,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, +@@ -2073,7 +2158,7 @@ else { phdr = alloca (maplength); @@ -167,7 +150,7 @@ index 0b896d9..4a44c41 100644 if ((size_t) __libc_read (fd, (void *) phdr, maplength) != maplength) { read_error: -@@ -1748,7 +1828,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, +@@ -2095,7 +2180,7 @@ else { abi_note = alloca (size); @@ -176,11 +159,10 @@ index 0b896d9..4a44c41 100644 if (__libc_read (fd, (void *) abi_note, size) != size) goto read_error; } -diff --git a/elf/elf.h b/elf/elf.h -index ce6de07..d4216b0 100644 ---- a/elf/elf.h -+++ b/elf/elf.h -@@ -61,6 +61,34 @@ typedef uint16_t Elf64_Section; +diff -ruBb glibc-2.19-orig/elf/elf.h glibc-2.19/elf/elf.h +--- glibc-2.19-orig/elf/elf.h 2015-02-28 06:52:37.000000000 -0800 ++++ glibc-2.19/elf/elf.h 2015-02-28 06:49:49.410853919 -0800 +@@ -59,6 +59,34 @@ typedef Elf32_Half Elf32_Versym; typedef Elf64_Half Elf64_Versym; diff --git a/patches/linux-kernel.diff b/patches/linux-kernel.diff index 32eb1c2..9a20a15 100644 --- a/patches/linux-kernel.diff +++ b/patches/linux-kernel.diff @@ -1,54 +1,30 @@ - -Please note that this patch applies cleanly to Ubuntu 9.04's Linux kernel - sources (2.6.28-15-generic, specifically). - +Please note that this patch applies cleanly to Ubuntu 14.10's Linux kernel + sources (3.16, specifically). + Patches being submitted for consideration on the Linux kernel mailing list - are not kept here, and are made against the current mainline (2.6.31-rc5 - at the time of this writing). If you want those, get them from the mailing + are not kept here, and are made against the current mainline (3.19 at the + time of this writing). If you want those, get them from the mailing list. You probably don't want the below patch unless you're experimenting with a stable (and older) kernel. - - -diff -ru linux-2.6.28-orig/arch/ia64/ia32/binfmt_elf32.c linux-2.6.28/arch/ia64/ia32/binfmt_elf32.c ---- linux-2.6.28-orig/arch/ia64/ia32/binfmt_elf32.c 2008-12-24 18:26:37.000000000 -0500 -+++ linux-2.6.28/arch/ia64/ia32/binfmt_elf32.c 2009-10-02 00:10:12.000000000 -0400 -@@ -223,12 +223,12 @@ - - static unsigned long - elf32_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt, -- int prot, int type, unsigned long unused) -+ int prot, int type, unsigned long unused, unsigned long base) - { - unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK; +diff -ruBb linux-3.16.0-orig/fs/binfmt_elf.c linux-3.16.0/fs/binfmt_elf.c +--- linux-3.16.0-orig/fs/binfmt_elf.c 2014-08-03 15:25:02.000000000 -0700 ++++ linux-3.16.0/fs/binfmt_elf.c 2015-03-01 20:04:12.561648371 -0800 +@@ -47,7 +47,7 @@ - return ia32_do_mmap(filep, (addr & IA32_PAGE_MASK), eppnt->p_filesz + pgoff, prot, type, -- eppnt->p_offset - pgoff); -+ (eppnt->p_offset + base) - pgoff); - } - - #define cpu_uses_ia32el() (local_cpu_data->family > 0x1f) -diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c ---- linux-2.6.28-orig/fs/binfmt_elf.c 2009-10-03 02:11:23.000000000 -0400 -+++ linux-2.6.28/fs/binfmt_elf.c 2009-10-02 18:42:52.000000000 -0400 -@@ -44,8 +44,9 @@ - - static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs); - static int load_elf_library(struct file *); --static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, + static int load_elf_binary(struct linux_binprm *bprm); + static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, - int, int, unsigned long); -+static unsigned long -+elf_map(struct file *, unsigned long, struct elf_phdr *, + int, int, unsigned long, unsigned long); - /* - * If we don't support core dumping, then supply a NULL so we -@@ -314,7 +315,7 @@ + #ifdef CONFIG_USELIB + static int load_elf_library(struct file *); +@@ -334,7 +334,7 @@ static unsigned long elf_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type, @@ -57,25 +33,22 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c { unsigned long map_addr; unsigned long size = eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr); -@@ -338,11 +339,14 @@ +@@ -357,11 +357,12 @@ */ if (total_size) { total_size = ELF_PAGEALIGN(total_size); -- map_addr = do_mmap(filep, addr, total_size, prot, type, off); -+ map_addr = do_mmap(filep, addr, total_size, prot, type, +- map_addr = vm_mmap(filep, addr, total_size, prot, type, off); ++ map_addr = vm_mmap(filep, addr, total_size, prot, type, + off + base_offset); if (!BAD_ADDR(map_addr)) - do_munmap(current->mm, map_addr+size, total_size-size); -- } else -- map_addr = do_mmap(filep, addr, size, prot, type, off); -+ } else { -+ map_addr = do_mmap(filep, addr, size, prot, type, -+ off + base_offset); -+ } + vm_munmap(map_addr+size, total_size-size); + } else +- map_addr = vm_mmap(filep, addr, size, prot, type, off); ++ map_addr = vm_mmap(filep, addr, size, prot, type, off + base_offset); - up_write(¤t->mm->mmap_sem); return(map_addr); -@@ -376,7 +380,7 @@ + } +@@ -394,7 +395,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, struct file *interpreter, unsigned long *interp_map_addr, @@ -84,16 +57,16 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c { struct elf_phdr *elf_phdata; struct elf_phdr *eppnt; -@@ -414,7 +418,7 @@ +@@ -432,7 +433,7 @@ if (!elf_phdata) goto out; - retval = kernel_read(interpreter, interp_elf_ex->e_phoff, + retval = kernel_read(interpreter, interp_elf_ex->e_phoff + base_offset, - (char *)elf_phdata,size); + (char *)elf_phdata, size); error = -EIO; if (retval != size) { -@@ -450,7 +454,8 @@ +@@ -468,7 +469,8 @@ load_addr = -vaddr; map_addr = elf_map(interpreter, load_addr + vaddr, @@ -103,7 +76,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c total_size = 0; if (!*interp_map_addr) *interp_map_addr = map_addr; -@@ -555,6 +560,94 @@ +@@ -568,6 +570,94 @@ #endif } @@ -195,11 +168,11 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c +} + + - static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) + static int load_elf_binary(struct linux_binprm *bprm) { struct file *interpreter = NULL; /* to shut gcc up */ -@@ -567,6 +660,8 @@ - int elf_exec_fileno; +@@ -579,6 +669,8 @@ + unsigned long elf_bss, elf_brk; int retval, i; unsigned int size; + unsigned long base_offset = 0; @@ -207,14 +180,12 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c unsigned long elf_entry; unsigned long interp_load_addr = 0; unsigned long start_code, end_code, start_data, end_data; -@@ -583,9 +678,12 @@ - retval = -ENOMEM; +@@ -596,8 +688,11 @@ goto out_ret; } -- + - /* Get the exec-header */ - loc->elf_ex = *((struct elfhdr *)bprm->buf); -+ + retval = examine_fatelf(bprm->file, bprm->filename, bprm->buf, + BINPRM_BUF_SIZE, &base_offset, &loc->elf_ex); + if (unlikely(retval < 0)) { @@ -223,7 +194,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c retval = -ENOEXEC; /* First of all, some simple consistency checks */ -@@ -611,7 +709,7 @@ +@@ -623,7 +718,7 @@ if (!elf_phdata) goto out; @@ -232,9 +203,9 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c (char *)elf_phdata, size); if (retval != size) { if (retval >= 0) -@@ -651,7 +749,8 @@ +@@ -657,7 +752,8 @@ if (!elf_interpreter) - goto out_free_file; + goto out_free_ph; - retval = kernel_read(bprm->file, elf_ppnt->p_offset, + retval = kernel_read(bprm->file, @@ -242,7 +213,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c elf_interpreter, elf_ppnt->p_filesz); if (retval != elf_ppnt->p_filesz) { -@@ -706,8 +805,13 @@ +@@ -690,8 +786,13 @@ goto out_free_dentry; } @@ -258,7 +229,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c break; } elf_ppnt++; -@@ -832,7 +936,7 @@ +@@ -818,7 +919,7 @@ } error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, @@ -267,7 +238,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c if (BAD_ADDR(error)) { send_sig(SIGKILL, current, 0); retval = IS_ERR((void *)error) ? -@@ -913,7 +1017,7 @@ +@@ -899,7 +1000,7 @@ elf_entry = load_elf_interp(&loc->interp_elf_ex, interpreter, &interp_map_addr, @@ -276,7 +247,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c if (!IS_ERR((void *)elf_entry)) { /* * load_elf_interp() returns relocation -@@ -1032,11 +1136,19 @@ +@@ -1016,11 +1117,19 @@ unsigned long elf_bss, bss, len; int retval, error, i, j; struct elfhdr elf_ex; @@ -299,7 +270,7 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0) goto out; -@@ -1058,7 +1170,8 @@ +@@ -1042,7 +1151,8 @@ eppnt = elf_phdata; error = -ENOEXEC; @@ -309,21 +280,21 @@ diff -ru linux-2.6.28-orig/fs/binfmt_elf.c linux-2.6.28/fs/binfmt_elf.c if (retval != j) goto out_free_ph; -@@ -1080,7 +1193,7 @@ +@@ -1063,7 +1173,7 @@ PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, (eppnt->p_offset - - ELF_PAGEOFFSET(eppnt->p_vaddr))); + ELF_PAGEOFFSET(eppnt->p_vaddr)) + base_offset); - up_write(¤t->mm->mmap_sem); if (error != ELF_PAGESTART(eppnt->p_vaddr)) goto out_free_ph; -diff -ru linux-2.6.28-orig/include/linux/elf.h linux-2.6.28/include/linux/elf.h ---- linux-2.6.28-orig/include/linux/elf.h 2008-12-24 18:26:37.000000000 -0500 -+++ linux-2.6.28/include/linux/elf.h 2009-10-02 00:10:12.000000000 -0400 -@@ -188,6 +188,30 @@ - } Elf64_Sym; +diff -ruBb linux-3.16.0-orig/include/uapi/linux/elf.h linux-3.16.0/include/uapi/linux/elf.h +--- linux-3.16.0-orig/include/uapi/linux/elf.h 2014-08-03 15:25:02.000000000 -0700 ++++ linux-3.16.0/include/uapi/linux/elf.h 2015-03-01 20:02:48.341645861 -0800 +@@ -414,4 +414,27 @@ + Elf64_Word n_type; /* Content type */ + } Elf64_Nhdr; +/* FatELF (multiple ELF binaries in one file) support */ +#define FATELF_MAGIC (0x1F0E70FA) @@ -348,15 +319,22 @@ diff -ru linux-2.6.28-orig/include/linux/elf.h linux-2.6.28/include/linux/elf.h + fatelf_record records[]; +} fatelf_hdr; + -+ - #define EI_NIDENT 16 + #endif /* _UAPI_LINUX_ELF_H */ +diff -ruBb linux-3.16.0-orig/kernel/module.c linux-3.16.0/kernel/module.c +--- linux-3.16.0-orig/kernel/module.c 2015-03-01 19:57:06.000000000 -0800 ++++ linux-3.16.0/kernel/module.c 2015-03-01 20:02:48.341645861 -0800 +@@ -172,7 +172,8 @@ + EXPORT_SYMBOL(unregister_module_notifier); - typedef struct elf32_hdr{ -diff -ru linux-2.6.28-orig/kernel/module.c linux-2.6.28/kernel/module.c ---- linux-2.6.28-orig/kernel/module.c 2009-10-03 02:11:23.000000000 -0400 -+++ linux-2.6.28/kernel/module.c 2009-10-03 02:08:53.000000000 -0400 -@@ -1833,13 +1833,69 @@ - return ret; + struct load_info { +- Elf_Ehdr *hdr; ++ Elf_Ehdr *hdr_alloc; /* returned from vmalloc */ ++ Elf_Ehdr *hdr; /* adjusted hdr_alloc for FatELF */ + unsigned long len; + Elf_Shdr *sechdrs; + char *secstrings, *strtab; +@@ -2485,6 +2486,61 @@ + return 0; } +/* @@ -414,68 +392,80 @@ diff -ru linux-2.6.28-orig/kernel/module.c linux-2.6.28/kernel/module.c + return NULL; /* no binaries we could use. */ +} + - /* Allocate and load the module: note that size of section 0 is always - zero, and we rely on this for optional sections. */ - static noinline struct module *load_module(void __user *umod, - unsigned long len, - const char __user *uargs) - { -- Elf_Ehdr *hdr; -+ Elf_Ehdr *hdr_alloc; /* returned from vmalloc */ -+ Elf_Ehdr *hdr; /* adjusted hdr_alloc for FatELF */ - Elf_Shdr *sechdrs; - char *secstrings, *args, *modmagic, *strtab = NULL; - char *staging; -@@ -1863,13 +1919,19 @@ + /* Sets info->hdr and info->len. */ + static int copy_module_from_user(const void __user *umod, unsigned long len, + struct load_info *info) +@@ -2500,15 +2556,22 @@ + return err; /* Suck in entire file: we'll want most of it. */ - /* vmalloc barfs on "unusual" numbers. Check here */ -- if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL) -+ if (len > 64 * 1024 * 1024 || (hdr_alloc = vmalloc(len)) == NULL) - return ERR_PTR(-ENOMEM); -- if (copy_from_user(hdr, umod, len) != 0) { -+ if (copy_from_user(hdr_alloc, umod, len) != 0) { - err = -EFAULT; - goto free_hdr; +- info->hdr = vmalloc(info->len); +- if (!info->hdr) ++ info->hdr_alloc = vmalloc(info->len); ++ if (!info->hdr_alloc) + return -ENOMEM; + +- if (copy_from_user(info->hdr, umod, info->len) != 0) { +- vfree(info->hdr); ++ if (copy_from_user(info->hdr_alloc, umod, info->len) != 0) { ++ vfree(info->hdr_alloc); + return -EFAULT; } -+ hdr = examine_fatelf_module((unsigned char *) hdr_alloc, len); -+ if (hdr == NULL) { -+ err = -ENOEXEC; -+ goto free_hdr; ++ /* returns the actual ELF header (whether or not this was FatELF). */ ++ info->hdr = examine_fatelf_module((unsigned char *) info->hdr_alloc, info->len); ++ if (info->hdr == NULL) { ++ vfree(info->hdr_alloc); ++ return -ENOEXEC; + } + - /* Sanity checks against insmoding binaries or wrong arch, - weird elf version */ - if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0 -@@ -2255,7 +2317,7 @@ - sechdrs[unwindex].sh_size); + return 0; + } - /* Get rid of temporary copy */ -- vfree(hdr); -+ vfree(hdr_alloc); +@@ -2543,18 +2606,18 @@ + goto out; + } - /* Done! */ - return mod; -@@ -2278,7 +2340,7 @@ - free_mod: - kfree(args); - free_hdr: -- vfree(hdr); -+ vfree(hdr_alloc); - return ERR_PTR(err); +- info->hdr = vmalloc(stat.size); +- if (!info->hdr) { ++ info->hdr_alloc = vmalloc(stat.size); ++ if (!info->hdr_alloc) { + err = -ENOMEM; + goto out; + } - truncated: ---- linux-2.6.28-orig/fs/Makefile 2008-12-24 18:26:37.000000000 -0500 -+++ linux-2.6.28/fs/Makefile 2009-10-14 23:32:11.000000000 -0400 -@@ -41,8 +41,9 @@ - # binfmt_script is always there - obj-y += binfmt_script.o + pos = 0; + while (pos < stat.size) { +- bytes = kernel_read(f.file, pos, (char *)(info->hdr) + pos, ++ bytes = kernel_read(f.file, pos, (char *)(info->hdr_alloc) + pos, + stat.size - pos); + if (bytes < 0) { +- vfree(info->hdr); ++ vfree(info->hdr_alloc); + err = bytes; + goto out; + } +@@ -2564,6 +2627,14 @@ + } + info->len = pos; + ++ /* returns the actual ELF header (whether or not this was FatELF). */ ++ info->hdr = examine_fatelf_module((unsigned char *) info->hdr_alloc, info->len); ++ if (info->hdr == NULL) { ++ vfree(info->hdr_alloc); ++ err = -ENOEXEC; ++ goto out; ++ } ++ + out: + fdput(f); + return err; +@@ -2571,7 +2642,7 @@ + + static void free_copy(struct load_info *info) + { +- vfree(info->hdr); ++ vfree(info->hdr_alloc); + } --obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o -+# List compat_* first, so they insert at end of the list, and are tried last. - obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o -+obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o - obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o - obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o - obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o + static int rewrite_section_headers(struct load_info *info, int flags)