public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/106288] New: stack protector fails to check stack canary for noreturn function
@ 2022-07-13 22:47 hjl.tools at gmail dot com
  2022-07-13 22:49 ` [Bug middle-end/106288] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: hjl.tools at gmail dot com @ 2022-07-13 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106288
           Summary: stack protector fails to check stack canary for
                    noreturn function
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

[hjl@gnu-tgl-3 stack-protector]$ cat x.c
extern void foo (void) __attribute__ ((noreturn));

void
bar (void)
{
  foo ();
}
[hjl@gnu-tgl-3 stack-protector]$
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -O2
-Wall -fstack-protector-all -S x.c
[hjl@gnu-tgl-3 stack-protector]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  bar
        .type   bar, @function
bar:
.LFB0:
        .cfi_startproc
        subq    $24, %rsp
        .cfi_def_cfa_offset 32
        movq    %fs:40, %rax
        movq    %rax, 8(%rsp)
        xorl    %eax, %eax
        call    foo
        .cfi_endproc
.LFE0:
        .size   bar, .-bar
        .ident  "GCC: (GNU) 13.0.0 20220713 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-3 stack-protector]$ 

There should be a stack canary check before calling foo since foo won't return.

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

* [Bug middle-end/106288] stack protector fails to check stack canary for noreturn function
  2022-07-13 22:47 [Bug middle-end/106288] New: stack protector fails to check stack canary for noreturn function hjl.tools at gmail dot com
@ 2022-07-13 22:49 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-13 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 58245.

*** This bug has been marked as a duplicate of bug 58245 ***

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

end of thread, other threads:[~2022-07-13 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 22:47 [Bug middle-end/106288] New: stack protector fails to check stack canary for noreturn function hjl.tools at gmail dot com
2022-07-13 22:49 ` [Bug middle-end/106288] " pinskia 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).