This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] Inline asm asan instrumentation


>> asm-struct-1.c test looks like a false positive though - the code does not access any invalid memory, it only does a harmless pointer cast.

It is not. Because st1 have smaller size than st2:

struct st1 {
   int a[110];
}
struct st2 {
   int a[111];
};

And asm constrain was declared as: 

: "=m" (*((struct st2 *)&s1)));

Test violate memory access constrain by cast (struct st2 *)&s1. 
We check only constraints and by such a cast as we think user declare that he want to access full st2 structure which have bigger size than st1. 

-----Original Message-----
From: Evgeniy Stepanov [mailto:eugeni.stepanov@gmail.com] 
Sent: Thursday, May 29, 2014 1:58 PM
To: Konstantin Serebryany
Cc: Marat Zakirov; GCC Patches; Konstantin Serebryany; Jakub Jelinek; Viacheslav Garbuzov; Yuri Gribov; Marat Zakirov
Subject: Re: [PATCH] Inline asm asan instrumentation

Cool, we don't have this in LLVM-ASan, but we have plans to instrument inline asm soon (not just constraints).

asm-struct-1.c test looks like a false positive though - the code does not access any invalid memory, it only does a harmless pointer cast.


On Wed, May 28, 2014 at 10:36 PM, Konstantin Serebryany <konstantin.s.serebryany@gmail.com> wrote:
> On Wed, May 28, 2014 at 5:33 PM, Marat Zakirov <m.zakirov@samsung.com> wrote:
>> Hi all,
>>
>> Here's a patch for optional Asan instrumentation of inline assembly.
>>
>> This version scans gimple for GIMPLE_ASMs and performs usual 
>> instrumentation of arguments with memory constraints ("m", "o", etc.) with fixed size.
>>
>> Instrumentation is turned off by default.
>>
>> This was successfully bootstrapped and regtested on x64. I have also 
>> instrumented and ran ffmpeg regression testsuite (it seems to have 
>> quite some inline asm).
>>
>> --Marat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]