From owner-freebsd-bugs@FreeBSD.ORG Mon Feb 16 13:30:21 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 73DEF16A4D4 for ; Mon, 16 Feb 2004 13:30:21 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E9AD43D3F for ; Mon, 16 Feb 2004 13:30:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1GLULbv059009 for ; Mon, 16 Feb 2004 13:30:21 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1GLULPb059008; Mon, 16 Feb 2004 13:30:21 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 16 Feb 2004 13:30:21 -0800 (PST) Resent-Message-Id: <200402162130.i1GLULPb059008@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dan van Pelt Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8068016A4D2 for ; Mon, 16 Feb 2004 13:28:30 -0800 (PST) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B40C43D2F for ; Mon, 16 Feb 2004 13:28:30 -0800 (PST) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i1GLSU72051575 for ; Mon, 16 Feb 2004 13:28:30 -0800 (PST) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.10/8.12.10/Submit) id i1GLSUbC051559; Mon, 16 Feb 2004 13:28:30 -0800 (PST) (envelope-from nobody) Message-Id: <200402162128.i1GLSUbC051559@www.freebsd.org> Date: Mon, 16 Feb 2004 13:28:30 -0800 (PST) From: Dan van Pelt To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: kern/62930: Use of mlockall(2) causes erratic behavior in subsequent programs X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2004 21:30:21 -0000 >Number: 62930 >Category: kern >Synopsis: Use of mlockall(2) causes erratic behavior in subsequent programs >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 16 13:30:20 PST 2004 >Closed-Date: >Last-Modified: >Originator: Dan van Pelt >Release: 5.2.1-RC2 >Organization: >Environment: FreeBSD neutrino 5.2.1-RC2 FreeBSD 5.2.1-RC2 #0: Fri Feb 13 23:37:00 PST 2004 dan@neutrino:/usr/src/sys/i386/compile/NEUTRINO i386 >Description: A program which calls mlockall(2) without calling munlockall(2) before it exits seems to cause the OS to randomly deliver SIGBUS to other programs not only running in the shell that ran the original offending program but also in separate shells that are running under different UIDs. >How-To-Repeat: First, compile the following and run as root: --------------------- #include #include #include #include int main (void) { if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) fprintf(stderr,"mlockall(2) failed.\n"); return (0); } --------------------- At this point, subsequent commands issued to the shell will periodically and randomly fail with the following: neutrino# ls Bus error (core dumped) neutrino# You may have to run 'ls' (or another command) twenty or more times before the command finally fails. I have tested this on other systems to verify that it wasn't my hardware. The time (# of calls) that it takes the command to fail doesn't seem to vary much based on avail. memory, et al. >Fix: Making sure the application calls munlockall(2) before it exits seems to alleviate this behavior, but I'm not sure this is really a fix since AFAIK, the application shouldn't need to call munlockall(2) before exiting. >Release-Note: >Audit-Trail: >Unformatted: