bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/31323] [x86] GAS does not error out instruction that exceed 15


From: cvs-commit at gcc dot gnu.org
Subject: [Bug gas/31323] [x86] GAS does not error out instruction that exceed 15 bytes
Date: Fri, 02 Feb 2024 12:41:54 +0000

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

--- Comment #3 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The binutils-2_42-branch branch has been updated by H.J. Lu
<hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=42cde237366398f6e318232f4ce080bef42f0371

commit 42cde237366398f6e318232f4ce080bef42f0371
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Feb 1 14:42:08 2024 -0800

    x86: Disallow instructions with length > 15 bytes

    It is a hard error when an instruction length exceeds the limit of 15
    bytes:

    [hjl@gnu-cfl-3 tmp]$ cat x.s
            .text
            xacquire lock addq $0x11223344, %fs:(,%eax)
    [hjl@gnu-cfl-3 tmp]$ gcc -c x.s
    x.s: Assembler messages:
    x.s:2: Warning: instruction length of 16 bytes exceeds the limit of 15
    [hjl@gnu-cfl-3 tmp]$ objdump -dw x.o

    x.o:     file format elf64-x86-64

    Disassembly of section .text:

    0000000000000000 <.text>:
       0:   64 67 f2 f0 48 81 04 05 00 00 00 00 44 33 22    xacquire lock (bad)
       f:   11                      .byte 0x11
    [hjl@gnu-cfl-3 tmp]$

    and

    [hjl@gnu-cfl-3 tmp]$ cat z.s
            addq $0xe0, %fs:0, %rdx
    [hjl@gnu-cfl-3 tmp]$ as -o z.o z.s
    z.s: Assembler messages:
    z.s:1: Warning: instruction length of 16 bytes exceeds the limit of 15
    [hjl@gnu-cfl-3 tmp]$ objdump -dw z.o

    z.o:     file format elf64-x86-64

    Disassembly of section .text:

    0000000000000000 <.text>:
       0:   64 62 f4 ec 18 81 04 25 00 00 00 00 e0 00 00    (bad)
            ...
    [hjl@gnu-cfl-3 pr31323]$

    Instructions with length > 15 bytes are always invalid.  It is quite easy
    to generate invalid instructions with APX now.  We should issue an error
    when instruction length exceeds the limit of 15 bytes.

            PR gas/31323
            * config/tc-i386.c (output_insn): Issue an error when instruction
            length exceeds the limit of 15 bytes.
            * testsuite/gas/i386/oversized16.l: Updated.
            * testsuite/gas/i386/oversized64.l: Likewise.
            * testsuite/gas/i386/x86-64-apx-inval.l: New file.
            * testsuite/gas/i386/x86-64-apx-inval.s: Likewise.

    (cherry picked from commit 46bd909328c3c8f3d6fc7a505b2fad1eea72d872)

-- 
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]