All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 0/4] OpenRISC binutils updates and new relocs
Date: Thu, 27 Sep 2018 15:07:56 +0900	[thread overview]
Message-ID: <20180927060756.GB3318@lianli.shorne-pla.net> (raw)
In-Reply-To: <20b65fc3-5bbb-6e77-f598-4582204ee0e5@redhat.com>

Hi Nick,

On Tue, Sep 18, 2018 at 12:55:48PM +0100, Nick Clifton wrote:
> One other thing:  There are several places where you add calls to 
> abort().  Now this is not wrong, and certainly not a reason to 
> reject the patch, but I consider it to be unhelpful.  To my mind
> a library, or tool, should generate an error message when something
> goes wrong and not leave the user wondering why they have suddenly
> got a segmentation fault.
> 
> Plus if you have a call to abort() in the code you can bet that some 
> enterprising person with a binary fuzzer will find a way to trigger 
> it, and then file a CVE about it.  (Fixing CVEs is the bane of my 
> life as they involve lots of extra administrivia).

I have been away the last week and am just getting to fixing these abort()'s
now.  However, I have a question.

The aborts I see are:

  bfd/elf32-or1k.c (or1k_final_link_relocate) - 2 places
  cpu/or1k-asm.c (parse_imm16) - 1 place

In these cases we call abort if a switch statement falls through to the default
case. If we get an abort its definitely a bug.

To produce these errors I need to change the code, Using abort we see:

   /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-elf/9.0.0/../../../../or1k-elf/bin/ld: \
      BFD (GNU Binutils) 2.31.51.20180927 internal error, \
      aborting at ../../binutils-gdb/bfd/elf32-or1k.c:1152 in or1k_final_link_relocate

   /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-elf/9.0.0/../../../../or1k-elf/bin/ld: \
      Please report this bug.

   collect2: error: ld returned 1 exit status

There is no segmentation fault.  I agree, it is more nice to create a message
inform which error triggered the issue.

Is something like this ok?

    default:
      _bfd_error_handler
	(_("%pB: Unknown complain on overflow value on howto specified %d"),
	 input_bfd, (int) howto->complain_on_overflow);
      abort();

i.e. _bfd_error_handler() followed by abort().  I couldn't really see a way to
_bfd_error_handler() to actually cause the program to exit.

-Stafford

  parent reply	other threads:[~2018-09-27  6:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 14:38 [OpenRISC] [PATCH 0/4] OpenRISC binutils updates and new relocs Stafford Horne
2018-08-21 14:38 ` [OpenRISC] [PATCH 1/4] or1k: Add relocations for high-signed and low-stores Stafford Horne
2018-08-21 14:38 ` [OpenRISC] [PATCH 2/4] or1k: Fix messages for relocations in shared libraries Stafford Horne
2018-08-21 14:38 ` [OpenRISC] [PATCH 3/4] or1k: Add the l.adrp insn and supporting relocations Stafford Horne
2018-08-21 14:38 ` [OpenRISC] [PATCH 4/4] or1k: Add the l.muld, l.muldu, l.macu, l.msbu insns Stafford Horne
2018-09-08 21:35 ` [OpenRISC] [PATCH 0/4] OpenRISC binutils updates and new relocs Stafford Horne
2018-09-17 15:07   ` Nick Clifton
2018-09-17 16:29     ` Richard Henderson
2018-09-18  9:52     ` Stafford Horne
2018-09-18 11:55       ` Nick Clifton
2018-09-18 12:07         ` Joel Sherrill
2018-09-21 12:40           ` Stafford Horne
2018-09-19 13:23         ` Stafford Horne
2018-09-27  6:07         ` Stafford Horne [this message]
2018-09-28 15:39           ` Nick Clifton
2018-10-01  7:08             ` Stafford Horne

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=20180927060756.GB3318@lianli.shorne-pla.net \
    --to=shorne@gmail.com \
    --cc=openrisc@lists.librecores.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.