public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/50460] [4.7 Regression] __builtin___strcpy_chk/__builtin_object_size don't work
Date: Tue, 20 Sep 2011 10:49:00 -0000	[thread overview]
Message-ID: <bug-50460-4-NXEr8dz5Dl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50460-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.7.0

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-09-20 09:59:49 UTC ---
Seems to be caused by PR48571, we throw away the important info (that the
access was through a.buf1 rather than &a), which is essential for
-D_FORTIFY_SOURCE=2.
The change happens already during gimplification:
-  strcpy (&a.buf1[4], D.2732);
+  strcpy (&MEM[(void *)&a + 4B], D.2732);
while in *.original it was
  strcpy ((char *) &a.buf1 + 4, str1 + 5);
Not reconstrucing the array ref is fine, but before *.objsz pass we really
shouldn't throw away the buf1 from it, so it should be tmp = &a.buf1 + 4;
-D_FORTIFY_SOURCE=2 cares whether the user wrote
  strcpy ((char *) &a + 4, ...); (in which case it allows to overwrite the
whole object) or strcpy ((char *) &a.buf1 + 4, ...); (in which case it is
allowed to overwrite just the buf1 field).

Richard, can you please have a look at this?


  reply	other threads:[~2011-09-20 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20  8:16 [Bug middle-end/50460] New: " hjl.tools at gmail dot com
2011-09-20 10:49 ` jakub at gcc dot gnu.org [this message]
2011-09-20 13:47 ` [Bug middle-end/50460] " hjl.tools at gmail dot com
2011-09-22 22:06 ` rguenth at gcc dot gnu.org
2011-09-23  8:34 ` jakub at gcc dot gnu.org
2011-09-25 11:24 ` rguenth at gcc dot gnu.org
2011-09-26  9:14 ` jakub at gcc dot gnu.org
2011-09-28 12:29 ` rguenth at gcc dot gnu.org
2011-09-28 13:52 ` rguenth at gcc dot gnu.org
2011-09-28 14:01 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-50460-4-NXEr8dz5Dl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).