Subject: NetBSD Security Advisory 2000-004
To: None <>
From: NetBSD Security Officer <>
List: netbsd-announce
Date: 05/28/2000 23:46:30

                 NetBSD Security Advisory 2000-004

Topic:		SysV semaphore denial-of-service
Version:	all prior to 2000/05/27
Severity:	minor (local denial of service to programs using the
		rarely-used semaphore facility)


An undocumented system call permits any user process to lock up the
entire semaphore subsystem, preventing processes using semaphores from
locking or unlocking them, and preventing processes holding semaphores
from exiting.  

Note: FreeBSD-SA-00:19 describes a similar, but significantly more
severe problem affecting FreeBSD, and notes that NetBSD is also
affected.  The impact of the problem on NetBSD is much less, because
NetBSD's semaphore implementation was fixed (in 1994) so that only
semaphore-using processes would be blocked at exit time.

Technical Details

The undocumented semconfig(2) system call is used by ipcs(1) to
"freeze" the state of semaphores so that a self-consistant snapshot
could be displayed.  However, this could then be abused to lock the
semaphore system, preventing all semaphore operations from
progressing, and leave it locked until the locking process exited.
The fix is to disable this unnecessary locking; other comparable
/dev/kmem-reading programs such as ps(1) and netstat(1) have never
needed this sort of locking.

Solutions and Workarounds

Only programs which make use of semaphores are affected by this

If you are unsure if any applications use semaphores, use the ipcs(1)
command; if it displays more than simple column headers, there is
active use of semaphores on your system.  For example:

% ipcs -s
T     ID     KEY        MODE       OWNER    GROUP
s 524288         -1 --rw-------      wes    wheel

Note that this test is not 100% conclusive; however, use of System V
semaphores is extremely rare.

If you determine that your system may run programs which use semaphore
you should patch your kernel as follows:

For formal NetBSD releases, you should to download the appropriate
source patch listed below, apply it to your kernel source tree using
the patch(1) command.  For NetBSD-current, you should update your
source tree (with either sup or anonymous CVS).  In both cases, you
then need to rebuild, install the newly built kernel, and reboot. For
more information on how to do this, see: 

For NetBSD 1.4, 1.4.1, and 1.4.2:
 A patch is available in


For NetBSD-current:

 NetBSD-current since 20000527 contains all the fixes, and is not
 vulnerable.  Users of NetBSD-current should upgrade to a source tree
 dated 20000527 or later.

Thanks To

The FreeBSD security officer, for bringing the problem to our

Bill Sommerfeld for coding and testing the fix.

Revision History

	2000/05/27 - initial version.

More Information

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.

Copyright 2000, The NetBSD Foundation, Inc.  All Rights Reserved.

$NetBSD: NetBSD-SA2000-004.txt,v 1.3 2000/05/29 01:01:11 sommerfeld Exp $

Version: 2.6.3ia
Charset: noconv