Skip to Content.
Sympa Menu

svadev - Re: [svadev] safecode passes

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

Re: [svadev] safecode passes


Chronological Thread 
  • From: Daniel Huang <dan.e.huang AT gmail.com>
  • To: John Criswell <criswell AT illinois.edu>
  • Cc: "<svadev AT cs.illinois.edu>" <svadev AT cs.illinois.edu>
  • Subject: Re: [svadev] safecode passes
  • Date: Thu, 28 Feb 2013 14:13:44 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev/>
  • List-id: <svadev.cs.uiuc.edu>

Great! I guess this also resolves the optimization problem I was seeing since most of the programs were simple enough that all the poolchecks could be removed, leaving only poolfree.

Thanks again, 
Dan


On Thu, Feb 28, 2013 at 1:51 PM, John Criswell <criswell AT illinois.edu> wrote:
On 2/28/13 12:44 PM, John Criswell wrote:
On 2/27/13 10:02 PM, Daniel Huang wrote:
Hi Svadev,

I'm using a version of SAFECode where I have pool-allocation turned on. I've noticed that depending on the input C file, SAFECode sometimes does not write a bitcode file as specified in LTOCodeGenerator.cpp. Furthermore, whenever it does not write the bitcode file, it also does not run my pass (which I have bolded below). I add my pass in LTOCodeGenerator.cpp. 

// Add the automatic pool allocation passes
passes.add(new OptimizeSafeLoadStore());
passes.add(new PA::AllNodesHeuristic());
passes.add(new PoolAllocate());
extern Pass * createPHPass(void);
passes.add(createPHPass());

Some sample inputs where the above happen are (from the SAFECode test/mem_safety directory):
double_free-002.c
double_free-008.c
double_free-011.c

I've also noticed that for any input file, when I turn optimization on (-O1, -O2, -O3), SAFECode does not write the bitcode file. Furthermore, it does not run my pass. Do you have any idea why this behavior occurs or how to fix this so that the bitcode writing and my pass are always run?

I suspect the problem occurs because libLTO believes that there are no SAFECode run-time checks in the program and, as a consequence, it does not run the SAFECode and Poolalloc passes (nor the bitcode writing pass).  For example, double_free-002.c only has poolcheck_free() checks which the libLTO pass (erroneously) considers to not be a run-time check.

A quick fix for you is to modify libLTO so that the SAFECodeUsed flag is always set to true.  That way, even if all the checks are optimized away, you'll get poolalloc running.  I'll try to fix the poolcheck_free() issue today or tomorrow (I've got too many meetings today).

I got it done with 10 minutes to go before the meeting.  Please svn up and give it a spin.

-- John T.





Archive powered by MHonArc 2.6.16.

Top of Page