aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-script.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-02-01 14:42:08 -0800
committerH.J. Lu <hjl.tools@gmail.com>2024-02-02 04:36:27 -0800
commit46bd909328c3c8f3d6fc7a505b2fad1eea72d872 (patch)
tree8afec2c4466447f2093cf08066b79ceeb66c5631 /gdb/cli/cli-script.c
parent6a6744198309c2122fed4374b97ee170a3b2d3e2 (diff)
downloadbinutils-46bd909328c3c8f3d6fc7a505b2fad1eea72d872.zip
binutils-46bd909328c3c8f3d6fc7a505b2fad1eea72d872.tar.gz
binutils-46bd909328c3c8f3d6fc7a505b2fad1eea72d872.tar.bz2
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 AVX 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.
Diffstat (limited to 'gdb/cli/cli-script.c')
0 files changed, 0 insertions, 0 deletions