Are there any good (entry-level) tutorials on adding system calls to FreeBSD via kernel loadable modules? Specifically, the required form of the methods, getting information from processes, etc.
+5
A:
I'm really happy to see that your professor is giving you such practical assignments. I wish I had such profs.
Anyway, the thing is when you are working in the kernel domain you can hardly find any resources. People who are working in kernel domain don't document stuff or write tutorials. So, its really hard to find any "Entry Level" documents. Also, even if you find any such tutorial, the things in kernel keeps on changing and document wont be updated. When I started I had to learn things by reading the kernel code.
Another important thing is Linux is more documented than any UNIX. Sometimes you can read Linux stuff and port that knowledge to UNIX. Enough with the complaining. Now here are the resources that might help you.
BSD UNIX:
- Dynamic Kernel Linker (KLD) Facility Programming Tutorial has "KLD Syscall Implementation Skeleton"
- Designing BSD Rootkits: An Introduction to Kernel Hacking This teaches you another approach using Runtime kernel patching (generally Trojans use this approach) to patch the system call dispatcher and create a system call.
Linux:
- Adding A System Call to Linux Kernel : A step by step tutorial
- Kernel command using Linux system calls : Explore the Linux system call interface (SCI), learn how to add new system calls (and alternatives for doing so)
claws
2010-10-09 05:13:23
Thanks so much! This was very helpful.
dcmoebius
2010-10-09 20:37:14
@dcmoebius: I'm glad it helped you. If you don't have any problem sharing your code. I would suggest you to write a tutorial/blog post on this assignment. And give the link here. It will help others.
claws
2010-10-10 04:01:20
@claws: That's a great idea. I'll do that, but unfortunately later assignments are based on this one. So I'll wait a couple weeks to release a "solution" :P
dcmoebius
2010-10-21 03:38:48