cvs commit: src/sys/fs/pseudofs pseudofs_vnops.c
Robert Watson
rwatson at FreeBSD.org
Mon Aug 18 17:54:46 PDT 2003
On Mon, 18 Aug 2003, John Baldwin wrote:
> On 18-Aug-2003 Dag-Erling Smørgrav wrote:
> > John Baldwin <jhb at FreeBSD.org> writes:
> >> Log:
> >> The allproc lock is a sx lock, not a mutex, so fix the assertion. This
> >> asserts that the sx lock is held, but does not specify if the lock is held
> >> shared or exclusive, thus either type of lock satisfies the assertion.
> >
> > 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?
>
> 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?
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 at fledge.watson.org Network Associates Laboratories
More information about the cvs-src
mailing list