svadev AT lists.siebelschool.illinois.edu
Subject: Svadev mailing list
List archive
- From: Baozeng <sploving1 AT gmail.com>
- To: John Criswell <criswell AT illinois.edu>
- Cc: svadev AT cs.illinois.edu
- Subject: Re: [svadev] BBC test issue
- Date: Thu, 14 Jun 2012 16:06:32 +0800
- List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev>
- List-id: <svadev.cs.uiuc.edu>
2012/6/14 John Criswell
<criswell AT illinois.edu>:
> On 6/13/12 8:37 AM, Baozeng wrote:
>>
>> Hello,
>> I use current BBC implementation to test an example (buffer.c):
>>
>> #include<stdio.h>
>> #include<stdlib.h>
>>
>> int main (int argc, char ** argv) {
>> char array[17];
>> return array[17];
>> }
>>
>> $ clang -g -fmemsafety -bbc buffer.c -o mytest
>> -L/home/sploving/llvm/projects/safecode/Debug/lib
>> $ ./mytest
>>
>> It output this:
>> 0xbfd00b9b, 0xbfd00b80, 17 Not aligned
>>
>> This related code is in the function __internal_register in
>> BaggyBoundsCheck.cpp:
>>
>> if(Source1 != Source) {
>> printf("%p, %p, %u Not aligned\n", (void*)Source, (void*)Source1,
>> NumBytes);
>> assert(0&& "Memory objects not aligned");
>> }
>
>
> I think the problem is that the stack object being registered isn't aligned
> on a power-of-two boundary like it should be.
>
yep.
I debugged and found that the function adjustAlloca is not called.
I inserted some printf statement in the following function:
void
InsertBaggyBoundsChecks::adjustAllocasFor (Function * F) {
//
// If there is no such function, do nothing.
//
if (!F) return;
printf("test1\n"); // It output!
//
// Scan through all uses of the function and process any allocas used by it.
//
for (Value::use_iterator FU = F->use_begin(); FU != F->use_end(); ++FU) {
printf("test2\n"); // It does not ouput!
if (CallInst * CI = dyn_cast<CallInst>(*FU)) {
printf("test3\n"); // It does not ouput!
Value * Ptr = CI->getArgOperand(2)->stripPointerCasts();
if (AllocaInst * AI = dyn_cast<AllocaInst>(Ptr)){
adjustAlloca (AI);
printf("test4\n"); // It does not ouput!
}
}
}
return;
}
Only test1 was printed out. So the statements in the for loop are not
executed. why?
> Does the transform that does that work yet? If so, then maybe something
> else is causing the problem (like the poolargvregister() function).
>
> -- John T.
>
>>
>> Source1 should be equal with Source if Source satisfy some conditions.
>> What conditions should Source satisfy? Maybe this is related to pool
>> handler? How to fix this?
>>
>>
>>
>>
>
--
Best Regards,
Baozeng Ding
OSTG,NFS,ISCAS
- [svadev] BBC test issue, Baozeng, 06/13/2012
- Re: [svadev] BBC test issue, John Criswell, 06/13/2012
- Re: [svadev] BBC test issue, Baozeng, 06/14/2012
- Re: [svadev] BBC test issue, John Criswell, 06/14/2012
- Re: [svadev] BBC test issue, Baozeng, 06/14/2012
- Re: [svadev] BBC test issue, John Criswell, 06/13/2012
Archive powered by MHonArc 2.6.16.