[Bug sanitizer/89323] New: Asan memory leak detection on x86 platform

2019-02-12 Thread ganeshemb at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89323

Bug ID: 89323
   Summary: Asan memory leak detection on x86 platform
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ganeshemb at gmail dot com
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, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Hi,

Asan memory leak detection does not seem to on x86 platform.

Sample C program with memory leak

cat asantest.c

#include 
#include 
#include 

int main (int argc, char *argv[])
{
char *name = (char*) malloc(10);
strcpy(name, argv[1]);
printf("Hello, %s!\n", name);
return 0;
}


`gcc -g -m32 -fsanitize=address -fno-omit-frame-pointer asantest.c -o santest`

```
objdump -a asantest

asantest: file format elf32-i386
```
```
 ldd asantest
linux-gate.so.1 (0xf778a000)
libasan.so.3 => /usr/lib32/libasan.so.3 (0xf71e)
```
```
gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 
```
when program run as shown below , no leaks were detected.

```
./asantest world
Hello, world!
```
when program run with ASAN_OPTIONS , following error is shown.

```
ASAN_OPTIONS=detect_leaks=1 ./asantest world
==8192==AddressSanitizer: detect_leaks is not supported on this platform.
```
My system info

```
 lscpu
Architecture:  x86_64
CPU op-mode(s):32-bit, 64-bit
```
```
uname -r
4.9.0-8-amd64
```

works for current clang:

clang-6.0 -g -fsanitize=address -fno-omit-frame-pointer -m32  asantest.c  &&
./a.out 

AddressSanitizer:DEADLYSIGNAL
=
==6318==ERROR: AddressSanitizer: SEGV on unknown address 0x (pc
0xf74f2a66 bp 0xfff26cb8 sp 0xfff26854 T0)



Thanks in advance.

[Bug sanitizer/89323] Asan memory leak detection on x86 platform

2019-02-13 Thread ganeshemb at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89323

--- Comment #4 from Ganesh Babu  ---
(In reply to Martin Liška from comment #2)
> I can confirm that LSAN does not work for -m32 on current trunk. It was
> enabled in:
> 
> commit 1e39eaad45fc92b49e189badf0a5a675fbfb4ad0
> Author: Francis Ricci 
> Date:   Tue Mar 28 21:56:44 2017 +
> 
> Enable i386 builds for darwin lsan
> 
> Summary:
> Now that __thread is no longer used for lsan on darwin, i386 builds
> can be enabled.
> 
> Reviewers: kcc, kubamracek
> 
> Subscribers: danalbert, srhines, mgorny, llvm-commits
> 
> Differential Revision: https://reviews.llvm.org/D29995
> 
> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298946
> 91177308-0d34-0410-b5e6-96231b3b80d8

Hi,



[Bug sanitizer/89323] Asan memory leak detection on x86 platform

2019-02-13 Thread ganeshemb at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89323

--- Comment #5 from Ganesh Babu  ---
(In reply to Martin Liška from comment #3)
> > works for current clang:
> > 
> > clang-6.0 -g -fsanitize=address -fno-omit-frame-pointer -m32  asantest.c  &&
> > ./a.out 
> > 
> > AddressSanitizer:DEADLYSIGNAL
> > =
> > ==6318==ERROR: AddressSanitizer: SEGV on unknown address 0x (pc
> > 0xf74f2a66 bp 0xfff26cb8 sp 0xfff26854 T0)
> > 
> > 
> 
> No, you forgot to provide ./a.out argument. That's why you see a SEGV.
> Please try latest clang release (7) and test it. If it's failing, please
> report upstream bug https://github.com/google/sanitizers/issues.

i have raised a request at https://github.com/google/sanitizers/issues/1049