Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating new system calls via KLD in FreeBSD

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.

like image 285
dckrooney Avatar asked Oct 09 '10 03:10

dckrooney


1 Answers

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)
like image 89
claws Avatar answered Nov 17 '22 20:11

claws