Skip to Content.
Sympa Menu

svadev - [svadev] Safecode driving me crazy :( :( :(

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

[svadev] Safecode driving me crazy :( :( :(


Chronological Thread 
  • From: Umesh Kalappa <umesh.kalappa0 AT gmail.com>
  • To: svadev AT cs.uiuc.edu
  • Subject: [svadev] Safecode driving me crazy :( :( :(
  • Date: Thu, 3 May 2012 17:30:27 +0530
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev>
  • List-id: <svadev.cs.uiuc.edu>

Hello Everybody ,

I'm new to the safecode list and myself used valgrind extensively to detect the memory leaks at runtime and came to know about the safecode  project from LLVM IRC,so  thought of  using the same for runtime checks  and here is the steps  followed to compile and install the safecode 

1)Downloaded the latest safecode source from http://safecode.cs.illinois.edu/releases/sc-main.tar.gz 
2)Compiled the source as 
                            a)tar -xvf sc-main.tar.gz
                            b)mkdir build
                            c)cd build 
                            d)../llvm/configure
                            e)cd projects/poolalloc
                            f)make
                            g) cd ../safecode
                            h)make
3)Installed  the respective  binaries and  libs as 
                            a)cd build 
                            b)make install
                            c)cd projects/poolalloc
                            d)make install
                            e)cd ../safecode
                            f)make install

Then,used the  attached test.c to test the installation.but the clang(safecode) drives me crazy with below output
 
          $clang -g -fmemsafety -o test test.c -lsc_dbg_rt -lpoolalloc_bitmap -lstdc++
          $./test 10 

=======+++++++    SAFECODE RUNTIME ALERT +++++++=======
= Error type                            :       Uninitialized/NULL Pointer Error
= Faulting pointer                      :       0xc0000001
= Program counter                       :       0x8
= Fault PC Source                       :       <unknown>:0
SAFECode: Fault!
SAFECode:Violation Type 0x9 when accessing  0xc0000001 at IP=0x8

=======+++++++    SAFECODE RUNTIME ALERT +++++++=======
= Error type                            :       Uninitialized/NULL Pointer Error
= Faulting pointer                      :       0xc0000001
= Program counter                       :       0x8
= Fault PC Source                       :       <unknown>:0
SAFECode: Fault!
SAFECode:Violation Type 0x9 when accessing  0xc0000001 at IP=0x8

=======+++++++    SAFECODE RUNTIME ALERT +++++++=======
= Error type                            :       Uninitialized/NULL Pointer Error
= Faulting pointer                      :       0xc0000001
= Program counter                       :       0x8
= Fault PC Source                       :       <unknown>:0
SAFECode: Fault!
SAFECode:Violation Type 0x9 when accessing  0xc0000001 at IP=0x8

< Running infinite>

for reference 
                [root@localhost simple_player]# clang --version
                 clang version 3.0 (: http://llvm.org/svn/llvm-project/safecode/trunk/tools/clang)
                 Target: x86_64-unknown-linux-gnu
                 Thread model: posix


Please let me know  ,if i'm doing something wrong here  ,which drives the runtime checks crazy or 
if not any lights on the above issue will help me a lot and appreciate the same .In turn it will help me to get output as mentioned in the website for the same test.c sample like 

=======+++++++    SAFECODE RUNTIME ALERT +++++++=======
= Error type                            : Load/Store Error
= Faulting pointer                      : 0x100100679
= Program counter                       : 0x100002493
= Fault PC Source                       : /Users/criswell/tmp/safecode/test/test.c:7
=
= Object allocated at PC                : 0x100002ad6
= Allocated in Source File              : /Users/criswell/tmp/safecode/test/test.c:17
= Object allocation sequence number     : 3
= Object start                          : 0x100100670
= Object length                         : 0x9

Thanks in Advance 
~Umesh 



 #include "stdio.h"
   #include "stdlib.h"
   
   int
   foo (char * bar) {
     for (unsigned index = 0; index < 10; ++index)
       bar[index] = 'a';
     return 0;
   }
  
  int
  main (int argc, char ** argv) {
    char * array[100];
    int max = atoi (argv[1]);
  
    for (int index = max; index >= 0; --index) {
      array[index] = malloc (index+1);
    }
  
    for (int index = max; index >= 0; --index) {
      foo (array[index]);
   }
 
  exit (0);
 }



Archive powered by MHonArc 2.6.16.

Top of Page