This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/84066] Wrong shadow stack register size is saved for x32


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]