[PATCH] D46181: [X86][CET] Shadow stack fix for setjmp/longjmp

Mikhail Dvoretckii via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 07:59:38 PDT 2018


mike.dvoretsky added inline comments.


================
Comment at: llvm/test/CodeGen/X86/shadow-stack.ll:76
+; X86-NEXT:    shll %ecx
+; X86-NEXT:    movl $128, %edx
+; X86-NEXT:  .LBB0_4: # %entry
----------------
hjl.tools wrote:
> Why movl $128?  incssp takes last 8 bits.  "movl $255" works.
This part ensures that we increment the SSP beyond the value in the low 8 bits of ecx on the last incsspd use. This means that we need to further increment the SSP by ecx * 256 at the start of this block. We cannot express that 256 in 8 bits, so instead we increment by (2 * ecx) * 128. So using 255 doesn't fit the logic of this part. Same goes for the 64-bit version.


https://reviews.llvm.org/D46181





More information about the llvm-commits mailing list