Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

56quarters/modgrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modgrot

Yes, hello

modgrot is a Linux kernel module implementation of several critical functions performed by a Slack bot (grot) at Grafana.

What?

modgrot creates a character device that can do two things:

  • Say "Yes, hello" when read.
  • Accept writes (up to 255 bytes) and reply with that data the next time the device is read.

That's it.

Why?

Gotta go fast. Moving Slack bot functionality into the Linux kernel was the next logical evolution. For some reason.

Setup

Follow the steps below to build and load modgrot.

WARNING Loading kernel modules has the potential to crash your machine and I'm not very good at writing C. You have been warned!!!

Assumptions:

  • You are running Ubuntu 20.04 LTS (Focal Fossa) as your host OS
  • You will use an Ubuntu 20.04 LTS (Focal Fossa) as your guest OS (QEMU VM)

Get modgrot source

git clone git@github.com:56quarters/modgrot.git && cd modgrot

Get kernel source

The modgrot Makefile will download, unpack, and configure sources for the 5.4 Linux kernel (since this is what Ubuntu 20.04 LTS uses).

make linux-setup

Next, in the kernel sources directory, copy Modules.symvers from your local modules to our copy of the kernel source.

cp /lib/modules/`uname -r`/build/Module.symvers .

Build

If everything worked, you should be able to build the module now from the root of the modgrot repo.

make

Running

To run the kernel module in a VM, you'll need

  • KVM enabled
  • QEMU installed
  • cloud-image-utils installed

After installing everything, run:

make qemu-download
make qemu-cloud-init
sudo make qemu

If everything worked, you'll have an Ubuntu VM starting up with the default user ubuntu and the password ubuntu, with a directory shared with the host.

Next step, load the module in your VM.

sudo -i
cd /mnt/shared
insmod grot.ko

Try reading the newly created device.

cat /dev/grot
Yes, hello

Bam.

References

About

Yes, hello

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors