<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=COMP3000_Operating_Systems_W22%3A_Tutorial_7</id>
	<title>COMP3000 Operating Systems W22: Tutorial 7 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=COMP3000_Operating_Systems_W22%3A_Tutorial_7"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;action=history"/>
	<updated>2026-06-02T19:44:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23883&amp;oldid=prev</id>
		<title>Lianyingzhao at 17:38, 12 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23883&amp;oldid=prev"/>
		<updated>2022-03-12T17:38:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:38, 12 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l18&quot;&gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* It might be wise to code on your own computer and use scp or sshfs to transfer the files to your VM.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* It might be wise to code on your own computer and use scp or sshfs to transfer the files to your VM.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* https://elixir.bootlin.com/linux/latest/source is a great resource for learning about kernel functions and data structures.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* https://elixir.bootlin.com/linux/latest/source is a great resource for learning about kernel functions and data structures.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Note: although it&#039;s highly recommended that you use the openstack instance, if you cannot for a reason, check out [[COMP3000 Operating Systems W22: Tutorial 7 Not Using SCSOpenStack | these instructions]] to see if they help.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Special Files==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Special Files==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23876&amp;oldid=prev</id>
		<title>Lianyingzhao at 04:47, 11 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23876&amp;oldid=prev"/>
		<updated>2022-03-11T04:47:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:47, 11 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l76&quot;&gt;Line 76:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 76:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To move between sessions: press Ctrl-B and N (or P)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To move between sessions: press Ctrl-B and N (or P)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You can &amp;lt;tt&amp;gt;sudo bpftrace -l | grep&amp;lt;/tt&amp;gt; for your needed kernel functions (e.g.,&amp;lt;tt&amp;gt;printk&amp;lt;/tt&amp;gt;) to hook to.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;How could this save you from doing any &amp;lt;tt&amp;gt;printk&amp;lt;/tt&amp;gt;&#039;s in your kernel module code?&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You can &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;also &lt;/ins&gt;&amp;lt;tt&amp;gt;sudo bpftrace -l | grep&amp;lt;/tt&amp;gt; for your needed kernel functions (e.g.,&amp;lt;tt&amp;gt;printk&amp;lt;/tt&amp;gt;) to hook to.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23875&amp;oldid=prev</id>
		<title>Lianyingzhao at 04:45, 11 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23875&amp;oldid=prev"/>
		<updated>2022-03-11T04:45:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:45, 11 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l57&quot;&gt;Line 57:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://elixir.bootlin.com/linux/latest/source/include/linux/sched.h,  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://elixir.bootlin.com/linux/latest/source/include/linux/sched.h,  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/current.h,  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/current.h,  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://elixir.bootlin.com/linux/latest/source/include/linux/cred.h&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://elixir.bootlin.com/linux/latest/source/include/linux/cred.h&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# What type is &amp;quot;&amp;lt;tt&amp;gt;current&amp;lt;/tt&amp;gt;&amp;quot;? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; can you figure this out?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# What type is &amp;quot;&amp;lt;tt&amp;gt;current&amp;lt;/tt&amp;gt;&amp;quot;? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; can you figure this out?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l67&quot;&gt;Line 67:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 65:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Using &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt; to monitor kernel module events==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Using &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt; to monitor kernel module events==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Note: you are not required to write about your experience for this part in the submitted work, but you should still do it, which can help you understand eBPF better (see how simple but still powerful an eBPF program can be).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Note: you are not required to write about your experience for this part in the submitted work, but you should still do it, which can help you understand eBPF better (see how simple but still powerful an eBPF program can be).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Download this tiny code kmsnoop.bt and make it executable with chmod 755 kmsnoop.bt.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now, you can open a separate SSH session and run it with sudo ./kmsnoop.bt. It will wait for events. When you do any &quot;insmod&quot; or &quot;rmmod&quot; in the other session&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Download this tiny code &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[https://people.scs.carleton.ca/~lianyingzhao/comp3000/w22/tut7/kmsnoop.bt &lt;/ins&gt;kmsnoop.bt&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/ins&gt;and make it executable with &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;chmod 755 kmsnoop.bt&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt;&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now, you can open a separate SSH session and run it with &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;sudo ./kmsnoop.bt&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt;&lt;/ins&gt;. It will wait for events. When you do any &quot;insmod&quot; or &quot;rmmod&quot; in the other session&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, you will see it outputs a line of message.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If you want to avoid opening another SSH window, you can use tmux (a terminal multiplexer) by just typing tmux and hit enter.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If you want to avoid opening another SSH window, you can use tmux (a terminal multiplexer) by just typing tmux and hit enter.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23874&amp;oldid=prev</id>
		<title>Lianyingzhao: Created page with &quot;In this tutorial you&#039;ll be learning about special files and Linux kernel modules. You’ll create several kernel modules and see how to interact with them using special files (e.g., character device) and their file operations as an interface.  Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to try to have the “correct” answers — what matters is the process&#039;&#039;&#039;), but you should still turn in your work. Even if you have no idea about certain task...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_7&amp;diff=23874&amp;oldid=prev"/>
		<updated>2022-03-11T04:43:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;In this tutorial you&amp;#039;ll be learning about special files and Linux kernel modules. You’ll create several kernel modules and see how to interact with them using special files (e.g., character device) and their file operations as an interface.  Tutorials are graded based on participation and effort (&amp;#039;&amp;#039;&amp;#039;so no need to try to have the “correct” answers — what matters is the process&amp;#039;&amp;#039;&amp;#039;), but you should still turn in your work. Even if you have no idea about certain task...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In this tutorial you&amp;#039;ll be learning about special files and Linux kernel modules. You’ll create several kernel modules and see how to interact with them using special files (e.g., character device) and their file operations as an interface.&lt;br /&gt;
&lt;br /&gt;
Tutorials are graded based on participation and effort (&amp;#039;&amp;#039;&amp;#039;so no need to try to have the “correct” answers — what matters is the process&amp;#039;&amp;#039;&amp;#039;), but you should still turn in your work. Even if you have no idea about certain tasks or disagree about something, still make sure to document your confusions/opinions that reflect your thinking about that task. Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t7.txt&amp;quot; (where username is your MyCarletonOne username). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial 7&amp;quot;, your name, student number, and the date of submission. &lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual due date and &amp;#039;&amp;#039;&amp;#039;time&amp;#039;&amp;#039;&amp;#039; on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA online (by responding to the poll in the Teams channel tutorials-public or the private channel). Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Tips==&lt;br /&gt;
* There is a chance your VM will crash or your ssh session will become unresponsive when messing with the kernel. To recover, you can reboot your VM from the OpenStack web console.&lt;br /&gt;
* Definitely do not under any circumstances attempt this on your own system. This is your last warning.&lt;br /&gt;
* Remember to recompile and insert your module after making changes.&lt;br /&gt;
* Work incrementally and be prepared for your system to crash.&lt;br /&gt;
* It might be wise to code on your own computer and use scp or sshfs to transfer the files to your VM.&lt;br /&gt;
* https://elixir.bootlin.com/linux/latest/source is a great resource for learning about kernel functions and data structures.&lt;br /&gt;
&lt;br /&gt;
==Special Files==&lt;br /&gt;
Before you start, review what you have learned about special files and think about the following questions (no need to answer them): 1) What does a special file represent and what backs it up? 2) Can you have multiple special files that are somehow &amp;quot;the same&amp;quot;? What does it mean to &amp;quot;copy&amp;quot; a special file? 3) How are named pipes different from unnamed pipes and what are their similarities? Take this opportunity to deepen your understanding of special files to prepare you for working with device drivers that support such special files.&lt;br /&gt;
&lt;br /&gt;
===Tasks part A: Understanding special files===&lt;br /&gt;
# Try the following commands as a non-privileged user. What does each do? How do the files f1-f3 compare? How do they compare to &amp;lt;tt&amp;gt;/dev/urandom&amp;lt;/tt&amp;gt;? Remember you can get output from &amp;lt;tt&amp;gt;/dev/urandom&amp;lt;/tt&amp;gt; using &amp;lt;tt&amp;gt;cat&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt;. If you use &amp;lt;tt&amp;gt;cat&amp;lt;/tt&amp;gt;, make sure to pipe it to &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt;!&lt;br /&gt;
#* &amp;lt;tt&amp;gt;cp /dev/urandom f1&amp;lt;/tt&amp;gt; 		(hit Ctrl+C right away to avoid a huge file)&lt;br /&gt;
#* &amp;lt;tt&amp;gt;sudo cp -a /dev/urandom f2&amp;lt;/tt&amp;gt;&lt;br /&gt;
#* &amp;lt;tt&amp;gt;sudo mknod f3 c 1 9&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: Note: If you see any command running for more than a few seconds, hit Ctrl+C right away, check the produced file (often it’s very large) and delete it if not needed.&lt;br /&gt;
# Make named pipes using &amp;lt;tt&amp;gt;mknod&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;mkfifo&amp;lt;/tt&amp;gt;. Use them to simulate &amp;lt;tt&amp;gt;ls | wc&amp;lt;/tt&amp;gt; using just the &amp;#039;&amp;gt;&amp;#039; and &amp;#039;&amp;lt;&amp;#039; operators.&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;mknod&amp;lt;/tt&amp;gt; to make a copy of your current terminal&amp;#039;s tty - &amp;lt;tt&amp;gt;/dev/tty&amp;lt;/tt&amp;gt; (Hint: consider how you did something similar with &amp;lt;tt&amp;gt;/dev/urandom&amp;lt;/tt&amp;gt; above). You can name it &amp;lt;tt&amp;gt;mytty&amp;lt;/tt&amp;gt;. Examine its characteristics using &amp;lt;tt&amp;gt;stty --file=mytty&amp;lt;/tt&amp;gt;. Do the same for the original tty. &lt;br /&gt;
# Run &amp;lt;tt&amp;gt;stty --help&amp;lt;/tt&amp;gt; to see what you can do with stty. Try disabling local echo. How does the shell behave with echo disabled? How can you restore echo without logging out and back in? Recall we did this in the class.&lt;br /&gt;
&lt;br /&gt;
==Kernel Modules==&lt;br /&gt;
In this part of the tutorial you will be building and installing kernel modules. You will need root access to install kernel modules.&lt;br /&gt;
&lt;br /&gt;
It is &amp;#039;&amp;#039;&amp;#039;highly recommended&amp;#039;&amp;#039;&amp;#039; that you use a comp3000 openstack instance for the exercises below for two reasons. First, you may have difficulties compiling kernel modules on other systems. Second, these operations are potentially dangerous, and mistakes could &amp;#039;&amp;#039;&amp;#039;destroy all data&amp;#039;&amp;#039;&amp;#039; on the Linux system. Consider yourself warned!&lt;br /&gt;
&lt;br /&gt;
Before you start, review what you have learned about kernel modules and device drivers, and think about the following questions (no need to answer them): 1) How does the source of kernel modules differ from C programs? 2) How does building kernel modules differ from building userspace C programs? 3) How does invoking the file operations (e.g., read/write) of a special file trigger corresponding functions in a device driver?&lt;br /&gt;
&lt;br /&gt;
You will learn how you can access and manipulate kernel data structures and call kernel functions in a kernel module. You will also understand how processes are represented by &amp;lt;tt&amp;gt;task_struct&amp;lt;/tt&amp;gt;&amp;#039;s in the Linux kernel, what kind of information is stored in a task struct, and how to access the &amp;lt;tt&amp;gt;task_struct&amp;lt;/tt&amp;gt; of a process.&lt;br /&gt;
&lt;br /&gt;
===Tasks part B: A simple kernel module===&lt;br /&gt;
Download the source for this [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w22/tut7/simple.tar.gz simple module], unpack, and build it by typing &amp;quot;&amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt;&amp;quot;. You can safely ignore the warning of &amp;quot;Skipping BTF generation...&amp;quot;.&lt;br /&gt;
# Install the module using &amp;quot;&amp;lt;tt&amp;gt;sudo insmod simple.ko&amp;lt;/tt&amp;gt;&amp;quot;. The hello message is recorded in the kernel logs. How do you view the kernel logs? How many ways are there to view them?&lt;br /&gt;
# Check to see that the module has been loaded. How do you do this?&lt;br /&gt;
# Remove the module from the kernel. What did you do?&lt;br /&gt;
&lt;br /&gt;
===Tasks part C: A character device kernel module (driver)===&lt;br /&gt;
Download the source for [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w22/tut7/ones.tar.gz ones], a kernel module implementing a character device that outputs an unbounded string of &amp;quot;1&amp;quot;&amp;#039;s. Build, compile, and run it as before.&lt;br /&gt;
# What kernel messages does the module generate? Does it create any new files (other than &amp;lt;tt&amp;gt;/dev/ones&amp;lt;/tt&amp;gt;)? If so, where? (Hint: search in &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# What happens when you &amp;quot;cat&amp;quot; the device &amp;lt;tt&amp;gt;/dev/ones&amp;lt;/tt&amp;gt;? How can you limit the output in more than one way?&lt;br /&gt;
# Add more &amp;lt;tt&amp;gt;printk()&amp;lt;/tt&amp;gt;’s (where you see needed) to find out at which point which functions in ones.c are called and for which purpose.&lt;br /&gt;
&lt;br /&gt;
===Tasks part D: Getting process information from a module===&lt;br /&gt;
Download the source [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w22/tut7/newgetpid.tar.gz newgetpid.c]. Build and run it as before. Hints for the questions below: &lt;br /&gt;
&lt;br /&gt;
https://elixir.bootlin.com/linux/latest/source/include/linux/sched.h, &lt;br /&gt;
&lt;br /&gt;
https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/current.h, &lt;br /&gt;
&lt;br /&gt;
https://elixir.bootlin.com/linux/latest/source/include/linux/cred.h&lt;br /&gt;
# What type is &amp;quot;&amp;lt;tt&amp;gt;current&amp;lt;/tt&amp;gt;&amp;quot;? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; can you figure this out?&lt;br /&gt;
# Modify newgetpid.c so that it creates a device file &amp;lt;tt&amp;gt;/dev/describe&amp;lt;/tt&amp;gt; rather than &amp;lt;tt&amp;gt;/dev/newgetpid&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Make &amp;lt;tt&amp;gt;/dev/describe&amp;lt;/tt&amp;gt; output the calling process&amp;#039;s parent ID (ppid), user ID (uid), group ID (gid), effective user ID (euid), and effective group ID (egid).&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt; to monitor kernel module events==&lt;br /&gt;
Note: you are not required to write about your experience for this part in the submitted work, but you should still do it, which can help you understand eBPF better (see how simple but still powerful an eBPF program can be).&lt;br /&gt;
Download this tiny code kmsnoop.bt and make it executable with chmod 755 kmsnoop.bt.&lt;br /&gt;
Now, you can open a separate SSH session and run it with sudo ./kmsnoop.bt. It will wait for events. When you do any &amp;quot;insmod&amp;quot; or &amp;quot;rmmod&amp;quot; in the other session&lt;br /&gt;
If you want to avoid opening another SSH window, you can use tmux (a terminal multiplexer) by just typing tmux and hit enter.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
You can &amp;lt;tt&amp;gt;sudo bpftrace -l | grep&amp;lt;/tt&amp;gt; for your needed kernel functions (e.g.,&amp;lt;tt&amp;gt;printk&amp;lt;/tt&amp;gt;) to hook to.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
</feed>