netstat wierdness?

Robert Watson rwatson at FreeBSD.org
Wed Mar 14 14:48:55 UTC 2007


On Tue, 13 Mar 2007, Julian Elischer wrote:

> Dag-Erling Smørgrav wrote:
>> Julian Elischer <julian at elischer.org> writes:
>>> answering myself.. comes from having options LOCK_PROFILING in my kernel. 
>>> adding the same to /etc/make.conf and recompiling netstat and libkvm 
>>> helped. (not sure if both are needed)
>> 
>> This is very bad.  LOCK_PROFILING should have no visible effect on 
>> userland.  That is precisely what xinpcb, xunpcb, xtcpcb etc. are for: to 
>> isolate userland from kernel structures.  They should not contain any locks 
>> or anything else which would be affected by LOCK_PROFILING or other kernel 
>> options.
>
> sockstat actually told me that all those were the wrong size, so apparently 
> they change size too.(!?)
>
> I haven't gone to look at their definition yet, but as you say, it sounds 
> like something was done wrong.

The x* structures in netinet are not correctly implemented, and do incorporate 
kernel data structures.  I've been meaning to fix that for ages, but haven't 
had time.  In the mean time, we should continue to avoid having the size of 
kernel data structures vary with kernel options.  This is also important so 
that you can use /dev/kmem on core dumps, etc, so while fixing the x* 
structures for netinet is important, it doesn't eliminate the need to avoid 
variable data structure sizes.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-current mailing list