public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return
@ 2022-01-06  2:03 hjl.tools at gmail dot com
  2022-01-06  2:47 ` [Bug target/103925] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-06  2:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103925
           Summary: Missing int3 in ix86_output_indirect_function_return
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: andrew.cooper3 at citrix dot com, ubizjak at gmail dot com
  Target Milestone: ---

[hjl@gnu-tgl-2 tmp]$ cat foo.c
struct _Unwind_Context _Unwind_Resume_or_Rethrow_this_context;

void offset (int);

struct _Unwind_Context {
  void *reg[7];
} _Unwind_Resume_or_Rethrow() {
  struct _Unwind_Context cur_contextcur_context =
      _Unwind_Resume_or_Rethrow_this_context;
  offset(0);
  __builtin_eh_return ((long) offset, 0);
}
[hjl@gnu-tgl-2 tmp]$ /usr/gcc-12.0.0-x32/bin/gcc -S -O2 -fcf-protection
-mharden-sls=all foo.c 
[hjl@gnu-tgl-2 tmp]$ cat foo.s
        .file   "foo.c"
        .text
        .p2align 4
        .globl  _Unwind_Resume_or_Rethrow
        .type   _Unwind_Resume_or_Rethrow, @function
_Unwind_Resume_or_Rethrow:
.LFB0:
        .cfi_startproc
        endbr64
        pushq   %rdx
        .cfi_def_cfa_offset 16
        .cfi_offset 1, -16
        xorl    %edi, %edi
        pushq   %rax
        .cfi_def_cfa_offset 24
        .cfi_offset 0, -24
        subq    $8, %rsp
        .cfi_def_cfa_offset 32
        call    offset
        movl    $offset, %ecx
        movq    $0, 24(%rsp,%rcx)
        movq    8(%rsp), %rax
        movq    16(%rsp), %rdx
        leaq    24(%rsp,%rcx), %rsp
        .cfi_def_cfa_offset 8
        popq    %rcx
        .cfi_register 16, 2
        .cfi_def_cfa_offset 0
        jmp     *%rcx <<<< Missing int3
        .cfi_endproc
.LFE0:
        .size   _Unwind_Resume_or_Rethrow, .-_Unwind_Resume_or_Rethrow
        .globl  _Unwind_Resume_or_Rethrow_this_context
        .bss
        .align 32
        .type   _Unwind_Resume_or_Rethrow_this_context, @object
        .size   _Unwind_Resume_or_Rethrow_this_context, 56
_Unwind_Resume_or_Rethrow_this_context:
        .zero   56
        .ident  "GCC: (GNU) 12.0.0 20211225 (experimental)"
        .section        .note.GNU-stack,"",@progbits
        .section        .note.gnu.property,"a"
        .align 8
        .long   1f - 0f
        .long   4f - 1f
        .long   5
0:
        .string "GNU"
1:
        .align 8
        .long   0xc0000002
        .long   3f - 2f
2:
        .long   0x3
3:
        .align 8
4:
[hjl@gnu-tgl-2 tmp]$

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/103925] Missing int3 in ix86_output_indirect_function_return
  2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
@ 2022-01-06  2:47 ` pinskia at gcc dot gnu.org
  2022-01-06  2:54 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-06  2:47 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2022-01-06

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>	jmp	*%rcx <<<< Missing int3


Can you expand on why you think int3 is missing here?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/103925] Missing int3 in ix86_output_indirect_function_return
  2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
  2022-01-06  2:47 ` [Bug target/103925] " pinskia at gcc dot gnu.org
@ 2022-01-06  2:54 ` hjl.tools at gmail dot com
  2022-01-06  2:56 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-06  2:54 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> >	jmp	*%rcx <<<< Missing int3
> 
> 
> Can you expand on why you think int3 is missing here?

-mharden-sls=all should generate INT3 after indirect jmp.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/103925] Missing int3 in ix86_output_indirect_function_return
  2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
  2022-01-06  2:47 ` [Bug target/103925] " pinskia at gcc dot gnu.org
  2022-01-06  2:54 ` hjl.tools at gmail dot com
@ 2022-01-06  2:56 ` pinskia at gcc dot gnu.org
  2022-01-06 19:53 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-06  2:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The bug is in ix86_output_indirect_function_return.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/103925] Missing int3 in ix86_output_indirect_function_return
  2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2022-01-06  2:56 ` pinskia at gcc dot gnu.org
@ 2022-01-06 19:53 ` cvs-commit at gcc dot gnu.org
  2022-01-06 20:12 ` hjl.tools at gmail dot com
  2022-02-16 14:01 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-06 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:c2e5c4feed32c808591b5278f680bbabe63eb225

commit r12-6321-gc2e5c4feed32c808591b5278f680bbabe63eb225
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jan 5 18:04:21 2022 -0800

    x86: Generate INT3 for __builtin_eh_return

    Generate INT3 after indirect jmp in exception return for -fcf-protection
    with -mharden-sls=indirect-jmp.

    gcc/

            PR target/103925
            * config/i386/i386.c (ix86_output_indirect_function_return):
            Generate INT3 after indirect jmp for -mharden-sls=indirect-jmp.

    gcc/testsuite/

            PR target/103925
            * gcc.target/i386/harden-sls-6.c: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/103925] Missing int3 in ix86_output_indirect_function_return
  2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2022-01-06 19:53 ` cvs-commit at gcc dot gnu.org
@ 2022-01-06 20:12 ` hjl.tools at gmail dot com
  2022-02-16 14:01 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-06 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |12.0

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/103925] Missing int3 in ix86_output_indirect_function_return
  2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2022-01-06 20:12 ` hjl.tools at gmail dot com
@ 2022-02-16 14:01 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-16 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:978956485a663493130b02f787095095d163290e

commit r11-9578-g978956485a663493130b02f787095095d163290e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jan 5 18:04:21 2022 -0800

    x86: Generate INT3 for __builtin_eh_return

    Generate INT3 after indirect jmp in exception return for -fcf-protection
    with -mharden-sls=indirect-jmp.

    gcc/

            PR target/103925
            * config/i386/i386.c (ix86_output_indirect_function_return):
            Generate INT3 after indirect jmp for -mharden-sls=indirect-jmp.

    gcc/testsuite/

            PR target/103925
            * gcc.target/i386/harden-sls-6.c: New test.

    (cherry picked from commit c2e5c4feed32c808591b5278f680bbabe63eb225)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-02-16 14:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06  2:03 [Bug target/103925] New: Missing int3 in ix86_output_indirect_function_return hjl.tools at gmail dot com
2022-01-06  2:47 ` [Bug target/103925] " pinskia at gcc dot gnu.org
2022-01-06  2:54 ` hjl.tools at gmail dot com
2022-01-06  2:56 ` pinskia at gcc dot gnu.org
2022-01-06 19:53 ` cvs-commit at gcc dot gnu.org
2022-01-06 20:12 ` hjl.tools at gmail dot com
2022-02-16 14:01 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).