public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced  heap-use-after-free
@ 2015-09-07 14:47 zeccav at gmail dot com
  2015-09-15  7:44 ` [Bug target/67484] " ubizjak at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zeccav at gmail dot com @ 2015-09-07 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67484
           Summary: options-save.c sanitizer asan detects freed storage
                    referenced  heap-use-after-free
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com
  Target Milestone: ---

//g++ references freed storage
//sanitizer message: heap-use-after-free
//referenced at options-save.c:3556 "|| strcmp (ptr1->x_ix86_arch_string,
ptr2->x_ix86_arch_string)))" 
//ptr1->x_ix86_arch_string was freed at gcc/config/i386/i386.c:5020 "free
(option_strings[i]);"
//to make happy the sanitizer I commented out the for loop in i386.c lines
5019-5020
//// Target: x86_64-unknown-linux-gnu
int fum () __attribute__ ((target("default")));
int fum () __attribute__ ((target("arch=core2")));
int j = fum();


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

* [Bug target/67484] options-save.c sanitizer asan detects freed storage referenced  heap-use-after-free
  2015-09-07 14:47 [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced heap-use-after-free zeccav at gmail dot com
@ 2015-09-15  7:44 ` ubizjak at gmail dot com
  2015-09-15 10:09 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2015-09-15  7:44 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gnu@the-meissners.org

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
CC author.
>From gcc-bugs-return-497220-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 15 08:00:51 2015
Return-Path: <gcc-bugs-return-497220-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 88590 invoked by alias); 15 Sep 2015 08:00:50 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 88502 invoked by uid 48); 15 Sep 2015 08:00:42 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/67568] lto-streamer-in.c sanitizer runtime error: load of value 255, which is not a valid value for type 'bool'
Date: Tue, 15 Sep 2015 08:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-67568-4-1bFtTptvMB@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67568-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67568-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01198.txt.bz2
Content-length: 442

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg568

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be fixed now.


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

* [Bug target/67484] options-save.c sanitizer asan detects freed storage referenced  heap-use-after-free
  2015-09-07 14:47 [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced heap-use-after-free zeccav at gmail dot com
  2015-09-15  7:44 ` [Bug target/67484] " ubizjak at gmail dot com
@ 2015-09-15 10:09 ` ubizjak at gmail dot com
  2015-09-15 13:38 ` zeccav at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2015-09-15 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Vittorio Zecca from comment #0)

> //to make happy the sanitizer I commented out the for loop in i386.c lines

      /* Save the current options unless we are validating options for
         #pragma.  */
      t = build_target_option_node (opts);

      opts->x_ix86_arch_string = orig_arch_string;
      opts->x_ix86_tune_string = orig_tune_string;
      opts_set->x_ix86_fpmath = orig_fpmath_set;

      /* Free up memory allocated to hold the strings */
      for (i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
        free (option_strings[i]);

Indeed.  We saved current options in build_target_option_node, where only
*pointers* to strings were saved. We should not free the memory, pointed by the
saved pointer.
>From gcc-bugs-return-497232-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 15 10:12:28 2015
Return-Path: <gcc-bugs-return-497232-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 78188 invoked by alias); 15 Sep 2015 10:12:28 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 78031 invoked by uid 48); 15 Sep 2015 10:12:23 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67584] Compilation is fine if an undeclared identifier is used in a for range-based loop, and lsh has the same name as rhs
Date: Tue, 15 Sep 2015 10:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords: accepts-invalid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-67584-4-bijCXT9epY@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67584-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67584-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01210.txt.bz2
Content-length: 466

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg584

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-15
     Ever confirmed|0                           |1


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

* [Bug target/67484] options-save.c sanitizer asan detects freed storage referenced  heap-use-after-free
  2015-09-07 14:47 [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced heap-use-after-free zeccav at gmail dot com
  2015-09-15  7:44 ` [Bug target/67484] " ubizjak at gmail dot com
  2015-09-15 10:09 ` ubizjak at gmail dot com
@ 2015-09-15 13:38 ` zeccav at gmail dot com
  2015-09-15 18:32 ` ubizjak at gmail dot com
  2015-09-16 16:45 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: zeccav at gmail dot com @ 2015-09-15 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> ---
Uros, I applied your patch and the sanitizer message disappeared.
Is this still an UNCONFIRMED bug?


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

* [Bug target/67484] options-save.c sanitizer asan detects freed storage referenced  heap-use-after-free
  2015-09-07 14:47 [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced heap-use-after-free zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2015-09-15 13:38 ` zeccav at gmail dot com
@ 2015-09-15 18:32 ` ubizjak at gmail dot com
  2015-09-16 16:45 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2015-09-15 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-09-15
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
Patch at [1].

[1] https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01116.html
>From gcc-bugs-return-497283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 15 19:30:58 2015
Return-Path: <gcc-bugs-return-497283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 123029 invoked by alias); 15 Sep 2015 19:30:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 122977 invoked by uid 48); 15 Sep 2015 19:30:53 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/67587] [6 Regression] profiledbootstrap failure with --with-build-config=bootstrap-lto
Date: Tue, 15 Sep 2015 19:30:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: segher at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-67587-4-00IgUdc83d@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67587-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67587-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01261.txt.bz2
Content-length: 505

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg587

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Segher Boessenkool from comment #8)
> Could you then reduce the testcase, or something?  Yes I know that is
> inconvenient to do with LTO.  It is also very inconvenient for me to
> set up an environment on x86-64, wait a few hours, and then see if it
> did or did not reproduce your problem.

I sent you a testcase via Google Drive.  Please let me know if you
can reproduce it.


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

* [Bug target/67484] options-save.c sanitizer asan detects freed storage referenced  heap-use-after-free
  2015-09-07 14:47 [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced heap-use-after-free zeccav at gmail dot com
                   ` (3 preceding siblings ...)
  2015-09-15 18:32 ` ubizjak at gmail dot com
@ 2015-09-16 16:45 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2015-09-16 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|ubizjak at gmail dot com           |unassigned at gcc dot gnu.org

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
This should be implemented with garbage collected strings to avoid leaks.

Unassigning, I don't know GCC's garbage collector well.
>From gcc-bugs-return-497352-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Sep 16 17:12:52 2015
Return-Path: <gcc-bugs-return-497352-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 44664 invoked by alias); 16 Sep 2015 17:12:52 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 44595 invoked by uid 48); 16 Sep 2015 17:12:47 -0000
From: "foom at fuhm dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/46942] x86_64 parameter passing unnecessary sign/zero extends
Date: Wed, 16 Sep 2015 17:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: foom at fuhm dot net
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-46942-4-oKpLO2mucS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-46942-4@http.gcc.gnu.org/bugzilla/>
References: <bug-46942-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01330.txt.bz2
Content-length: 1557

https://gcc.gnu.org/bugzilla/show_bug.cgi?idF942

James Y Knight <foom at fuhm dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |foom at fuhm dot net

--- Comment #10 from James Y Knight <foom at fuhm dot net> ---
Well, the ABI doc doesn't appear to say anything about this still.

GCC as of 5.1 seems to still do sign/zero extension of 8/16-bit arguments to
32-bit on the callee side. Clang does not. Both do extension of 32-bit
arguments to 64-bit on the callee side.

Both sign/zero-extend 8/16-bit values to 32-bits, and do /not/ truncate 64-bit
values to 32-bit on the caller side.

So it looks like GCC could still generate more optimal code by taking advantage
of the "de-facto" ABI that lets you assume 32-bit sign/zero-extension has
happened on arguments.

But it'd also be real nice for this all to be actually documented, so there's
something to point people to. :)

BTW: This undocumentedness came up recently with an optimizer change in clang:
libjpeg-turbo has some assembly code which was using the full 64-bit value of
an argument register, assuming the upper bits would be zeroed, while on the C
side, the function was declared as taking an "int". The upper bits are thus
left undefined (as is correct, per the unwritten ABI rules), which broke the
asm.

https://github.com/libjpeg-turbo/libjpeg-turbo/pull/20
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150907/138253.html


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

end of thread, other threads:[~2015-09-16 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-07 14:47 [Bug c++/67484] New: options-save.c sanitizer asan detects freed storage referenced heap-use-after-free zeccav at gmail dot com
2015-09-15  7:44 ` [Bug target/67484] " ubizjak at gmail dot com
2015-09-15 10:09 ` ubizjak at gmail dot com
2015-09-15 13:38 ` zeccav at gmail dot com
2015-09-15 18:32 ` ubizjak at gmail dot com
2015-09-16 16:45 ` ubizjak at gmail dot com

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).