Bug 23465

Summary: wrongly scale non-8-bit x86 displacements
Product: binutils Reporter: Wei Xiao <wei3.xiao>
Component: gasAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: fweimer, hjl.tools, jakub, pierre.karpman, thiago
Priority: P2 Flags: fweimer: security-
Version: 2.31   
Target Milestone: 2.32   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=1869401
Host: Target:
Build: Last reconfirmed: 2018-07-30 00:00:00

Description Wei Xiao 2018-07-30 14:01:09 UTC
$ cat x.s
 vmovaps 64(,%rax), %zmm0
$ gcc -c x.s
$ objdump -dw x.o

x.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:	62 f1 7c 48 28 04 05 01 00 00 00 	vmovaps 0x1(,%rax,1),%zmm0
Comment 1 H.J. Lu 2018-07-30 15:33:13 UTC
Fixed on master branch by

commit 629cfaf1b0fbb32a985607c774bd8e7870b9fa94
Author: Jan Beulich <jbeulich@novell.com>
Date:   Mon Jul 30 17:25:05 2018 +0200

    x86: don't mistakenly scale non-8-bit displacements
    
    In commit b5014f7af2 I've removed (instead of replaced) a conditional,
    resulting in addressing forms not allowing 8-bit displacements to now
    get their displacements scaled under certain circumstances. Re-add the
    missing conditional.
Comment 2 Sourceware Commits 2018-07-31 09:05:19 UTC
The binutils-2_31-branch branch has been updated by Jan Beulich <jbeulich@sourceware.org>:

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

commit 2069ccaf8dc28ea699bd901fdd35d90613e4402a
Author: Jan Beulich <jbeulich@novell.com>
Date:   Tue Jul 31 11:04:34 2018 +0200

    x86: don't mistakenly scale non-8-bit displacements
    
    PR gas/23465
    
    In commit b5014f7af2 I've removed (instead of replaced) a conditional,
    resulting in addressing forms not allowing 8-bit displacements to now
    get their displacements scaled under certain circumstances. Re-add the
    missing conditional.
Comment 3 H.J. Lu 2018-07-31 12:02:55 UTC
Fixed for master and 2.31 branch.
Comment 4 H.J. Lu 2018-09-11 14:54:01 UTC
*** Bug 23628 has been marked as a duplicate of this bug. ***
Comment 5 H.J. Lu 2018-11-24 13:41:49 UTC
*** Bug 23314 has been marked as a duplicate of this bug. ***
Comment 6 Sourceware Commits 2018-11-26 12:55:23 UTC
The binutils-2_30-branch branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit 4e518864c879be2e6af4c64415e8775d9a20deaf
Author: Jan Beulich <jbeulich@novell.com>
Date:   Tue Jul 31 11:04:34 2018 +0200

    x86: don't mistakenly scale non-8-bit displacements
    
    In commit b5014f7af2 I've removed (instead of replaced) a conditional,
    resulting in addressing forms not allowing 8-bit displacements to now
    get their displacements scaled under certain circumstances. Re-add the
    missing conditional.
    
    2018-07-30  Jan Beulich  <jbeulich@suse.com>
    
    	PR gas/23465
    	* config/tc-i386.c (output_disp): Restrict scaling.
    	* testsuite/gas/i386/evex-no-scale.s,
    	  testsuite/gas/i386/evex-no-scale-32.d
    	  testsuite/gas/i386/evex-no-scale-64.d: New.
    	* testsuite/gas/i386/i386.exp: Run new tests.
    
    (cherry picked from commit 629cfaf1b0fbb32a985607c774bd8e7870b9fa94)
Comment 7 H.J. Lu 2019-04-10 14:06:44 UTC
*** Bug 24434 has been marked as a duplicate of this bug. ***