PageRenderTime 37ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/blog/2012/09/07/undocumented-features-of-vsa/index.html

https://bitbucket.org/edmcman/edmcman.bitbucket.org
HTML | 330 lines | 193 code | 133 blank | 4 comment | 0 complexity | 4e30134f8d966cc92b00a34a01018a9d MD5 | raw file
  1. <!DOCTYPE html>
  2. <!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
  3. <!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
  4. <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
  5. <head>
  6. <meta charset="utf-8">
  7. <title>Undocumented Features of VSA - Ed's Blog</title>
  8. <meta name="author" content="Ed Schwartz">
  9. <meta name="description" content="As I&#8217;ve written about recently, I&#8217;ve been hacking on VSA. I&#8217;ve been
  10. trying to get to the point where the example in Balakrishnan&# &hellip;">
  11. <!-- http://t.co/dKP3o1e -->
  12. <meta name="HandheldFriendly" content="True">
  13. <meta name="MobileOptimized" content="320">
  14. <meta name="viewport" content="width=device-width, initial-scale=1">
  15. <link rel="canonical" href="http://edmcman.bitbucket.org/blog/2012/09/07/undocumented-features-of-vsa">
  16. <link href="/favicon.png" rel="icon">
  17. <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
  18. <script src="/javascripts/modernizr-2.0.js"></script>
  19. <script src="/javascripts/ender.js"></script>
  20. <script src="/javascripts/octopress.js" type="text/javascript"></script>
  21. <link href="/atom.xml" rel="alternate" title="Ed's Blog" type="application/atom+xml">
  22. <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
  23. <link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
  24. <link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
  25. </head>
  26. <body >
  27. <header role="banner"><hgroup>
  28. <h1><a href="/">Ed's Blog</a></h1>
  29. <h2>A PhD Student's Musings</h2>
  30. </hgroup>
  31. </header>
  32. <nav role="navigation"><ul class="subscription" data-subscription="rss">
  33. <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
  34. </ul>
  35. <form action="http://google.com/search" method="get">
  36. <fieldset role="search">
  37. <input type="hidden" name="q" value="site:edmcman.bitbucket.org" />
  38. <input class="search" type="text" name="q" results="0" placeholder="Search"/>
  39. </fieldset>
  40. </form>
  41. <ul class="main-navigation">
  42. <li><a href="/">Blog</a></li>
  43. <li><a href="/blog/archives">Archives</a></li>
  44. </ul>
  45. </nav>
  46. <div id="main">
  47. <div id="content">
  48. <div>
  49. <article class="hentry" role="article" >
  50. <header>
  51. <h1 class="entry-title">
  52. Undocumented Features of VSA
  53. </h1>
  54. <p class="meta">
  55. <time datetime="2012-09-07T13:57:00-04:00" pubdate data-updated="true">Sep 7<span>th</span>, 2012</time>
  56. &bull; <a rel="bookmark" href="/blog/2012/09/07/undocumented-features-of-vsa/">&infin;</a>
  57. </p>
  58. </header>
  59. <div class="entry-content"><p>As I&#8217;ve written about recently, I&#8217;ve been hacking on VSA. I&#8217;ve been
  60. trying to get to the point where the example in Balakrishnan&#8217;s
  61. dissertation works. I chose this example because I don&#8217;t know of any
  62. others! Below is a snapshot of the example that I started with.</p>
  63. <p><img src="/images/vsa-example.png"></p>
  64. <p>And here are the results that VSA is supposed to be able to infer:</p>
  65. <p><img src="/images/vsa-results.png"></p>
  66. <p>There are several interesting things about these results. First, note
  67. that %edx is bounded, even though it is incremented in a loop. In
  68. contrast, %eax grows to its maximum value. Although %eax approaches
  69. the maximum positive integer, VSA infers that it does not overflow.
  70. That sounds kind of weird, doesn&#8217;t it?</p>
  71. <p>My VSA implementation does not yield the same results. It notices
  72. that %eax is incremented without a direct bound on line 9, and widens
  73. %eax to <code>2^31 - 8</code> at line 7. On line 9, the computation %eax + 8
  74. overflows, and represents any value on the stack. The next loop
  75. iteration, we see weak updates to the whole stack at L1 and line 8,
  76. since %eax represents any stack address.</p>
  77. <p>Somewhere there&#8217;s a hidden assumption in addition of value-sets that
  78. says adding values in non-global regions cannot overflow. This kind
  79. of makes sense, if regions are separated, since the program might
  80. crash. I do not consider this to be a sound assumption, however.
  81. (Programs can handle exceptions&#8230;) Perhaps that is why this
  82. assumption is not explicitly mentioned, or if it is, is so buried that
  83. I could not find it. I expected it to be in the definition of
  84. addition for value-sets, but it&#8217;s not there.</p>
  85. <p>With this assumption/hack, we get the same results as the example
  86. above.</p>
  87. </div>
  88. <footer>
  89. <p class="meta">
  90. <span class="byline author vcard">Posted by <span class="fn">Ed Schwartz</span></span>
  91. <time datetime="2012-09-07T13:57:00-04:00" pubdate data-updated="true">Sep 7<span>th</span>, 2012</time>
  92. </p>
  93. <div class="sharing">
  94. <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://edmcman.bitbucket.org/blog/2012/09/07/undocumented-features-of-vsa/" data-via="edmcman" data-counturl="http://edmcman.bitbucket.org/blog/2012/09/07/undocumented-features-of-vsa/" >Tweet</a>
  95. <div class="g-plusone" data-size="medium"></div>
  96. <div class="fb-like" data-send="true" data-width="450" data-show-faces="false"></div>
  97. </div>
  98. <p class="meta">
  99. <a class="basic-alignment left" href="/blog/2012/08/16/syntax-over-semantics/" title="Previous Post: Syntax over Semantics">&laquo; Syntax over Semantics</a>
  100. <a class="basic-alignment right" href="/blog/2012/09/17/thoughts-on-coq-and-isabelle-slash-hol/" title="Next Post: Thoughts on Coq and Isabelle/HOL">Thoughts on Coq and Isabelle/HOL &raquo;</a>
  101. </p>
  102. </footer>
  103. </article>
  104. <section>
  105. <h1>Comments</h1>
  106. <div id="disqus_thread" aria-live="polite"><noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  107. </div>
  108. </section>
  109. </div>
  110. <aside class="sidebar">
  111. <section>
  112. <h1>Recent Posts</h1>
  113. <ul id="recent_posts">
  114. <li class="post">
  115. <a href="/blog/2014/02/28/foxfipdanet-on-mavericks/">FoxFi/PdaNet on Mavericks</a>
  116. </li>
  117. <li class="post">
  118. <a href="/blog/2013/05/16/experimental-methodology/">My Experimental Methodology</a>
  119. </li>
  120. <li class="post">
  121. <a href="/blog/2013/05/05/coming-to-a-bap-near-you/">Coming to a BAP near you</a>
  122. </li>
  123. <li class="post">
  124. <a href="/blog/2013/03/28/typechecking-fail/">Typechecking fail</a>
  125. </li>
  126. <li class="post">
  127. <a href="/blog/2013/02/27/bap-for-everyone/">BAP for everyone</a>
  128. </li>
  129. </ul>
  130. </section>
  131. <section>
  132. <h1>Latest Tweets</h1>
  133. <ul id="tweets">
  134. <li class="loading">Status updating...</li>
  135. </ul>
  136. <script type="text/javascript">
  137. $.domReady(function(){
  138. getTwitterFeed("edmcman", 4, false);
  139. });
  140. </script>
  141. <script src="/javascripts/twitter.js" type="text/javascript"> </script>
  142. <a href="http://twitter.com/edmcman" class="twitter-follow-button" data-show-count="false">Follow @edmcman</a>
  143. </section>
  144. <section class="googleplus">
  145. <h1>
  146. <a href="https://plus.google.com/101696516705586531824?rel=author">
  147. <img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32">
  148. Google+
  149. </a>
  150. </h1>
  151. </section>
  152. </aside>
  153. </div>
  154. </div>
  155. <footer role="contentinfo"><p>
  156. Copyright &copy; 2014 - Ed Schwartz -
  157. <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
  158. </p>
  159. </footer>
  160. <script type="text/javascript">
  161. var disqus_shortname = 'edmcman';
  162. // var disqus_developer = 1;
  163. var disqus_identifier = 'http://edmcman.bitbucket.org/blog/2012/09/07/undocumented-features-of-vsa/';
  164. var disqus_url = 'http://edmcman.bitbucket.org/blog/2012/09/07/undocumented-features-of-vsa/';
  165. var disqus_script = 'embed.js';
  166. (function () {
  167. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  168. dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
  169. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  170. }());
  171. </script>
  172. <div id="fb-root"></div>
  173. <script>(function(d, s, id) {
  174. var js, fjs = d.getElementsByTagName(s)[0];
  175. if (d.getElementById(id)) {return;}
  176. js = d.createElement(s); js.id = id;
  177. js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";
  178. fjs.parentNode.insertBefore(js, fjs);
  179. }(document, 'script', 'facebook-jssdk'));</script>
  180. <script type="text/javascript">
  181. (function() {
  182. var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
  183. script.src = 'https://apis.google.com/js/plusone.js';
  184. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
  185. })();
  186. </script>
  187. <script type="text/javascript">
  188. (function(){
  189. var twitterWidgets = document.createElement('script');
  190. twitterWidgets.type = 'text/javascript';
  191. twitterWidgets.async = true;
  192. twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
  193. document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
  194. })();
  195. </script>
  196. </body>
  197. </html>