public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39218]  New: a surprising instance of -fstack-protector not protecting
@ 2009-02-17 18:58 paul at g225066096 dot adsl dot alicedsl dot de
  2009-02-17 19:09 ` [Bug c/39218] " pinskia at gcc dot gnu dot org
  2009-04-16 20:43 ` [Bug middle-end/39218] " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: paul at g225066096 dot adsl dot alicedsl dot de @ 2009-02-17 18:58 UTC (permalink / raw)
  To: gcc-bugs

$ cc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/gcc
Thread model: posix
gcc version 4.3.3 (GCC)
$ echo 'void f(void) { char buf[50]; g(buf); }' > 1.c
$ echo 'void f(void) { int buf[50]; g(buf); }' > 2.c
$ cc -fstack-protector -c 1.c  # protects
$ cc -fstack-protector -c 2.c  # does not protect
$ objdump -d 1.o

1.o:     file format elf32-i386

Disassembly of section .text:

00000000 <f>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   83 ec 48                sub    $0x48,%esp
   6:   65 a1 14 00 00 00       mov    %gs:0x14,%eax
   c:   89 45 fc                mov    %eax,-0x4(%ebp)
   f:   31 c0                   xor    %eax,%eax
  11:   8d 45 ca                lea    -0x36(%ebp),%eax
  14:   89 04 24                mov    %eax,(%esp)
  17:   e8 fc ff ff ff          call   18 <f+0x18>
  1c:   8b 45 fc                mov    -0x4(%ebp),%eax
  1f:   65 33 05 14 00 00 00    xor    %gs:0x14,%eax
  26:   74 05                   je     2d <f+0x2d>
  28:   e8 fc ff ff ff          call   29 <f+0x29>
  2d:   c9                      leave
  2e:   c3                      ret
$ objdump -d 2.o

2.o:     file format elf32-i386

Disassembly of section .text:

00000000 <f>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   81 ec d8 00 00 00       sub    $0xd8,%esp
   9:   8d 85 38 ff ff ff       lea    -0xc8(%ebp),%eax
   f:   89 04 24                mov    %eax,(%esp)
  12:   e8 fc ff ff ff          call   13 <f+0x13>
  17:   c9                      leave
  18:   c3                      ret
$


-- 
           Summary: a surprising instance of -fstack-protector not
                    protecting
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paul at g225066096 dot adsl dot alicedsl dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39218


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

* [Bug c/39218] a surprising instance of -fstack-protector not protecting
  2009-02-17 18:58 [Bug c/39218] New: a surprising instance of -fstack-protector not protecting paul at g225066096 dot adsl dot alicedsl dot de
@ 2009-02-17 19:09 ` pinskia at gcc dot gnu dot org
  2009-04-16 20:43 ` [Bug middle-end/39218] " pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-17 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-02-17 19:08 -------
http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Optimize-Options.html#index-fstack_002dprotector-764

Hmm:
Emit extra code to check for buffer overflows, such as stack smashing attacks.
This is done by adding a guard variable to functions with vulnerable objects.
This includes functions that call alloca, and functions with buffers larger
than 8 bytes. 

Maybe it should say character buffers rather than just buffers here.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39218


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

* [Bug middle-end/39218] a surprising instance of -fstack-protector not protecting
  2009-02-17 18:58 [Bug c/39218] New: a surprising instance of -fstack-protector not protecting paul at g225066096 dot adsl dot alicedsl dot de
  2009-02-17 19:09 ` [Bug c/39218] " pinskia at gcc dot gnu dot org
@ 2009-04-16 20:43 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 20:43 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |documentation
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-16 20:43:45
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39218


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

end of thread, other threads:[~2009-04-16 20:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-17 18:58 [Bug c/39218] New: a surprising instance of -fstack-protector not protecting paul at g225066096 dot adsl dot alicedsl dot de
2009-02-17 19:09 ` [Bug c/39218] " pinskia at gcc dot gnu dot org
2009-04-16 20:43 ` [Bug middle-end/39218] " pinskia at gcc dot gnu dot 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).