[GSoC'16] Weekly Status - August 1 - Zhengyang Liu

Dear LLVM and SVA community:

This is to brief you the progress of this week. Following is what I
finished this week:

1. The InlineBBRuntimeFunctions pass I implemented last week does not
support for inline a function call with one or more users. I directly
copied the InlineFunction()functionfrom InlineFastChecks pass. This will
not inline functions like boundscheckui(), which the return values will
be used in the follow-up instructions. I solved it [1].

2. Previously I made the RewriteOOB pass insert a pchk_getActualValue()
call before each GEP [3], this does not support getelementptr call whose
operand is a vector. I solved this issue [2].

3. Tested the current implementation on git.

  * Found a bug: the fastlscheck_debug() and exactcheck2_debug()
function do not handle the situation that the input argument length
equals 0, and generates some false positives reports. We have met this
on poolcheckui_debug() and boundscheck_debug().

  * After some further investigation, I found that our implementation
could correctly external allocated memories(by checking if the
corresponding baggy bounds table element is 0). The bug I mentioned last
week is because of a special function: getdelim(). According to [3] , If
the buffer is not large enough to hold the line, getdelim() resizes it
with realloc(). This realloc() is called externally and is not
unregistered and registered. I guess the best way to solve this problem
is just write a wrapper function for getline() and getdelim(). After
this, our implementation could pass all the git test suite.

  * The new pass InlineGetActualValue pass brings some new false
positive reports, I am finding why that happened, it is complicated and
I have not found the bug yet.

4. Learned profiling tool gprof and profiled the generated executables.

Best regards,

Zhengyang.

[1]
https://github.com/zhengyangl/safecode-llvm37/commit/58c2b3fd6a50899b8687e73444251675ad04c350

[2]
https://github.com/zhengyangl/safecode-llvm37/commit/be65cbaa7bce2acf5a9afde0e6b29b5e13b215a5

[3] http://pubs.opengroup.org/onlinepubs/9699919799/functions/getdelim.html