Bug 24719 - objdump fails to reject invalid scatter/gather prefetch instructions
Summary: objdump fails to reject invalid scatter/gather prefetch instructions
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.33
Assignee: H.J. Lu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-21 17:59 UTC by Hendrik Greving
Modified: 2019-06-27 20:52 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2019-06-24 00:00:00


Attachments
Please try this. (1.01 KB, patch)
2019-06-24 22:42 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hendrik Greving 2019-06-21 17:59:32 UTC
Similar to previously filed issue.

llvm-mc-7 seems to handle it correctly:

e.g.

echo "0x62 0xf2 0x7d 0x0f 0xc6 0x4c 0x71 0x35" | /usr/bin/llvm-mc-7 -disassemble -triple=x86_64                                                                                                                                                
        .text
<stdin>:1:1: warning: invalid instruction encoding
0x62 0xf2 0x7d 0x0f 0xc6 0x4c 0x71 0x35

The prefetch opcodes accept only certain vsib index sizes, e.g. vgatherpf0dps only vm32z.

objdump accepts it:

[..]
objdump -d a.out
0:   62 f2 7d 0f c6 4c 71    vgatherpf0dps 0xd4(%rcx,%xmm6,2){%k7}
Comment 1 H.J. Lu 2019-06-24 22:42:48 UTC
Created attachment 11863 [details]
Please try this.
Comment 2 Sourceware Commits 2019-06-27 20:40:22 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit e395f487b3758b3de99fddd2ef15a799e9fc1203
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 27 13:39:19 2019 -0700

    i386: Check vector length for scatter/gather prefetch instructions
    
    Since not all vector lengths are supported by scatter/gather prefetch
    instructions, decode them only with supported vector lengths.
    
    gas/
    
    	PR binutils/24719
    	* testsuite/gas/i386/disassem.s: Add test for vgatherpf0dps
    	with invalid vector length.
    	* testsuite/gas/i386/x86-64-disassem.s: Likewise.
    	* testsuite/gas/i386/disassem.d: Updated.
    	* testsuite/gas/i386/x86-64-disassem.d: Likewise.
    
    opcodes/
    
    	PR binutils/24719
    	* i386-dis-evex-len.h: Add EVEX_LEN_0F38C6_REG_1_PREFIX_2,
    	EVEX_LEN_0F38C6_REG_2_PREFIX_2, EVEX_LEN_0F38C6_REG_5_PREFIX_2,
    	EVEX_LEN_0F38C6_REG_6_PREFIX_2, EVEX_LEN_0F38C7_R_1_P_2_W_0,
    	EVEX_LEN_0F38C7_R_1_P_2_W_1, EVEX_LEN_0F38C7_R_2_P_2_W_0,
    	EVEX_LEN_0F38C7_R_2_P_2_W_1, EVEX_LEN_0F38C7_R_5_P_2_W_0,
    	EVEX_LEN_0F38C7_R_5_P_2_W_1, EVEX_LEN_0F38C7_R_6_P_2_W_0 and
    	EVEX_LEN_0F38C7_R_6_P_2_W_1.
    	* i386-dis-evex-prefix.h: Update PREFIX_EVEX_0F38C6_REG_1,
    	PREFIX_EVEX_0F38C6_REG_2, PREFIX_EVEX_0F38C6_REG_5 and
    	PREFIX_EVEX_0F38C6_REG_6 entries.
    	* i386-dis-evex-w.h: Update EVEX_W_0F38C7_R_1_P_2,
    	EVEX_W_0F38C7_R_2_P_2, EVEX_W_0F38C7_R_5_P_2 and
    	EVEX_W_0F38C7_R_6_P_2 entries.
    	* i386-dis.c: Add EVEX_LEN_0F38C6_REG_1_PREFIX_2,
    	EVEX_LEN_0F38C6_REG_2_PREFIX_2, EVEX_LEN_0F38C6_REG_5_PREFIX_2,
    	EVEX_LEN_0F38C6_REG_6_PREFIX_2, EVEX_LEN_0F38C7_R_1_P_2_W_0,
    	EVEX_LEN_0F38C7_R_1_P_2_W_1, EVEX_LEN_0F38C7_R_2_P_2_W_0,
    	EVEX_LEN_0F38C7_R_2_P_2_W_1, EVEX_LEN_0F38C7_R_5_P_2_W_0,
    	EVEX_LEN_0F38C7_R_5_P_2_W_1, EVEX_LEN_0F38C7_R_6_P_2_W_0 and
    	EVEX_LEN_0F38C7_R_6_P_2_W_1 enums.
Comment 3 H.J. Lu 2019-06-27 20:52:41 UTC
Fixed for 2.33.