<div dir="ltr"><div class="gmail_quote">On Mon, Mar 16, 2015 at 6:45 PM Bhargava Shastry <<a href="mailto:bshastry@sec.t-labs.tu-berlin.de">bshastry@sec.t-labs.tu-berlin.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Clang analyzer's checker dev page [1] talks of Clang SA being able to<br>
track state of symbolic expressions and symbolic memory regions. Do<br>
these concepts map to stack variables/expressions and heap<br>
variables/expressions respectively?<br></blockquote><div><br></div><div>AFAIU symbolic regions are regions that the analyzer considers to be constant and thus representable purely by the expression that generates them, while memory regions basically modeling memory - both stack and heap.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For a construed example shown below, SA did not warn about comparison<br>
against garbage value on Line 16. I concluded that, it's because Clang<br>
SA doesn't reason about the program heap but wanted to make sure I'm not<br>
looking at it superficially or drawing the wrong conclusion.<br>
<br>
1. class bar {<br>
2. public:<br>
3.         bar() {}<br>
4.         int m_x;<br>
5. };<br>
6.<br>
7. class foo {<br>
8. public:<br>
9.         foo() { ptrToBarObj = new bar(); }<br>
10.        void method();<br>
11.        int m_y;<br>
12.        bar *ptrToBarObj;<br>
13. };<br>
14.<br>
15. void foo::method() {<br>
16.         if((ptrToBarObj->m_x > 0))<br>
17.          m_y = 0;<br>
18. }<br></blockquote><div><br></div><div>How can you prove a comparison against garbage value from that code? Seems like somebody can set m_x to anything between the constructor and the call to method.</div><div>If you want to catch this, you'll at least need:</div><div>void f() {</div><div>  foo f;</div><div>  f.method();</div><div>}</div><div>... and then the SA needs to "inline" both the call to the constructor and the method call to see the problem.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
[1]: <a href="http://clang-analyzer.llvm.org/checker_dev_manual.html" target="_blank">http://clang-analyzer.llvm.<u></u>org/checker_dev_manual.html</a><br>
<br>
Regards,<br>
Bhargava<br>
<br>
--<br>
Learn more about COSADE 2015, the 6th Conference on<br>
Constructive Side Channel Analysis and Secure Design<br>
<a href="http://www.cosade.org" target="_blank">http://www.cosade.org</a><br>
<br>
Bhargava Shastry <<a href="mailto:bshastry@sec.t-labs.tu-berlin.de" target="_blank">bshastry@sec.t-labs.tu-<u></u>berlin.de</a>><br>
Security in Telecommunications<br>
TU Berlin / Telekom Innovation Laboratories<br>
Ernst-Reuter-Platz 7, Sekr TEL 17 / D - 10587 Berlin, Germany<br>
phone: +49 30 8353 58235<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>