Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Aug 2003 20:54:42 -0400 (EDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org
Subject:   Re: cvs commit: src/sys/fs/pseudofs pseudofs_vnops.c
Message-ID:  <Pine.NEB.3.96L.1030818205114.4345A-100000@fledge.watson.org>
In-Reply-To: <XFMail.20030818154036.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 18 Aug 2003, John Baldwin wrote:

> On 18-Aug-2003 Dag-Erling Sm=F8rgrav wrote:
> > John Baldwin <jhb@FreeBSD.org> writes:
> >>   Log:
> >>   The allproc lock is a sx lock, not a mutex, so fix the assertion.  T=
his
> >>   asserts that the sx lock is held, but does not specify if the lock i=
s held
> >>   shared or exclusive, thus either type of lock satisfies the assertio=
n.
> >=20
> > My bad - but why didn't I get a warning about the incorrect pointer
> > type?  And why did the code run fine with INVARIANT_SUPPORT and
> > INVARIANTS defined?  Just lucky?
>=20
> It shouldn't have compiled in a static kernel, and the module should
> have failed to load.  You did get a warning actually, that is how I
> noticed this.  module builds don't error out on warnings though, only
> kernel builds do.  Ah 'allproc' is the name of the actual linked list
> head, so the module did load and link ok, it just examined the head of
> the allproc list and treated that as a mutex.  I've no idea why it
> worked.  Perhaps your kernel did not have INVARIANT_SUPPORT defined in
> its config?=20

Modules are built without the kernel configuration context, so modules are
never built with conditionally compiled INVARIANTS pieces.  In order for
any assertions in a module to get compiled in, you have to add INVARIANTS
to the module Makefile.  We have to link mac_test into the kernel itself
rather than use a module if we want any of its assertions to trigger.  As
a result of all this, if any of the conditionally compiled code would
generate a compiler error or a warning, you don't hit it with a module
build either...

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Network Associates Laboratories




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1030818205114.4345A-100000>