From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21794 invoked by alias); 9 Oct 2007 05:37:04 -0000 Received: (qmail 21781 invoked by uid 22791); 9 Oct 2007 05:37:02 -0000 X-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_50,DK_POLICY_SIGNSOME,TW_FD X-Spam-Check-By: sourceware.org Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 09 Oct 2007 05:36:59 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 08 Oct 2007 22:36:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.21,246,1188802800"; d="scan'208";a="167476313" Received: from fmsmsx333.amr.corp.intel.com ([132.233.42.2]) by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2007 22:36:57 -0700 Received: from scsmsx412.amr.corp.intel.com ([10.3.90.31]) by fmsmsx333.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 8 Oct 2007 22:36:57 -0700 Received: from scsmsx415.amr.corp.intel.com ([10.3.90.34]) by scsmsx412.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 8 Oct 2007 22:36:56 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [patch] Close fds before execute a cmd Date: Tue, 09 Oct 2007 05:37:00 -0000 Message-ID: <16D5B9AB904B0B46B22A27002EE3A8C8FFFE83@scsmsx415.amr.corp.intel.com> In-Reply-To: <470B0D2A.4070401@cn.fujitsu.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [patch] Close fds before execute a cmd Thread-Index: AcgKMmzacFJhpMBTTvOEYzUjVpNv+QAAya4A References: <470B0D2A.4070401@cn.fujitsu.com> From: "Stone, Joshua I" To: "Lai Jiangshan" , X-OriginalArrivalTime: 09 Oct 2007 05:36:56.0785 (UTC) FILETIME=[67E85410:01C80A36] X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2007-q4/txt/msg00093.txt.bz2 Lai Jiangshan wrote: > I traced this bug and at the last I found the reason: stapio did not > close some file descriptors before using execl() to run a cmd. The > processes of this cmd may read or write on the fds inherited from > stapio. Especially the fd of control_channel, if one of processes of > this cmd reads and writes on this fd, it communicates with > stap_XXXXXX.ko, and lots of BUGs occurred. (Does stap_XXXXXX.ko > support communicating with two or more processes at the same time?) It would be strange for an app to do anything on an already open fd, but not unheard of, I suppose.=20 Rather than brute-force closing all fd > 2, a better way might be to set FD_CLOEXEC in the appropriate places. Josh