Panic linux ldconfig with MUTEX_PROFILING
Bruce Evans
bde at zeta.org.au
Thu Jul 10 03:40:42 PDT 2003
On Thu, 10 Jul 2003, Dag-Erling [iso-8859-1] Sm=F8rgrav wrote:
> Jun Kuriyama <kuriyama at imgsrc.co.jp> writes:
> > I'm trying to use MUTEX_PROFILING, but paniced in linux ldconfig.
> > Any clues?
>
> is COMPAT_LINUX compiled into the kernel? You can't use modules with
> MUTEX_PROFILING; it changes the size and layout of struct mtx, and
> since modules aren't built with the same options as the kernel, they
> use the wrong struct mtx.
This was broken in rev.1.9 of _mutex.h:
% RCS file: /home/ncvs/src/sys/sys/_mutex.h,v
% Working file: _mutex.h
% head: 1.9
% ...
% ----------------------------
% revision 1.9
% date: 2002/12/29 11:14:41; author: phk; state: Exp; lines: +6 -1
% Save 16 bytes per mutex if MUTEX_PROFILING is not defined.
%
% MUTEX_PROFILING is in opt_global.h, so this does not introduce a risk of
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
% variant structure sizes unless foreign kernel modules are used.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%
% This saved 16 bytes per vnode and 16 bytes per vm object for a total of
% 4MB on a 2GB machine.
%
% Idea from:=09alc
% ----------------------------
Actually, this ensures variant struct sizes if *any* kernel module is used.
The saving is machine-dependent (24 instead of 16 on most 64-bit
machines). If bloat is a problem, then there is plenty more in the
mutex struct (not to mention the vnode struct) that could be attacked
(mainly for LOCK_DEBUG in the case of mutexes). I think mutex profiling
should use external data, but this would be less efficient and more
work to implement. Perhaps similarly for LOCK_DEBUG, but LOCK_DEBUG is
still needed in most configurations, unlike MUTEX_PROFILING.
Bruce
More information about the freebsd-current
mailing list