This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/84066] Wrong shadow stack register size is saved for x32
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 29 Jan 2018 20:36:03 +0000
- Subject: [Bug target/84066] Wrong shadow stack register size is saved for x32
- Auto-submitted: auto-generated
- References: <bug-84066-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84066
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to igor.v.tsimbalist from comment #6)
> >
> > reg_ssp must be in word_mode, not in Pmode.
>
> reg_ssp is word_mode. It's reg_adj that is Pmode (it's increment to shadow
> stack).
OK.
> > Please show the assembly outputs of __builtin_setjmp and __builtin_longjmp
> > with the updated patch.
>
> A snippet for __builtin_longjmp for -mx32
>
> movl $0, %eax
Please use xor.
> rdsspq %rax
> subq buf+12(%rip), %rax
> je .L2
> negl %eax
> shrl $2, %eax
^^^^^^^^^^^^^^^^^^^^^ Shouldn't be "shrl $3, %eax" since SSP is 64-bit?
> cmpl $255, %eax
> jbe .L3
> .L4:
> incsspq %rax
> subl $255, %eax
> cmpl $255, %eax
> ja .L4
> .L3:
> incsspq %rax
> .L2:
>
> Snippet for __builtin_setjmp for -mx32
>
> movl %eax, buf(%rip)
> movl $.L8, buf+4(%rip)
> movl %esp, buf+8(%rip)
> movl $0, %eax
xor.
> rdsspq %rax
> movq %rax, buf+12(%rip)