bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/31595] Abort in AArch64 disassembler's get_sreg_qualifier_


From: nickc at redhat dot com
Subject: [Bug binutils/31595] Abort in AArch64 disassembler's get_sreg_qualifier_from_value() function
Date: Mon, 08 Apr 2024 12:45:11 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=31595

--- Comment #4 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Victor Do Nascimento from comment #3)
Hi Victor,

> Looking at `readelf -S ./libc.so.6', we see that the crash happens within
> the .gnu.hash section of the elf file.  This, combined with the fact we used
> the -D flag when disassembling leads me to the conclusion that we're trying
> to disassemble non-instruction bytes, which due to ill-luck, look an awful
> lot like a valid instruction.

Ah - that makes sense.


> This thus seems like a quality of implementation issue. Normal disassembly
> of executable sections of code appear to be functioning correctly, but I
> guess a rethink is needed in terms of how assertions are used in disassembly.
> 
> My impression is that their use in a context such as in the use of `objdump
> --disassemble-all` ought be predicated on whether or not we're disassembling
> in a strictly executable code-only section of the object file or not...

In my opinion, the disassembler should never trigger an abort (or an
assertion), even if it is being asked to decode an illegal bit sequence. 
Instead it should just display the bits with an annotation that they are
illegal.  In fact when a user is disassembling with the -D/--disassemble-all it
should be clear that they expect illegal bit sequences to be encountered, and
objdump should really be able to cope.

(This also goes back to my long standing opinion that library functions should
never call abort.  Instead they should always report back to their caller that
they have encountered some kind of problem, and allow the caller to decide what
to do).

My suggestion is that you change get_sreg_qualifier_from_value() so that it
returns AARCH64_OPND_QLF_NIL if it encounters an error.  (Or maybe a new
aarch64_opnd_qualifier value such as AARCH64_OPND_QLF_ERR).  And then update
the callers of get_sreg_qualifier_from_value to take some kind of action if
this result is returned.  A bit if a hassle I know, but I think that it is the
right thing to do.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]