Subject: Re: Adding KASSERT() calls to "sys/sys/queue.h"
To: Matthias Scheler <>
From: Bill Studenmund <>
List: tech-kern
Date: 06/16/2004 16:09:54
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jun 16, 2004 at 08:48:11PM +0000, Matthias Scheler wrote:
> 	Hello,
> while I was examining PR kern/25868 I discoverd that a mbuf was freed twi=
> and therefore inserted into a pool twice. I finally found the code causing
> the bug by modifying MFREE() like this:


> They will of course not catch all possible errors but they would have
> noticed the problem described above.
> Opinions?

I think it would be good to have such tests around. I'm not sure if they=20
should be turned on with all the other queue debugging or with a second,=20
additional control. I tend to think the latter, as exactly what error=20
we're looking for can vary from problem to problem; I thought the current=
debug tests were to notice gross queue corruption whereas your check=20
catches incorrect queue use. But it could be that the test is cheep enough=
that the difference doesn't matter.

I am concerned though about the use of a bare KASSERT() though. It is
reasonable to use sys/queue.h macros in userland, which doesn't have a
KASSERT() defined (AFAICT). So a second define to turn on the KASSERT=20
would probably be best.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)