svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig share/man/man4 sys/kern sys/net sys/sys

Brooks Davis brooks at FreeBSD.org
Thu Nov 12 16:10:07 UTC 2009


On Thu, Nov 12, 2009 at 03:21:40PM +0000, Robert Watson wrote:
> 
> On Thu, 12 Nov 2009, Dag-Erling Sm??rgrav wrote:
> 
>>> So there used to be four chars in a row here (between if_description and 
>>> if_cspare). Are you sure moving the pointer in between doesn't increase 
>>> the structure size?
>> 
>> I can guarantee you that it does.  On i386, for instance, there are now 
>> three bytes of implicit padding between if_alloctype and if_description, 
>> and one more between if_cspare and if_pspare, so struct ifnet has grown by 
>> four bytes.
>> 
>> We should have CASSERTs for sizeof(struct ifnet) and other structs we 
>> really care about.
> 
> We care less about ifnet than we used to, because ifnet is now allocated by 
> the kernel rather than drivers.  However, if we want to take our KPI/KBI 
> more seriously, then CTASSERTs on other "public" kernel structures might 
> well be a good idea.  On the other hand, CTASSERT errors on build are 
> almost impervious to mortal comprehension (if you haven't seen them before, 
> they make little sense to the reader), and will make it more difficult for 
> people hacking on our kernel to do so casually.  Some sort of other static 
> checker might make more sense, and perhaps allow us to do more intelligent 
> checking that just "total size" -- we'd also like to detect rearrangement 
> of sensitive structs that would be size-preserving.

In this specific case, we should remove all the spare pointers since
they don't really add value.  The only rule should be that when you MFC
you have to add to the end rather than inserting in the strictly logical
location.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091112/0d314d92/attachment.pgp


More information about the svn-src-all mailing list