FreeBSD Kernel buffer overflow

Matthew Dillon dillon at apollo.backplane.com
Fri Sep 17 02:46:54 PDT 2004


:pass more arguments and added a KASSERT in trap.c that is only enabled for
:kernels compiled with INVARIANTS turned on?
:...
:
:A KASSERT() wrapped in #ifdef INVARIANTS has zero overhead for normal,
:non-debugging kernels.  The developers who are responsible for writing and
:testing new system calls should use INVARIANTS anyway, so they'll quickly
:catch the mistake.
:
:- - Giorgos

    KASSERT()'s are only compiled in if INVARIANTS is turned on anyway.
    If you don't have INVARIANTS turned on, all your KASSERT's go poof.

    Look at the #define KASSERT in sys/systm.h.

    I strongly recommend that all kernels always be compiled with INVARIANTS
    turned on.  Even production kernels.  I believe GENERIC defaults to
    INVARIANTS turned on.  I'm not sure what is done during release cycles
    but presumably INVARIANTS is left on for the release build as well (if it
    isn't it should be).

						-Matt



More information about the freebsd-hackers mailing list