public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc
@ 2014-07-03 23:01 larsbj at gullik dot net
  2014-07-04  6:55 ` [Bug sanitizer/61693] " kcc at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: larsbj at gullik dot net @ 2014-07-03 23:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61693
           Summary: [asan] is not intercepting aligned_alloc
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: larsbj at gullik dot net
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

cat aligned_alloc.c
#include <stdlib.h>

int main(void)
{
  void * p = aligned_alloc(128, 1024);
  free(p);
}

$ gcc -std=c11 -fsanitize=address aligned_alloc.c && ./a.out 
=================================================================
==28341==ERROR: AddressSanitizer: attempting free on address which was not
malloc()-ed: 0x000000728080 in thread T0
    #0 0x7fa78060d2d7 in __interceptor_free
../../../../gcc/libsanitizer/asan/asan_malloc_linux.cc:62
    #1 0x40077e in main (/home/lgb/Development/test/a.out+0x40077e)
    #2 0x31c0821d64 in __libc_start_main (/lib64/libc.so.6+0x31c0821d64)
    #3 0x400688 (/home/lgb/Development/test/a.out+0x400688)

AddressSanitizer can not describe address in more detail (wild memory access
suspected).
SUMMARY: AddressSanitizer: bad-free
../../../../gcc/libsanitizer/asan/asan_malloc_linux.cc:62 __interceptor_free
==28341==ABORTING


AFAICS the asan interceptor for aligned_alloc is missing.


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

* [Bug sanitizer/61693] [asan] is not intercepting aligned_alloc
  2014-07-03 23:01 [Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc larsbj at gullik dot net
@ 2014-07-04  6:55 ` kcc at gcc dot gnu.org
  2014-07-04  7:17 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kcc at gcc dot gnu.org @ 2014-07-04  6:55 UTC (permalink / raw)
  To: gcc-bugs

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

Kostya Serebryany <kcc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-07-04
           Assignee|unassigned at gcc dot gnu.org      |kcc at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
Interesting. This is a relatively new c11 feature. 
On older Linux distros this does not compile nor link:

aligned_alloc.c: In function ‘main’:
aligned_alloc.c:5:3: warning: implicit declaration of function ‘aligned_alloc’
[-Wimplicit-function-declaration]
   void * p = aligned_alloc(128, 1024);
...
/tmp/ccJJcsqx.o: In function `main':
aligned_alloc.c:(.text+0x13): undefined reference to `aligned_alloc'

On Ubuntu 14.04 it behaves as you describe and indeed we need to add an
interceptor. The tricky part is to add a test that will work on older distros
>From gcc-bugs-return-455624-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 04 07:04:10 2014
Return-Path: <gcc-bugs-return-455624-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18765 invoked by alias); 4 Jul 2014 07:04:09 -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 18706 invoked by uid 48); 4 Jul 2014 07:04:06 -0000
From: "manuel.lauss at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61654] [4.9/4.10 Regression] ICE in release_function_body, at cgraph.c:1699
Date: Fri, 04 Jul 2014 07:04:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manuel.lauss at googlemail dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.1
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61654-4-Anw13i3Rtk@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61654-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61654-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: 2014-07/txt/msg00215.txt.bz2
Content-length: 636

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

--- Comment #4 from Manuel Lauss <manuel.lauss at googlemail dot com> ---
The patch shifted the ICE to the following, same source file:

In file included from ./engines/tony/input.h:32:0,
                 from engines/tony/font.cpp:32:
./common/events.h:239:7: internal compiler error: in ipa_propagate_frequency,
at ipa-profile.c:411
 class DefaultEventMapper : public EventMapper {
       ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions.
Makefile.common:98: recipe for target 'engines/tony/font.o' failed


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

* [Bug sanitizer/61693] [asan] is not intercepting aligned_alloc
  2014-07-03 23:01 [Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc larsbj at gullik dot net
  2014-07-04  6:55 ` [Bug sanitizer/61693] " kcc at gcc dot gnu.org
@ 2014-07-04  7:17 ` jakub at gcc dot gnu.org
  2014-07-04  7:23 ` kcc at gcc dot gnu.org
  2014-07-04  7:43 ` kcc at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-07-04  7:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Just declare it yourself?  If libasan always contains the aligned_alloc symbol,
then the testcase will link even when system glibc does not contain it...


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

* [Bug sanitizer/61693] [asan] is not intercepting aligned_alloc
  2014-07-03 23:01 [Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc larsbj at gullik dot net
  2014-07-04  6:55 ` [Bug sanitizer/61693] " kcc at gcc dot gnu.org
  2014-07-04  7:17 ` jakub at gcc dot gnu.org
@ 2014-07-04  7:23 ` kcc at gcc dot gnu.org
  2014-07-04  7:43 ` kcc at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kcc at gcc dot gnu.org @ 2014-07-04  7:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
yep, that's the plan...


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

* [Bug sanitizer/61693] [asan] is not intercepting aligned_alloc
  2014-07-03 23:01 [Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc larsbj at gullik dot net
                   ` (2 preceding siblings ...)
  2014-07-04  7:23 ` kcc at gcc dot gnu.org
@ 2014-07-04  7:43 ` kcc at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kcc at gcc dot gnu.org @ 2014-07-04  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

Kostya Serebryany <kcc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eugeni.stepanov at gmail dot com,
                   |                            |glider at google dot com,
                   |                            |timurrrr at google dot com

--- Comment #4 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
http://llvm.org/viewvc/llvm-project?view=revision&revision=212322 implements 
aligned_alloc support on Linux.
I will let others implement Android/Windows/Mac support if relevant.

This will reach GCC with the next libsanitizer merge (not sure when), 
or feel free to cherry pick in a couple of days (to make sure it works well)


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

end of thread, other threads:[~2014-07-04  7:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03 23:01 [Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc larsbj at gullik dot net
2014-07-04  6:55 ` [Bug sanitizer/61693] " kcc at gcc dot gnu.org
2014-07-04  7:17 ` jakub at gcc dot gnu.org
2014-07-04  7:23 ` kcc at gcc dot gnu.org
2014-07-04  7:43 ` kcc 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).