Skip to content
Some fun things you can do with kernel modules (all "bad ideas")
Branch: master
Clone or download
jvns Merge pull request #1 from avar/patch-1
Fix a trivial typo in a comment
Latest commit e5ba6e1 Mar 5, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Add MIT License Oct 28, 2013
Makefile
README.md
excited_virus.c
hello-packet.c Rename hello to hello-packet Oct 8, 2013
hello.c Add the hello world module Nov 27, 2013
rickroll.c Fix a trivial typo in a comment Mar 4, 2015
rootkit.c Don't return a read error when writing to /proc/buddyinfo Oct 8, 2013

README.md

Kernel module fun

Motivation

I didn't know at all how kernel modules worked. This is me learning how. This is all tested using the 3.5.0-18 kernel.

Contents

hello.c: a simple "hello world" module

hello-packet.c: logs every time your computer receives a packet. This one could easily be modified to drop packets 50% of the time.

rootkit.c: A simple rootkit. blog post explaining it more

Compiling them

I'm running Linux 3.5.0-18. (run uname -r) to find out what you're using. This almost certainly won't work with a 2.x kernel, and I don't know enough. It is unlikely to do any lasting damage to your computer, but I can't guarantee anything.

I have my kernel sources set up in /lib/modules/3.5.0-18-generic. I think I only needed to run

sudo apt-get install linux-headers-3.5.0-18-generic

but I don't remember for sure. If you try this out, I'd love to hear.

To compile them, just run

make

Inserting into your kernel (at your own risk!)

sudo insmod hello.ko
dmesg | tail

should display the "hello world" message

You can’t perform that action at this time.