<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>leodido.dev - C&amp;plus;&amp;plus;</title>
    <subtitle>Leo&#x27;s take on security, eBPF, Linux, kernel, and whatever tech he meets</subtitle>
    <link rel="self" type="application/atom+xml" href="https://leodido.dev/tags/c-plus-plus/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://leodido.dev"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2022-01-10T00:00:00+00:00</updated>
    <id>https://leodido.dev/tags/c-plus-plus/atom.xml</id>
    <entry xml:lang="en">
        <title>bpfcov</title>
        <published>2022-01-10T00:00:00+00:00</published>
        <updated>2022-01-10T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://leodido.dev/projects/bpfcov/"/>
        <id>https://leodido.dev/projects/bpfcov/</id>
        
        <content type="html" xml:base="https://leodido.dev/projects/bpfcov/">&lt;p&gt;This project provides 2 main components:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;libBPFCov.so&lt;&#x2F;code&gt; - an &lt;strong&gt;out-of-tree LLVM pass&lt;&#x2F;strong&gt; to &lt;strong&gt;instrument&lt;&#x2F;strong&gt; your &lt;strong&gt;eBPF programs&lt;&#x2F;strong&gt; for coverage.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;bpfcov&lt;&#x2F;code&gt; - a &lt;strong&gt;CLI&lt;&#x2F;strong&gt; to &lt;strong&gt;collect source-based coverage&lt;&#x2F;strong&gt; from your eBPF programs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;stdo1.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;Source-based code coverage for BPF raw tracepoints&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;stdo1.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;stdo2.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;Source-based code coverage for BPF LSM programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;stdo2.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;mult1.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;HTML coverage index for multiple eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;mult1.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html2.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;HTML coverage report for eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html2.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html1.png&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;HTML coverage report for eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html1.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;json1.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;JSON report for multiple eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;json1.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;lcov1.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;LCOV info file from multiple eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;lcov1.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html3.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;HTML line coverage report for eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html3.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html4.png&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;img width=&quot;1604&quot; alt=&quot;HTML line coverage report for eBPF programs&quot; src=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;elastic&#x2F;bpfcov&#x2F;main&#x2F;docs&#x2F;assets&#x2F;html4.png&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;a class=&quot;zola-anchor&quot; href=&quot;#overview&quot; aria-label=&quot;Anchor link for: overview&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;This section aims to provide a high-level overiew of the steps you need to get started with &lt;strong&gt;bpfcov&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;leodido.dev&#x2F;projects&#x2F;bpfcov&#x2F;#building&quot;&gt;Compile the LLVM pass&lt;&#x2F;a&gt; obtaining &lt;code&gt;libBPFCov.so&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Instrument your eBPF program by compiling it and by running the LLVM pass (&lt;code&gt;libBPFCov.so&lt;&#x2F;code&gt;) on it&lt;&#x2F;li&gt;
&lt;li&gt;Build the userspace code of your eBPF application&lt;&#x2F;li&gt;
&lt;li&gt;Execute your eBPF application in the kernel through the &lt;code&gt;bpfcov run ...&lt;&#x2F;code&gt; command&lt;&#x2F;li&gt;
&lt;li&gt;Generate the &lt;code&gt;.profraw&lt;&#x2F;code&gt; file from the run through the &lt;code&gt;bpfcov gen ...&lt;&#x2F;code&gt; command
&lt;ol&gt;
&lt;li&gt;Having a &lt;code&gt;.profraw&lt;&#x2F;code&gt; makes this tool fully interoperable&lt;&#x2F;li&gt;
&lt;li&gt;Having a &lt;code&gt;.profraw&lt;&#x2F;code&gt; allows you to generate a variety of coverage reports in different formats&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Use the LLVM toolchain to create coverage reports as documented in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;clang.llvm.org&#x2F;docs&#x2F;SourceBasedCodeCoverage.html#creating-coverage-reports&quot;&gt;LLVM docs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In case you are impatient and want to jump straight into getting your hands dirty, then the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;examples&#x2F;&quot;&gt;examples&lt;&#x2F;a&gt; directory contains a few dummy eBPF programs to showcase what &lt;strong&gt;bpfcov&lt;&#x2F;strong&gt; does.&lt;&#x2F;p&gt;
&lt;p&gt;It basically automates steps 2 and 3. Its &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;examples&#x2F;README.md&quot;&gt;README&lt;&#x2F;a&gt; contains more details.&lt;&#x2F;p&gt;
&lt;p&gt;While the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;cli&#x2F;README.md&quot;&gt;README of the cli directory&lt;&#x2F;a&gt; gives you more details about the steps 4 and 5 (and also 6).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;a class=&quot;zola-anchor&quot; href=&quot;#usage&quot; aria-label=&quot;Anchor link for: usage&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Here I will highlight the &lt;em&gt;manual&lt;&#x2F;em&gt; steps to use it.&lt;&#x2F;p&gt;
&lt;p&gt;I suggest you to automate most of them like I did in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;examples&#x2F;src&#x2F;Makefile&quot;&gt;examples Makefile&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Anyway, assuming you have &lt;a href=&quot;https:&#x2F;&#x2F;leodido.dev&#x2F;projects&#x2F;bpfcov&#x2F;#building&quot;&gt;built&lt;&#x2F;a&gt; the LLVM pass, you can then use your fresh &lt;code&gt;libBPFCov.so&lt;&#x2F;code&gt; to instrument your eBPF programs for coverage (steps 2 and 3 above).&lt;&#x2F;p&gt;
&lt;p&gt;How to do it?&lt;&#x2F;p&gt;
&lt;p&gt;First, you need to compile your eBPF program almost as usual but to LLVM IR...&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;clang&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -g -O2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -target&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; bpf&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -D__TARGET_ARCH_x86 -I$(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;YOUR_INCLUDES&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -fprofile-instr-generate -fcoverage-mapping&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -emit-llvm -S&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; program.bpf.c&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; program.bpf.ll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice it doesn&#x27;t matter if you use the textual (&lt;code&gt;*.ll&lt;&#x2F;code&gt;) or the binary form (&lt;code&gt;*.bc&lt;&#x2F;code&gt;).
Obviously, the former is more readable.&lt;&#x2F;p&gt;
&lt;p&gt;The same logic applies to &lt;code&gt;opt&lt;&#x2F;code&gt;: by default it generates &lt;code&gt;*.bc&lt;&#x2F;code&gt;.
Using the &lt;code&gt;-S&lt;&#x2F;code&gt; flag you can obtain the output in textual form (&lt;code&gt;*.ll&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Anyhow, it&#x27;s time to run the LLVM pass on the LLVM IR we obtained.&lt;&#x2F;p&gt;
&lt;p&gt;Let&#x27;s do it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;opt&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -load-pass-plugin&lt;&#x2F;span&gt;&lt;span&gt; $(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;BUILD_DIR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;lib&#x2F;libBPFCov.so&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -passes=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;bpf-cov&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -S&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; program.bpf.ll&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; program.bpf.cov.ll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We should have obtained a new LLVM IR that&#x27;s now valid and loadable from the BPF VM in the Linux kernel. Almost there, YaY!&lt;&#x2F;p&gt;
&lt;p&gt;From it, we can obtain a valid BPF ELF now:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;llc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -march=bpf -filetype=obj -o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program.bpf.o program.bpf.cov.ll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While we are at it, it is also worth running the LLVM pass again (with a flag) to obtain another BPF ELF containing all the &lt;strong&gt;profiling&lt;&#x2F;strong&gt; and &lt;strong&gt;coverage mapping&lt;&#x2F;strong&gt; info.
It will come in handy later with &lt;code&gt;llvm-cov&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;opt&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -load&lt;&#x2F;span&gt;&lt;span&gt; $(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;BUILD_DIR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;lib&#x2F;libBPFCov.so&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -strip-initializers-only -bpf-cov&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    program.bpf.ll&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;    llc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -march=bpf -filetype=obj -o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program.bpf.obj&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At this point, we can compile our userspace application loading the eBPF instrumented program (&lt;code&gt;cov&#x2F;program.bpf.o&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Doing this when using &lt;code&gt;libbpf&lt;&#x2F;code&gt; and skeletons is very easy. Nothing different from the common steps: &lt;code&gt;bpftool&lt;&#x2F;code&gt;, &lt;code&gt;cc&lt;&#x2F;code&gt;, etc.&lt;&#x2F;p&gt;
&lt;p&gt;In the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;examples&#x2F;&quot;&gt;examples&lt;&#x2F;a&gt; directory, you can find further explainations.&lt;&#x2F;p&gt;
&lt;p&gt;So assuming we got our instrumented binary ready (&lt;code&gt;cov&#x2F;program&lt;&#x2F;code&gt;), we can run it via the &lt;code&gt;bpfcov&lt;&#x2F;code&gt; CLI.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; .&#x2F;bpfcov run cov&#x2F;program&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;# Wait for it to exit, or stop it with CTRL+C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; .&#x2F;bpfcov gen&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; --unpin&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Again, in case you wanna know more about these 2 steps, refer this time to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;elastic&#x2F;bpfcov&#x2F;tree&#x2F;main&#x2F;cli&#x2F;README.md&quot;&gt;CLI README&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Now we have a magic &lt;code&gt;cov&#x2F;program.profraw&lt;&#x2F;code&gt; file...&lt;&#x2F;p&gt;
&lt;p&gt;And we can use the LLVM toolchain to generate very fine-grained coverage reports like those in the screenshots!&lt;&#x2F;p&gt;
&lt;p&gt;Refer to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;clang.llvm.org&#x2F;docs&#x2F;SourceBasedCodeCoverage.html#creating-coverage-reports&quot;&gt;LLVM docs&lt;&#x2F;a&gt; to learn how to do it.&lt;&#x2F;p&gt;
&lt;p&gt;But no worries, it&#x27;s just about invoking &lt;code&gt;llvm-profdata&lt;&#x2F;code&gt; and &lt;code&gt;llvm-cov&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;lvm-profdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -sparse&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program.profraw&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program.profdata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;llvm-cov&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; show&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    --format=html&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    --show-line-counts-or-regions --show-region-summary --show-branch-summary&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    --instr-profile=cov&#x2F;profdata.profdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    -object&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program.bpf.obj&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;    --output-dir=cov&#x2F;html_report&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Anyayws, &lt;strong&gt;bpfcov&lt;&#x2F;strong&gt; also provides you an opinionated shortcut command to generate HTML, JSON, and LCOV coverage reports:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;.&#x2F;bpfcov&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; out&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; --format=html&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cov&#x2F;program.profraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;development-environment&quot;&gt;Development Environment&lt;a class=&quot;zola-anchor&quot; href=&quot;#development-environment&quot; aria-label=&quot;Anchor link for: development-environment&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;In order to &lt;strong&gt;build&lt;&#x2F;strong&gt; the BPFCov library (&lt;code&gt;libBPFCov.so&lt;&#x2F;code&gt;) you will need:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;LLVM 12+&lt;&#x2F;li&gt;
&lt;li&gt;CMake 3.13.4+&lt;&#x2F;li&gt;
&lt;li&gt;C++ compiler that supports C++14&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In order to &lt;strong&gt;use&lt;&#x2F;strong&gt; it, you will need:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;clang 12 (to generate the input LLVM files)&lt;&#x2F;li&gt;
&lt;li&gt;its &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;llvm.org&#x2F;docs&#x2F;CommandGuide&#x2F;opt.html&quot;&gt;opt&lt;&#x2F;a&gt; binary to run the LLVM pass&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This project has been tested on 5.15 Linux kernels.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;building&quot;&gt;Building&lt;a class=&quot;zola-anchor&quot; href=&quot;#building&quot; aria-label=&quot;Anchor link for: building&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Build as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; build&lt;&#x2F;span&gt;&lt;span&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-function&quot;&gt; cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; build&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;cmake&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -DLT_LLVM_INSTALL_DIR=&#x2F;path&#x2F;to&#x2F;llvm&#x2F;installation&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;make&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice that the &lt;code&gt;LT_LLVM_INSTALL_DIR&lt;&#x2F;code&gt; variable should be set to the root of either the installation (usually &lt;code&gt;&#x2F;usr&lt;&#x2F;code&gt;) or the build directory of LLVM.&lt;&#x2F;p&gt;
&lt;p&gt;It is used to locate the corresponding &lt;code&gt;LLVMConfig.cmake&lt;&#x2F;code&gt; script that is used to set the include and the
library paths.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;testing&quot;&gt;Testing&lt;a class=&quot;zola-anchor&quot; href=&quot;#testing&quot; aria-label=&quot;Anchor link for: testing&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;TBD&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To run the tests you will need to install &lt;strong&gt;llvm-lit&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Usually, you can install it with &lt;strong&gt;pip&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;pip&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install lit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Running the tests is as simple as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;lit&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; build&#x2F;test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>falco</title>
        <published>2016-01-19T00:00:00+00:00</published>
        <updated>2016-01-19T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://leodido.dev/projects/falco/"/>
        <id>https://leodido.dev/projects/falco/</id>
        
        <content type="html" xml:base="https://leodido.dev/projects/falco/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;falco.org&#x2F;img&#x2F;brand&#x2F;falco-horizontal-color.svg&quot; alt=&quot;Falco&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;&quot;&gt;Falco&lt;&#x2F;a&gt; is a cloud native runtime security tool for Linux operating systems. It is designed to detect and alert on abnormal behavior and potential security threats in real-time.&lt;&#x2F;p&gt;
&lt;p&gt;At its core, Falco is a kernel monitoring and detection agent that observes events, such as syscalls, based on custom rules. Falco can enhance these events by integrating metadata from the container runtime and Kubernetes. The collected events can be analyzed off-host in SIEM or data lake systems.&lt;&#x2F;p&gt;
&lt;p&gt;Falco, originally created by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;sysdig.com&quot;&gt;Sysdig&lt;&#x2F;a&gt;, is a &lt;strong&gt;graduated project&lt;&#x2F;strong&gt; under the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cncf.io&quot;&gt;Cloud Native Computing Foundation&lt;&#x2F;a&gt; (CNCF) used in production by various &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;blob&#x2F;master&#x2F;ADOPTERS.md&quot;&gt;organisations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For detailed technical information and insights into the cyber threats that Falco can detect, visit the official &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;&quot;&gt;Falco&lt;&#x2F;a&gt; website.&lt;&#x2F;p&gt;
&lt;p&gt;For comprehensive information on the latest updates and changes to the project, please refer to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;tree&#x2F;master&#x2F;CHANGELOG.md&quot;&gt;Change Log&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-falco-project&quot;&gt;The Falco Project&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-falco-project&quot; aria-label=&quot;Anchor link for: the-falco-project&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;The Falco Project codebase is maintained under the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&quot;&gt;falcosecurity GitHub organization&lt;&#x2F;a&gt;. The primary repository, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&quot;&gt;falcosecurity&#x2F;falco&lt;&#x2F;a&gt;, holds the source code for the Falco binary, while other sub-projects are hosted in dedicated repositories. This approach of isolating components into specialized repositories enhances modularity and focused development. Notable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution?tab=readme-ov-file#core&quot;&gt;core repositories&lt;&#x2F;a&gt; include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;libs&quot;&gt;falcosecurity&#x2F;libs&lt;&#x2F;a&gt;: This repository hosts Falco&#x27;s core libraries, which constitute the majority of the binary’s source code and provide essential features, such as kernel drivers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;rules&quot;&gt;falcosecurity&#x2F;rules&lt;&#x2F;a&gt;: It contains the official ruleset for Falco, offering pre-defined detection rules for various security threats and abnormal behaviors.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;plugins&quot;&gt;falcosecurity&#x2F;plugins&lt;&#x2F;a&gt;: This repository supports integration with external services through plugins that extend Falco&#x27;s capabilities beyond syscalls and container events, with plans for evolving specialized functionalities in future releases.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falcoctl&quot;&gt;falcosecurity&#x2F;falcoctl&lt;&#x2F;a&gt;: A command-line utility designed for managing and interacting with Falco.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;charts&quot;&gt;falcosecurity&#x2F;charts&lt;&#x2F;a&gt;: This repository provides Helm charts for deploying Falco and its ecosystem, simplifying the installation and management process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For further insights into our repositories and additional details about our governance model, please visit the official hub of The Falco Project: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&quot;&gt;falcosecurity&#x2F;evolution&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;getting-started-with-falco&quot;&gt;Getting Started with Falco&lt;a class=&quot;zola-anchor&quot; href=&quot;#getting-started-with-falco&quot; aria-label=&quot;Anchor link for: getting-started-with-falco&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;If you&#x27;re new to Falco, begin your journey with our &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;docs&#x2F;getting-started&#x2F;&quot;&gt;Getting Started&lt;&#x2F;a&gt; guide. For production deployments, please refer to our comprehensive &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;docs&#x2F;setup&#x2F;&quot;&gt;Setup&lt;&#x2F;a&gt; documentation.&lt;&#x2F;p&gt;
&lt;p&gt;As final recommendations before deploying Falco, verify environment compatibility, define your detection goals, optimize performance, choose the appropriate build, and plan for SIEM or data lake integration to ensure effective incident response.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;demo-environment&quot;&gt;Demo Environment&lt;a class=&quot;zola-anchor&quot; href=&quot;#demo-environment&quot; aria-label=&quot;Anchor link for: demo-environment&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;A demo environment is provided via a docker-compose file that can be started on a docker host which includes falco, falcosidekick, falcosidekick-ui and its required redis database. For more information see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;tree&#x2F;master&#x2F;docker&#x2F;docker-compose&#x2F;&quot;&gt;docker-compose section&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;join-the-community&quot;&gt;Join the Community&lt;a class=&quot;zola-anchor&quot; href=&quot;#join-the-community&quot; aria-label=&quot;Anchor link for: join-the-community&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;To get involved with the Falco Project please visit the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;community&quot;&gt;Community&lt;&#x2F;a&gt; repository to find more information and ways to get involved.&lt;&#x2F;p&gt;
&lt;p&gt;If you have any questions about Falco or contributing, do not hesitate to file an issue or contact the Falco maintainers and community members for assistance.&lt;&#x2F;p&gt;
&lt;p&gt;How to reach out?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Join the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;kubernetes.slack.com&#x2F;messages&#x2F;falco&quot;&gt;#falco&lt;&#x2F;a&gt; channel on the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;slack.k8s.io&quot;&gt;Kubernetes Slack&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Join the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lists.cncf.io&#x2F;g&#x2F;cncf-falco-dev&quot;&gt;Falco mailing list&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;File an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;issues&quot;&gt;issue&lt;&#x2F;a&gt; or make feature requests.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;commitment-to-falco-s-own-security&quot;&gt;Commitment to Falco&#x27;s Own Security&lt;a class=&quot;zola-anchor&quot; href=&quot;#commitment-to-falco-s-own-security&quot; aria-label=&quot;Anchor link for: commitment-to-falco-s-own-security&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Full reports of various security audits can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;tree&#x2F;master&#x2F;audits&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, you can refer to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;security&quot;&gt;falco&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;libs&#x2F;security&quot;&gt;libs&lt;&#x2F;a&gt; security sections for detailed updates on security advisories and policies.&lt;&#x2F;p&gt;
&lt;p&gt;To report security vulnerabilities, please follow the community process outlined in the documentation found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;.github&#x2F;blob&#x2F;main&#x2F;SECURITY.md&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;building&quot;&gt;Building&lt;a class=&quot;zola-anchor&quot; href=&quot;#building&quot; aria-label=&quot;Anchor link for: building&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;For comprehensive, step-by-step instructions on building Falco from source, please refer to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;docs&#x2F;developer-guide&#x2F;source&#x2F;&quot;&gt;official documentation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;testing&quot;&gt;Testing&lt;a class=&quot;zola-anchor&quot; href=&quot;#testing&quot; aria-label=&quot;Anchor link for: testing&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;details&gt;
	&lt;summary&gt;Expand Testing Instructions&lt;&#x2F;summary&gt;
&lt;p&gt;Falco&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;docs&#x2F;developer-guide&#x2F;source&#x2F;&quot;&gt;Build Falco from source&lt;&#x2F;a&gt; is the go-to resource to understand how to build Falco from source. In addition, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;libs&quot;&gt;falcosecurity&#x2F;libs&lt;&#x2F;a&gt; repository offers additional valuable information about tests and debugging of Falco&#x27;s underlying libraries and kernel drivers.&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s an example of a &lt;code&gt;cmake&lt;&#x2F;code&gt; command that will enable everything you need for all unit tests of this repository:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;cmake&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-DUSE_BUNDLED_DEPS=ON&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-DBUILD_DRIVER=ON&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-DBUILD_FALCO_MODERN_BPF=ON&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-DCREATE_TEST_TARGETS=ON&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-DBUILD_FALCO_UNIT_TESTS=ON&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ..&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Build and run the unit test suite:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;nproc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator&quot;&gt;=$(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;grep&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; processor &#x2F;proc&#x2F;cpuinfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt; tail&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt; awk&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;{print $3}&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;make&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt; -j$((&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;$nproc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-other z-option&quot;&gt;-1))&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; falco_unit_tests&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;# Run the tests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; .&#x2F;unit_tests&#x2F;falco_unit_tests&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optionally, build the driver of your choice and test run the Falco binary to perform manual tests.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, The Falco Project has moved its Falco regression tests to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;testing&quot;&gt;falcosecurity&#x2F;testing&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;details&gt;
&lt;&#x2F;br&gt;
&lt;h2 id=&quot;how-to-contribute&quot;&gt;How to Contribute&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-to-contribute&quot; aria-label=&quot;Anchor link for: how-to-contribute&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Please refer to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;.github&#x2F;blob&#x2F;main&#x2F;CONTRIBUTING.md&quot;&gt;Contributing&lt;&#x2F;a&gt; guide and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;CODE_OF_CONDUCT.md&quot;&gt;Code of Conduct&lt;&#x2F;a&gt; for more information on how to contribute.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;faqs&quot;&gt;FAQs&lt;a class=&quot;zola-anchor&quot; href=&quot;#faqs&quot; aria-label=&quot;Anchor link for: faqs&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-is-falco-in-c-rather-than-go-or-language&quot;&gt;Why is Falco in C++ rather than Go or {language}?&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-is-falco-in-c-rather-than-go-or-language&quot; aria-label=&quot;Anchor link for: why-is-falco-in-c-rather-than-go-or-language&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h3&gt;
&lt;details&gt;
	&lt;summary&gt;Expand Information&lt;&#x2F;summary&gt;
&lt;ol&gt;
&lt;li&gt;The first lines of code at the base of Falco were written some time ago, where Go didn&#x27;t yet have the same level of maturity and adoption as today.&lt;&#x2F;li&gt;
&lt;li&gt;The Falco execution model is sequential and mono-thread due to the statefulness requirements of the tool, and so most of the concurrency-related selling points of the Go runtime would not be leveraged at all.&lt;&#x2F;li&gt;
&lt;li&gt;The Falco code deals with very low-level programming in many places, and we all know that interfacing Go with C is possible but brings tons of complexity and tradeoffs to the table.&lt;&#x2F;li&gt;
&lt;li&gt;As a security tool meant to consume a crazy high throughput of events per second, Falco needs to squeeze performance in all hot paths at runtime and requires deep control on memory allocation, which the Go runtime can&#x27;t provide (there&#x27;s also garbage collection involved).&lt;&#x2F;li&gt;
&lt;li&gt;Although Go didn&#x27;t suit the engineering requirements of the core of Falco, we still thought that it could be a good candidate for writing Falco extensions through the plugin system. This is the main reason we gave special attention and high priority to the development of the plugin-sdk-go.&lt;&#x2F;li&gt;
&lt;li&gt;Go is not a requirement for having statically-linked binaries. In fact, we provide fully-static Falco builds since few years. The only issue with those is that the plugin system can&#x27;t be supported with the current dynamic library model we currently have.&lt;&#x2F;li&gt;
&lt;li&gt;The plugin system has been envisioned to support multiple languages, so on our end maintaining a C-compatible codebase is the best strategy to ensure maximum cross-language compatibility.&lt;&#x2F;li&gt;
&lt;li&gt;In general, plugins have GLIBC requirements&#x2F;dependencies because they have low-level C bindings required for dynamic loading. A potential solution for the future could be to also support plugin to be statically-linked at compilation time and so released as bundled in the Falco binary. Although no work started yet in this direction, this would solve most issues you reported and would provide a totally-static binary too. Of course, this would not be compatible with dynamic loading anymore, but it may be a viable solution for our static-build flavor of Falco.&lt;&#x2F;li&gt;
&lt;li&gt;Memory safety is definitely a concern and we try our best to keep an high level of quality even though C++ is quite error prone. For instance, we try to use smart pointers whenever possible, we build the libraries with an address sanitizer in our CI, we run Falco through Valgrind before each release, and have ways to stress-test it to detect performance regressions or weird memory usage (e.g. https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;event-generator). On top of that, we also have third parties auditing the codebase by time to time. None of this make a perfect safety standpoint of course, but we try to maximize our odds. Go would definitely make our life easier from this perspective, however the tradeoffs never made it worth it so far due to the points above.&lt;&#x2F;li&gt;
&lt;li&gt;The C++ codebase of falcosecurity&#x2F;libs, which is at the core of Falco, is quite large and complex. Porting all that code to another language would be a major effort requiring lots of development resource and with an high chance of failure and regression. As such, our approach so far has been to choose refactors and code polishing instead, up until we&#x27;ll reach an optimal level of stability, quality, and modularity, on that portion of code. This would allow further developments to be smoother and more feasibile in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;details&gt;
&lt;&#x2F;br&gt;
&lt;h3 id=&quot;what-s-next-for-falco&quot;&gt;What&#x27;s next for Falco?&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-s-next-for-falco&quot; aria-label=&quot;Anchor link for: what-s-next-for-falco&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h3&gt;
&lt;p&gt;Stay updated with Falco&#x27;s evolving capabilities by exploring the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;orgs&#x2F;falcosecurity&#x2F;projects&#x2F;5&quot;&gt;Falco Roadmap&lt;&#x2F;a&gt;, which provides insights into the features currently under development and planned for future releases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;license&quot;&gt;License&lt;a class=&quot;zola-anchor&quot; href=&quot;#license&quot; aria-label=&quot;Anchor link for: license&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Falco is licensed to you under the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;tree&#x2F;master&#x2F;COPYING&quot;&gt;Apache 2.0&lt;&#x2F;a&gt; open source license.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources&lt;a class=&quot;zola-anchor&quot; href=&quot;#resources&quot; aria-label=&quot;Anchor link for: resources&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;GOVERNANCE.md&quot;&gt;Governance&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;CODE_OF_CONDUCT.md&quot;&gt;Code Of Conduct&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;MAINTAINERS_GUIDELINES.md&quot;&gt;Maintainers Guidelines&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;MAINTAINERS.md&quot;&gt;Maintainers List&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;REPOSITORIES.md&quot;&gt;Repositories Guidelines&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;evolution&#x2F;blob&#x2F;main&#x2F;README.md#repositories&quot;&gt;Repositories List&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;blob&#x2F;master&#x2F;ADOPTERS.md&quot;&gt;Adopters List&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;falcosecurity&#x2F;falco&#x2F;tree&#x2F;master&#x2F;RELEASE.md&quot;&gt;Release Process&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;docs&#x2F;setup&#x2F;&quot;&gt;Setup documentation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;falco.org&#x2F;docs&#x2F;troubleshooting&#x2F;&quot;&gt;Troubleshooting&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
</feed>
