[Bug target/101276] New: [i386] Keylocker output should be cleared when instruction reports runtime error.

wwwhhhyyy333 at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 1 03:24:08 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101276

            Bug ID: 101276
           Summary: [i386] Keylocker output should be cleared when
                    instruction reports runtime error.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wwwhhhyyy333 at gmail dot com
  Target Milestone: ---

Some keylocker instruction will set ZF when runtime occurs, and the output data
should be invalid. 

Current intrinsic just copy the input data to output regardless of the ZF, like

 movdqa  k2(%rip), %xmm0
 aesdec128kl     h1(%rip), %xmm0
 sete    %al
 movups  %xmm0, k1(%rip)

It could bring safety issue that return the unencrypted data when runtime error
occurs. So the code should be like

        movdqa  k2(%rip), %xmm0
        aesdec128kl     h1(%rip), %xmm0
        je      .L4
.L2:
        sete    %al
        movups  %xmm0, k1(%rip)
        ret
.L4:
        pxor    %xmm0, %xmm0
        jmp     .L2

To clear the output data.


More information about the Gcc-bugs mailing list