This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc addresssanitizer in MIPS
- From: Jean Lee <xiaoyur347 at gmail dot com>
- To: Yury Gribov <y dot gribov at samsung dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Evgeny Gavrin <e dot gavrin at samsung dot com>, GarbuzovViacheslav <v dot garbuzov at samsung dot com>
- Date: Tue, 29 Oct 2013 16:10:18 +0800
- Subject: Re: gcc addresssanitizer in MIPS
- Authentication-results: sourceware.org; auth=none
- References: <526F3EDB dot 1030704 at samsung dot com> <526F4128 dot 1030701 at samsung dot com>
Hi Yury, try to use the patch for asan.c to see if it solve your problem.
pinskia, thank you. I compiled asan with libssp which mean the stack grows down.
I disassembled the compiled code and debuged the bin time to time
before I thought it was a bug.early this month.
I tried GCC 4.8.1 and GCC 4.9 snapshot 20130930.
Moreover I never see this problem when I use GCC 4.8 i386.
My test was to use attached time.cpp for asan test. And I found the
shadow memory was not cleared for variable tim (shadow memory address
range 0x2ea1f783-0x2ea1f788) and a strange "f4" lived in it.
0x2ea1f730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2ea1f740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2ea1f750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2ea1f760: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1
0x2ea1f770: f1 f1 f1 04 f4 f4 f4 f2 f2 f2 f2 00 04 f4 f4 f2
=>0x2ea1f780: f2 f2 f2[00]00 00 f4 00 04 f4 f4 f3 f3 f3 f3 00
0x2ea1f790: 00 00 00 00 00 00 f1 f1 f1 f1 04 f4 f4 f4 f2 f2
0x2ea1f7a0: f2 f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00
0x2ea1f7b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2ea1f7c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2ea1f7d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2013/10/29 Yury Gribov <y.gribov@samsung.com>:
>> Yes, we do see this error on ARM.
>
> Here is another instance of the same bug:
> http://permalink.gmane.org/gmane.comp.debugging.address-sanitizer/531
>
>
>> Full description and suggested patch are available at
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58543
>> I'm curious whether suggested patch is going to work for Andrew.
>
> -Y
>
>
>
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
static int GetDataAndTimeString(char* pszTime,unsigned int nLen)
{
if ( NULL != pszTime )
{
time_t b_time;
struct tm tim;
b_time=time(NULL);
localtime_r(&b_time, &tim);
struct timeb timebuffer;
ftime( &timebuffer );
snprintf(pszTime,nLen,"%d/%02d/%02d %02d:%02d:%02d.%03d",
tim.tm_year+1900,tim.tm_mon+1,tim.tm_mday,
tim.tm_hour,tim.tm_min,tim.tm_sec,timebuffer.millitm);
return 0;
}
return -1;
}
int main()
{
char szDate[32] = {0};
GetDataAndTimeString(szDate,sizeof(szDate));
return 0;
}