public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] PR25196, abort in rewrite_elf_program_header
Date: Mon, 18 Nov 2019 12:40:00 -0000	[thread overview]
Message-ID: <9aea1e31371a883452e80bd96e8818289c3e6b6e@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 9aea1e31371a883452e80bd96e8818289c3e6b6e ***

commit 9aea1e31371a883452e80bd96e8818289c3e6b6e
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Mon Nov 18 12:31:55 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Mon Nov 18 22:06:09 2019 +1030

    PR25196, abort in rewrite_elf_program_header
    
    This patch introduces a new "sorry, cannot handle this file" bfd error
    status.  The idea is to use this error in cases where bfd hasn't found
    a bfd_bad_value error, ie. an input file or set of options that are
    invalid, but rather an input file that is simply too difficult to
    process.  Typically this might happen with fuzzed object files such as
    the one in the PR, a wildly improbable core file.  Some things are
    just not worth wasting time over to fix "properly".
    
            PR 25196
            * bfd.c (bfd_error_type): Add bfd_error_sorry.
            (bfd_errmsgs): Likewise.
            * elf.c (rewrite_elf_program_header): Don't abort on confused
            lma/alignment.  Replace bfd_error_bad_value with bfd_error_sorry.
            (_bfd_elf_validate_reloc): Use bfd_error_sorry.
            (_bfd_elf_final_write_processing): Likewise.
            * bfd-in2.h: Regenerate.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9370b7a8d0..2184208038 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,14 @@
+2019-11-18  Alan Modra  <amodra@gmail.com>
+
+	PR 25196
+	* bfd.c (bfd_error_type): Add bfd_error_sorry.
+	(bfd_errmsgs): Likewise.
+	* elf.c (rewrite_elf_program_header): Don't abort on confused
+	lma/alignment.  Replace bfd_error_bad_value with bfd_error_sorry.
+	(_bfd_elf_validate_reloc): Use bfd_error_sorry.
+	(_bfd_elf_final_write_processing): Likewise.
+	* bfd-in2.h: Regenerate.
+
 2019-11-12  Jim Wilson  <jimw@sifive.com>
 
 	PR 25181
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 3244905b45..a00dfa3515 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -6964,6 +6964,7 @@ typedef enum bfd_error
   bfd_error_bad_value,
   bfd_error_file_truncated,
   bfd_error_file_too_big,
+  bfd_error_sorry,
   bfd_error_on_input,
   bfd_error_invalid_error_code
 }
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 94e9f27e9d..e92213b543 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -655,6 +655,7 @@ CODE_FRAGMENT
 .  bfd_error_bad_value,
 .  bfd_error_file_truncated,
 .  bfd_error_file_too_big,
+.  bfd_error_sorry,
 .  bfd_error_on_input,
 .  bfd_error_invalid_error_code
 .}
@@ -688,6 +689,7 @@ const char *const bfd_errmsgs[] =
   N_("bad value"),
   N_("file truncated"),
   N_("file too big"),
+  N_("sorry, cannot handle this file"),
   N_("error reading %s: %s"),
   N_("#<invalid error code>")
 };
diff --git a/bfd/elf.c b/bfd/elf.c
index be060d579c..e10099842b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7324,7 +7324,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
 					  : 0),
 				       output_section->alignment_power)
 			  != output_section->lma)
-			abort ();
+			goto sorry;
 		    }
 		  else
 		    {
@@ -7363,7 +7363,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
 	     negative size - or segments that do not contain any sections.  */
 	  if (map->count == 0)
 	    {
-	      bfd_set_error (bfd_error_bad_value);
+	    sorry:
+	      bfd_set_error (bfd_error_sorry);
 	      free (sections);
 	      return FALSE;
 	    }
@@ -9277,7 +9278,7 @@ _bfd_elf_validate_reloc (bfd *abfd, arelent *areloc)
   /* xgettext:c-format */
   _bfd_error_handler (_("%pB: %s unsupported"),
 		      abfd, areloc->howto->name);
-  bfd_set_error (bfd_error_bad_value);
+  bfd_set_error (bfd_error_sorry);
   return FALSE;
 }
 
@@ -12249,7 +12250,7 @@ _bfd_elf_final_write_processing (bfd *abfd)
 	    _bfd_error_handler (_("symbol type STT_GNU_IFUNC is unsupported"));
 	  if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_unique)
 	    _bfd_error_handler (_("symbol binding STB_GNU_UNIQUE is unsupported"));
-	  bfd_set_error (bfd_error_bad_value);
+	  bfd_set_error (bfd_error_sorry);
 	  return FALSE;
 	}
     }


             reply	other threads:[~2019-11-18 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 12:40 gdb-buildbot [this message]
2019-11-18 12:40 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2019-11-26 20:05 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-11-26 20:20 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-11-26 20:41 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-11-26 20:41 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-11-26 20:47 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-11-26 20:55 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9aea1e31371a883452e80bd96e8818289c3e6b6e@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).