<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[FAQ. How to Contribute to the Linux Kernel?]]></title><description><![CDATA[<h3>Pre-study before kernel contribution</h3>
<h4>Q&amp;A: Getting Started with AppArmor Contribution</h4>
<p dir="auto"><strong>Q. I’m very interested in AppArmor and would like to contribute. How should I prepare, and what is the best way to start contributing to Linux security?</strong></p>
<p dir="auto"><strong>A.</strong> I recommend starting by analyzing the interaction between user space and the kernel. Specifically, you should examine the AppArmor-related options in <code>/proc</code> and <code>/sys</code>, and profile the user space applications that control AppArmor using tools like <code>trace-cmd</code>. This will help you understand the code flow and how policies are enforced.</p>
<ul>
<li><a href="https://www.trace-cmd.org/" rel="nofollow ugc">https://www.trace-cmd.org/</a></li>
<li><a href="https://trace-cmd.org/Documentation/trace-cmd/" rel="nofollow ugc">https://trace-cmd.org/Documentation/trace-cmd/</a></li>
<li><a href="https://github.com/rostedt/trace-cmd" rel="nofollow ugc">https://github.com/rostedt/trace-cmd</a></li>
<li><a href="https://kernelshark.org/Documentation.html" rel="nofollow ugc">https://kernelshark.org/Documentation.html</a></li>
<li><a href="https://wiki.st.com/stm32mpu/wiki/Trace-cmd_and_kernelshark_trace_viewer" rel="nofollow ugc">https://wiki.st.com/stm32mpu/wiki/Trace-cmd_and_kernelshark_trace_viewer</a></li>
</ul>
<p dir="auto">To give you more context, here is a breakdown of the key components you should look into:</p>
<p dir="auto"><strong>1. Understanding the Interfaces: <code>/sys</code> and <code>/proc</code></strong><br />
AppArmor relies heavily on the <strong>SecurityFS</strong> interface to interact with the kernel.</p>
<pre><code># With root privilege, For example:
$ trace-cmd record -F -p function_graph cat /sys/kernel/security/apparmor/profiles
$ trace-cmd report &gt; cat-apparmor.log
</code></pre>
<ul>
<li><strong><code>/sys/kernel/security/apparmor</code></strong>: This is the primary control interface. It is where the kernel exports information about the loaded policies, features, and the interface for loading or replacing profiles. Exploring this directory helps you understand what capabilities the running kernel supports.</li>
<li><strong><code>/proc/[pid]/attr/current</code></strong>: This interface shows the AppArmor profile currently applied to a specific process. Monitoring this file is essential for debugging and verifying that process confinement is working as expected.</li>
</ul>
<p dir="auto"><strong>2. Analyzing User Space Tools</strong><br />
Before diving deep into the kernel code, it is crucial to understand how policies are generated and passed to the kernel. The core component here is the <strong>AppArmor Parser</strong>.</p>
<ul>
<li><strong><code>apparmor_parser</code></strong>: This is the user space program responsible for compiling human-readable text profiles into a binary format that the kernel can digest. By tracing this application with <code>trace-cmd</code>, you can see exactly how it invokes the kernel interfaces to load policies.</li>
</ul>
<ul>
<li><a href="https://documentation.suse.com/ko-kr/sles/12-SP5/html/SLES-all/cha-apparmor-start.html" rel="nofollow ugc">https://documentation.suse.com/ko-kr/sles/12-SP5/html/SLES-all/cha-apparmor-start.html</a></li>
<li><a href="https://manpages.debian.org/stretch/apparmor/apparmor.7.en.html" rel="nofollow ugc">https://manpages.debian.org/stretch/apparmor/apparmor.7.en.html</a></li>
</ul>
<p dir="auto"><strong>3. Source Code Repository</strong><br />
You can find the source code for the AppArmor user space tools, including the parser and libraries, in their official repository. Studying this code is the best way to understand the mechanism behind policy loading.</p>
<ul>
<li><strong>AppArmor User Space Repository:</strong> <a href="https://gitlab.com/apparmor/apparmor" rel="nofollow ugc">https://gitlab.com/apparmor/apparmor</a></li>
<li><strong>AppArmor Kernel Source Code:</strong> <a href="https://elixir.bootlin.com/linux/v6.18.2/source/security/apparmor/apparmorfs.c#L2311" rel="nofollow ugc">https://elixir.bootlin.com/linux/v6.18.2/source/security/apparmor/apparmorfs.c#L2311</a></li>
</ul>
<p dir="auto"><strong>Conclusion</strong><br />
<strong>Lastly, keep in mind that this workflow is not specific to AppArmor. Analyzing the <code>/sys</code> and <code>/proc</code> interfaces and profiling the interaction between user space and the kernel is a universally effective approach. It serves as an excellent starting point for analyzing and contributing to any Linux kernel subsystem.</strong></p>
<p dir="auto">P.S.<br />
profiles_open() → seq_read() (call p_start/p_next/p_show/p_stop)</p>
<pre><code>// security/apparmor/apparmorfs.c

static const struct file_operations aa_sfs_profiles_fops = {
    .open = profiles_open,
    .read = seq_read,
    .llseek = seq_lseek,
    .release = profiles_release,
};
</code></pre>
<ol>
<li>profiles_open(): seq_open() init seq_file.</li>
<li>seq_read() - VFS read seq_file.</li>
<li>aa_sfs_profiles_op's callback
<ul>
<li>p_start() :Start.</li>
<li>p_next() : Next profile.</li>
<li>p_show() : Print profile.</li>
<li>p_stop() : End</li>
</ul>
</li>
<li>profiles_release() : Close the file.</li>
</ol>
]]></description><link>https://kernelmeet.com/topic/4/faq.-how-to-contribute-to-the-linux-kernel</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 18:02:35 GMT</lastBuildDate><atom:link href="https://kernelmeet.com/topic/4.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Dec 2025 06:45:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FAQ. How to Contribute to the Linux Kernel? on Tue, 30 Dec 2025 10:17:13 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/jinseok" aria-label="Profile: Jinseok">@<bdi>Jinseok</bdi></a>, Thank you for the great sharing!</p>
]]></description><link>https://kernelmeet.com/post/16</link><guid isPermaLink="true">https://kernelmeet.com/post/16</guid><dc:creator><![CDATA[Yunseong Kim]]></dc:creator><pubDate>Tue, 30 Dec 2025 10:17:13 GMT</pubDate></item><item><title><![CDATA[Reply to FAQ. How to Contribute to the Linux Kernel? on Tue, 30 Dec 2025 07:53:07 GMT]]></title><description><![CDATA[<ol>
<li>
<p dir="auto">Trace kernel function calls triggered by tcpdump<br />
$ <code>trace-cmd record -p function_graph \ -l '__sys_connect' \ -l 'sys_connect' \ -l 'security_socket_connect' \ -l 'apparmor_socket_connect' \ -l 'aa_sk_perm' \ -- tcpdump -i lo</code></p>
</li>
<li>
<p dir="auto">Convert the recorded trace data into a human-readable report<br />
$ <code>trace-cmd report &gt; tcpdump.log</code><br />
$ <code>cat tcpdump.log </code><br />
cpus=24<br />
tcpdump-8782  [008]  3750.758827: funcgraph_entry:        1.753 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758831: funcgraph_entry:        0.409 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758835: funcgraph_entry:        0.305 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758839: funcgraph_entry:        0.302 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758846: funcgraph_entry:        0.306 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758860: funcgraph_entry:        0.310 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758963: funcgraph_entry:        0.424 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758964: funcgraph_entry:        0.299 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.758966: funcgraph_entry:        0.291 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.759002: funcgraph_entry:        0.304 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.759003: funcgraph_entry:        0.294 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.759012: funcgraph_entry:        0.305 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.759013: funcgraph_entry:                   |  aa_sk_perm() {<br />
Netlink Monitor-4112  [014]  3750.759013: funcgraph_entry:                   |  aa_sk_perm() {<br />
tcpdump-8782  [008]  3750.759013: funcgraph_exit:         0.390 us   |  }<br />
tcpdump-8782  [008]  3750.759014: funcgraph_entry:        0.296 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.759015: funcgraph_entry:        0.283 us   |  aa_sk_perm();<br />
Netlink Monitor-4112  [014]  3750.759016: funcgraph_exit:         3.802 us   |  }<br />
avahi-daemon-1626  [010]  3750.759018: funcgraph_entry:        1.884 us   |  aa_sk_perm();<br />
wpa_supplicant-1652  [002]  3750.759028: funcgraph_entry:        1.878 us   |  aa_sk_perm();<br />
wpa_supplicant-1652  [002]  3750.759041: funcgraph_entry:        0.258 us   |  aa_sk_perm();<br />
NetworkManager-1622  [004]  3750.759066: funcgraph_entry:        1.001 us   |  aa_sk_perm();<br />
systemd-resolve-1362  [012]  3750.759112: funcgraph_entry:        1.523 us   |  aa_sk_perm();<br />
systemd-resolve-1362  [012]  3750.759118: funcgraph_entry:        0.200 us   |  aa_sk_perm();<br />
NetworkManager-1622  [004]  3750.759171: funcgraph_entry:        0.292 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.776187: funcgraph_entry:        1.290 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.776191: funcgraph_entry:        0.569 us   |  aa_sk_perm();<br />
tcpdump-8782  [008]  3750.777373: funcgraph_entry:                   |  __sys_connect() {<br />
tcpdump-8782  [008]  3750.777374: funcgraph_entry:                   |    security_socket_connect() {<br />
tcpdump-8782  [008]  3750.777375: funcgraph_entry:        0.708 us   |      apparmor_socket_connect();<br />
tcpdump-8782  [008]  3750.777376: funcgraph_exit:         2.402 us   |    }<br />
tcpdump-8782  [008]  3750.777389: funcgraph_exit:       + 15.839 us  |  }<br />
.......</p>
</li>
</ol>
]]></description><link>https://kernelmeet.com/post/14</link><guid isPermaLink="true">https://kernelmeet.com/post/14</guid><dc:creator><![CDATA[Jinseok]]></dc:creator><pubDate>Tue, 30 Dec 2025 07:53:07 GMT</pubDate></item></channel></rss>