Project

General

Profile

Bug #12372

dis EVEX encoding SIB mishandled

Added by Robert Mustacchi 9 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

While working on other parts of dis support for newer AVX512 instructions, I happened to use an extended (as in not present in ia32) register like r10 and r12. We didn't properly calculate the displacement and SIB at all. There were a number of problems:

  • The rex_prefix wasn't being properly saved for the decoder in the AVX512 case.
  • The vex case which leads us not to clobber the rex_prefix member was not extended to AVX512.
  • The code to detect and extract a SIB did not realize this case was possible.

The fixes here are fairly straightforward and mostly involve a lot of plumbing. Because we have the dis test suite, it was pretty easy to verify that we didn't regress anything.


Related issues

Related to illumos gate - Feature #8384: AVX512 dis - EVEX prefix supportClosedJerry Jelinek2017-06-13

Actions
#1

Updated by Robert Mustacchi 9 months ago

  • Related to Feature #8384: AVX512 dis - EVEX prefix support added
#2

Updated by Robert Mustacchi 9 months ago

I discovered this with several of the other avx512 tests and used those and the existing tests to verify that things now worked correctly.

rm@turin:/ws/rm/dis/usr/src/test/util-tests/tests/dis$ LD_PRELOAD_32=/ws/rm/dis/proto/root_i386/usr/lib/libdisasm.so.1 ksh distest.ksh 
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.sep.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.sep.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.vmx.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.vmx.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.cpuid.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.cpuid.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.mwait.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.mwait.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.fence.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.fence.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.smap.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.smap.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.random.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.random.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.tsc.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.tsc.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.msr.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.msr.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.wbnovind.s (32-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/tst.wbnovind.s (64-bit) ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.bmi2.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.sha.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.avx2-gather.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.gfni.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.fma-pd.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.adx.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.movbe.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.sse-4.2.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.avx512_vpclmulqdq.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.aes.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.vaes.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.fma-sd.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.bmi1.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.fma-ss.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.sse-4.1.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.avx.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.ssse3.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.fma-ps.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.lzcnt.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.opmask.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.popcnt.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.avx512.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.f16c.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.sse-3.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.xsave.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.avx512_vnni.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.avx2.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.pclmulqdq.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/32.clflush.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.bmi2.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.fma-ss.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.avx512_vnni.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.ept.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.gfni.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.vmx.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.fma-ps.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.vaes.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.sse-4.1.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.ssse3.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.avx.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.lzcnt.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.bmi1.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.adx.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.fma-pd.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.sha.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.movbe.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.sse-4.2.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.fma-sd.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.aes.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.avx512_vpclmulqdq.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.fsbase.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.random.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.xsave.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.sse-3.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.pclmulqdq.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.clflush.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.f16c.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.opmask.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.avx2-gather.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.popcnt.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.avx2.s ... passed
testing /ws/rm/dis/usr/src/test/util-tests/tests/dis/i386/64.avx512.s ... passed

--------------
libdis Results
--------------

Tests passed: 82
Tests failed: 0
Tests ran:    82
#3

Updated by Electric Monk 9 months ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit a25e615d76804404e5fc63897a9196d4f92c3f5e

commit  a25e615d76804404e5fc63897a9196d4f92c3f5e
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2020-03-13T07:57:47.000Z

    12371 dis x86 EVEX prefix mishandled
    12372 dis EVEX encoding SIB mishandled
    12373 dis support for EVEX vaes instructions
    12374 dis support for EVEX vpclmulqdq instructions
    12375 dis support for gfni instructions
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

Also available in: Atom PDF