Writing a plain text file to disk from kernel space

Lawrence Stewart lstewart at room52.net
Wed May 23 02:23:35 UTC 2007


To add another interesting bit to the puzzle... if I install both input 
and output pfil hooks, and use ping to generate network traffic, the 
writing to file in both the input and output hook works perfectly as 
well - even at high packet rates. Here's the weird bit: the second I try 
and initiate a TCP connection, I get a kernel panic.

So it seems that it is only when I generate TCP outbound traffic that 
the kernel panic happens. If I telnet to a closed port on a valid IP,  I 
don't get a panic. If I telnet to an open port on a valid IP, it doesn't 
panic until I attempt to send the first bit of user data down the 
socket... so it seems that it's panicing on threads that are sheparding 
outbound TCP user data through the kernel. Outbound TCP SYN and ACK pkts 
used in the 3 way handshake to establish TCP connection don't cause the 
panic.

To me, that says that there is something funky going on with the threads 
that TCP connections use when sending packets down through the network 
stack.

Can anyone shed some light on why threads that handle the processing of 
outbound TCP packets containing user data would cause a vnode write to 
fail because of a sleeping thread issue? From what I can gather, there 
must be some difference in the way the threads are created/configured... 
but I have no idea where to start looking to figure out what's going on 
here.

Cheers,
Lawrence


More information about the freebsd-hackers mailing list