HelloGUI
HelloGUI

Reputation: 161

uiCA assembly code check dosen't detect JCC erratum

I tried to check my code using uiCA for JCC erratum but something unexpected happen ! One of my cmp jcc is located at 0x7e which is (126) but uiCA doesn't detect its JCC erratum problem !!!

7e: 3c 2b                   cmp    al,0x2b
80: 74 de                   je     0x60

The full code to check

0000000000000000 <.text>:
   0:   49 89 d0                mov    r8,rdx
   3:   48 31 c0                xor    rax,rax
   6:   49 89 00                mov    QWORD PTR [r8],rax
   9:   49 89 40 08             mov    QWORD PTR [r8+0x8],rax
   d:   49 89 40 10             mov    QWORD PTR [r8+0x10],rax
  11:   b9 21 00 00 00          mov    ecx,0x21
  16:   48 8d 7f 3f             lea    rdi,[rdi+0x3f]
  1a:   48 83 e7 c0             and    rdi,0xffffffffffffffc0
  1e:   49 89 f9                mov    r9,rdi
  21:   49 89 78 18             mov    QWORD PTR [r8+0x18],rdi
  25:   48 8b 06                mov    rax,QWORD PTR [rsi]
  28:   48 ba 68 74 74 70 73    movabs rdx,0x2f2f3a7370747468
  2f:   3a 2f 2f 
  32:   48 39 d0                cmp    rax,rdx
  35:   75 33                   jne    0x6a
  37:   49 b9 ff ff ff ff ff    movabs r9,0xffffffffff
  3e:   00 00 00 
  41:   4c 21 ca                and    rdx,r9
  44:   48 89 17                mov    QWORD PTR [rdi],rdx
  47:   41 c6 00 05             mov    BYTE PTR [r8],0x5
  4b:   48 83 c7 40             add    rdi,0x40
  4f:   48 83 c6 08             add    rsi,0x8
  53:   49 89 f9                mov    r9,rdi
  56:   e9 af 00 00 00          jmp    0x10a
  5b:   90                      nop
  5c:   90                      nop
  5d:   90                      nop
  5e:   90                      nop
  5f:   90                      nop
  60:   88 07                   mov    BYTE PTR [rdi],al
  62:   48 83 c7 01             add    rdi,0x1
  66:   48 83 c6 01             add    rsi,0x1
  6a:   0f b6 06                movzx  eax,BYTE PTR [rsi]
  6d:   8d 50 9f                lea    edx,[rax-0x61]
  70:   80 fa 1a                cmp    dl,0x1a
  73:   72 eb                   jb     0x60
  75:   48 8d 50 d0             lea    rdx,[rax-0x30]
  79:   80 fa 0a                cmp    dl,0xa
  7c:   72 e2                   jb     0x60
  7e:   3c 2b                   cmp    al,0x2b
  80:   74 de                   je     0x60
  82:   3c 2d                   cmp    al,0x2d
  84:   74 da                   je     0x60
  86:   3c 2e                   cmp    al,0x2e
  88:   74 d6                   je     0x60
  8a:   3c 3a                   cmp    al,0x3a
  8c:   74 12                   je     0xa0
  8e:   8d 50 bf                lea    edx,[rax-0x41]
  91:   80 fa 1a                cmp    dl,0x1a
  94:   73 4a                   jae    0xe0
  96:   04 20                   add    al,0x20
  98:   eb c6                   jmp    0x60

Tested using : https://uica.uops.info/

Is it a bug in uiCA ? Or i just missed something ?

Upvotes: 1

Views: 52

Answers (1)

What you see is just the length of your code, not where it's executed (memory offset). You executed your code with an 'unknown' (0) memory offset (i think you didn't change the value of the 'alignment offset' and it's equal to 0, right ?). You need to tell uiCA where you want your code to be executed, a 32 bytes aligned memory. Set 'alignment offset' to 32 and you will face a 'J' flag (stands for JCC erratum). Maybe your code executed in a 16 bytes aligned memory and it was OK when executed (no JCC erratum).

Upvotes: 2

Related Questions