<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Debug on Inliniac</title>
    <link>https://inliniac.net/blog/tag/debug/</link>
    <description>Recent content in Debug on Inliniac</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 23 Dec 2014 15:34:23 +0000</lastBuildDate>
    <atom:link href="https://inliniac.net/blog/tag/debug/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Profiling Suricata with JEMALLOC</title>
      <link>https://inliniac.net/blog/2014/12/23/profiling-suricata-with-jemalloc/</link>
      <pubDate>Tue, 23 Dec 2014 15:34:23 +0000</pubDate>
      <guid>https://inliniac.net/blog/2014/12/23/profiling-suricata-with-jemalloc/</guid>
      <description>&lt;p&gt;JEMALLOC is a memory allocation library: &lt;a href=&#34;http://www.canonware.com/jemalloc/&#34;&gt;http://www.canonware.com/jemalloc/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It offers many interesting things for a tool like Suricata. Ken Steele of EZchip (formerly Tilera) &lt;a href=&#34;https://github.com/inliniac/suricata/pull/1233&#34;&gt;made me aware of it&lt;/a&gt;. In Ken&amp;rsquo;s testing it helps performance.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Install&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wget http:&lt;span style=&#34;color:#f92672&#34;&gt;//&lt;/span&gt;www&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;canonware&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;com&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;download&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;jemalloc&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;jemalloc&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;3.6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0.&lt;/span&gt;tar&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tar xvfj jemalloc&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;3.6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0.&lt;/span&gt;tar&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd jemalloc&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;3.6&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;./&lt;/span&gt;configure &lt;span style=&#34;color:#f92672&#34;&gt;--&lt;/span&gt;prefix&lt;span style=&#34;color:#f92672&#34;&gt;=/&lt;/span&gt;opt&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;jemalloc&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;make&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo make install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then use it by preloading it:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;LD_PRELOAD=/opt/jemalloc/lib/libjemalloc.so ./src/suricata -c suricata.yaml -l tmp/ -r ~/sync/pcap/sandnet.pcap -S emerging-all.rules -v&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I haven&amp;rsquo;t benchmarked this, but if you&amp;rsquo;re running a high performance setup it may certainly be worth a shot.&lt;/p&gt;</description>
    </item>
    <item>
      <title>detecting: malloc(-1) or malloc(0xffffffff)</title>
      <link>https://inliniac.net/blog/2014/09/17/detecting-malloc-1-or-malloc0xffffffff/</link>
      <pubDate>Wed, 17 Sep 2014 17:25:16 +0000</pubDate>
      <guid>https://inliniac.net/blog/2014/09/17/detecting-malloc-1-or-malloc0xffffffff/</guid>
      <description>&lt;p&gt;In Suricata we&amp;rsquo;re often not printing malloc errors. The reason is that we&amp;rsquo;re not willing to print such errors based on (attacker controlled) traffic. So often such cases are silently handled.&lt;/p&gt;&#xA;&lt;p&gt;We came across a bug though, where a integer underflow led to -1/0xffffffff being passed to malloc. Luckily, malloc just failed by returning NULL, and this return was properly handled. Still, passing such a large value to malloc is a bug, so I would like to catch it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Suricata debugging</title>
      <link>https://inliniac.net/blog/2010/01/04/suricata-debugging/</link>
      <pubDate>Mon, 04 Jan 2010 14:51:54 +0000</pubDate>
      <guid>https://inliniac.net/blog/2010/01/04/suricata-debugging/</guid>
      <description>&lt;p&gt;If you&amp;rsquo;re running into issues with Suricata, it may be worth spending some time looking at the debugging options.&lt;/p&gt;&#xA;&lt;p&gt;To enable the debugging code, pass &amp;ldquo;&amp;ndash;enable-debug&amp;rdquo; to configure.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;./configure &amp;ndash;enable-debug&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;And make &amp;amp; make install again. Make sure that during compilation you see -DDEBUG in the gcc commands.&lt;/p&gt;&#xA;&lt;p&gt;Then to really enable it at runtime, pass the SC_LOG_LEVEL&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;SC_LOG_LEVEL=Debug&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;Depending on how you run the engine, this will output massive amounts of debugging info. Thats why we added a pcre regex filter option.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
