From owner-freebsd-bugs Wed Jun 28 20:10: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id BF90A37BA18 for ; Wed, 28 Jun 2000 20:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id UAA61484; Wed, 28 Jun 2000 20:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Wed, 28 Jun 2000 20:10:01 -0700 (PDT) Message-Id: <200006290310.UAA61484@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/19553: "panic: zone: entry not free" in namei Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/19553; it has been noted by GNATS. From: Bruce Evans To: Gregory Bond Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/19553: "panic: zone: entry not free" in namei Date: Thu, 29 Jun 2000 13:01:33 +1000 (EST) On Wed, 28 Jun 2000, Gregory Bond wrote: > To: David Malone > > You often see panics if you compile with INVARIANTS and then load > > modules which have not been compiled with INVARIANTS. Could this > > be the problem? > > Well spotted. > > I was loading cd9660 from a module. Once I compiled it into the kernel (with > INVARIANTS), the recipe no longer panics but works as expected. > > The trick is that isofs/cd9660/cd9660_vnops.c also uses namei_zone, but when > compiled without INVARIANTS (in the module), the deallocator is not clearing > the "in use" flag that the allocator in the kernel (compiled with INVARIANTS) > is checking at the next allocation, which happens to be inside namei(). > > nfs.ko and union.ko also use namei_zone and would be vulnerable to the same > problem. > > Perhaps a note in LINT next to the INVARIANTS entry explaining this? [Patch > attached] No, this is a bug in INVARIANTS. It is caused by bogus ifdefs on INVARIANTS in vm_zone.h. All ifdefs on kernel options in header files are wrong, but these ifdefs are wronger than others since INVARIANTS is supposed to be settable for single source files. The correct fix seems to be to clear the "in use" flag unconditionally, although this will bloat the zone allocator a little. INVARIANTS support in vm_zone.c is also broken. Some things conditional on INVARIANTS need to be conditional on INVARIANT_SUPPORT in case vm_zone.c is not one of the source files compiled with INVARIANTS configured. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message