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/87014] New: [x32] __builtin_eh_return should use 64-bit mov to set return address


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

            Bug ID: 87014
           Summary: [x32] __builtin_eh_return should use 64-bit mov to set
                    return address
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: theonetruecamper at gmx dot de
  Target Milestone: ---

long offset;
void* ptr;

void f(void)
{
    __builtin_eh_return(offset,ptr);
}

with gcc -mx32 produces (gcc (Gentoo Hardened 7.3.0-r3 p1.4) 7.3.0)

f:
        pushq   %rbp
        movl    %esp, %ebp
        pushq   %rdx
        pushq   %rax
        movl    %fs:24, %eax
        movl    %eax, -20(%ebp)
        xorl    %eax, %eax
        movl    ptr(%rip), %eax
        movl    offset(%rip), %edx
        movl    %edx, %ecx
        movl    %eax, 8(%ebp,%ecx)    # !
        movq    -16(%ebp), %rax
        movq    -8(%ebp), %rdx
        leal    8(%rbp,%rcx), %ecx
        movl    0(%ebp), %ebp
        movl    %ecx, %esp
        ret                           # !!

Since the upper half of the return address is not cleared this can lead to
SIGSEGV in _Unwind_*

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