http://web2.clarkson.edu/projects/itl/cs654.fa04/kernelDebug/

Linux Kernel projects

Jason Herne
CS654 - Advanced Topics in Networks
10/21/04

  The work contained on this page is a result of a class project for my
Advanced Topics in Networks class.  

  The CS654 class focuses on reading, understanding, and researching 
current/past issues in computer networks.  As part of this, the class was 
given an assignment to explore the Linux kernel's TCP/IP code and try to 
explain why it appears to deviate from the TCP New Reno specification.  We were
unable to come up with a definitive answer but we learned a lot and produced a 
lot of good documentation in the process.   This page represents my share of 
that work.

Links to my work

Deploying User Mode Linux for Linux Kernel Debugging A HOWTO for using UML to debug the linux kernel. tcp_transmit_skb() with extra comments A heavily commented version of the tcp_output.c:tcp_transmit_skb() function What I learned: Throughout this project I have been reading and studying the Linux kernel code for the IPv4 TCP layer of the network stack. This has proven to be quite an educational experience for me. What I've learned includes: - How to read other peoples code more effectively. - How to search kernel code using the "Linux Kernel Cross Reference". - Kernel code is not commented well. - How #ifdefs are used to create portable (but unreadable) code. - What bit fields are and how they are used. - Intricate pointer arithmetic using typed pointers. - How to use and understand binary arithmetic and operations like binary shifting, logical and/or. - What the difference is between big/little endian. - Understanding of kernel data structures like skbuff, tcp_opt, and tcp_hdr. - How C macros are used in the kernel to simplify code. - Learned a lot about the inner workings of TCP and specifically TCP within the Linux kernel. - How to set up and make use of User Mode Linux (UML). - How to apply patches to kernel code. - How to use gdb/ddd to debug kernel level code. Results: I have produced a heavily commented (based on my understanding) version of the Linux kernel TCP output function tcp_transmit_skb(). I also discovered that this is the function responsible for actually building a packet header and transmitting the packet over a network interface. My modified version of this function helps make sense of much of the obscure methods employed by the kernel programmers, and also shed light on how the TCP stack works. It could be used as an educational tool. I have also produced a 12 page guide for setting up UML for debugging the Linux kernel. Many obscure and barely documented problems have been addressed in the guide to ensure that a beginner will experience minimal delays trying to learn how to use UML.

Reply via email to