[PATCH] x86: Avoid abort on invalid broadcast
Jan Beulich
jbeulich@suse.com
Thu Aug 19 14:18:22 GMT 2021
On 19.08.2021 16:02, H.J. Lu via Binutils wrote:
> --- /dev/null
> +++ b/gas/testsuite/gas/i386/bad-bcast.d
> @@ -0,0 +1,14 @@
> +#objdump: -dw
> +#name: Disassemble bad broadcast
> +
> +.*: +file format .*
> +
> +
> +Disassembly of section .text:
> +
> +0+ <.text>:
> + +[a-f0-9]+: 62 .byte 0x62
> + +[a-f0-9]+: c3 ret
> + +[a-f0-9]+: 8c 1d 66 90 66 90 mov %ds,0x90669066
> + +[a-f0-9]+: 66 90 xchg %ax,%ax
Urgh, yet another piece of rubbish. Where's the "{bad}" that
you're supposedly printing? This is the 0f3a encoding space if
I'm not mistaken, so we know the encoding length no matter
whether the encoding is actually valid. We'd better not resort
to ".byte" in that case, or if we do, then all bytes of the
encoding should be consumed.
> --- /dev/null
> +++ b/gas/testsuite/gas/i386/bad-bcast.s
> @@ -0,0 +1,2 @@
> + .text
> + .byte 0x62, 0xc3, 0x8c, 0x1d, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90
Would you mind adding a comment indicating what this resembles?
> --- a/opcodes/i386-dis.c
> +++ b/opcodes/i386-dis.c
> @@ -11912,7 +11912,7 @@ OP_E_memory (int bytemode, int sizeflag)
> {
> if (vex.w)
> {
> - abort ();
> + oappend ("{bad}");
I can see that this is encoding dependent, so indeed shouldn't be
abort().
> @@ -11928,7 +11928,7 @@ OP_E_memory (int bytemode, int sizeflag)
> oappend ("{1to32}");
> break;
> default:
> - abort ();
> + oappend ("{bad}");
> }
> }
> }
> @@ -11948,7 +11948,7 @@ OP_E_memory (int bytemode, int sizeflag)
> oappend ("{1to8}");
> break;
> default:
> - abort ();
> + oappend ("{bad}");
> }
> }
> else if (bytemode == x_mode
> @@ -11966,7 +11966,7 @@ OP_E_memory (int bytemode, int sizeflag)
> oappend ("{1to16}");
> break;
> default:
> - abort ();
> + oappend ("{bad}");
> }
> }
> else
All of these, otoh, assume that EVEX.L'L=3 was filtered out earlier,
so I think abort() is legitimate there.
Jan
More information about the Binutils
mailing list