From owner-freebsd-stable@FreeBSD.ORG Tue Sep 24 21:21:34 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2B5679AF for ; Tue, 24 Sep 2013 21:21:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A8B8A2C32 for ; Tue, 24 Sep 2013 21:21:33 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r8OLLRiN043446; Wed, 25 Sep 2013 00:21:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r8OLLRiN043446 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r8OLLRYU043445; Wed, 25 Sep 2013 00:21:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 25 Sep 2013 00:21:27 +0300 From: Konstantin Belousov To: Patrick Lamaiziere , freebsd-stable@freebsd.org Subject: Re: Possible kqueue related issue on STABLE/RC. Message-ID: <20130924212127.GQ41229@kib.kiev.ua> References: <20130912073643.GM41229@kib.kiev.ua> <20130920151705.33aae120@mr129166> <20130923153708.45c3be3d@mr129166> <20130923203141.GV41229@kib.kiev.ua> <20130924094427.0f4b902a@mr129166> <20130924082909.GH41229@kib.kiev.ua> <20130924114738.60c700c9@mr129166> <20130924121434.GI41229@kib.kiev.ua> <20130924174517.GB14220@funkthat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PgVg6bJejIHNFqRl" Content-Disposition: inline In-Reply-To: <20130924174517.GB14220@funkthat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2013 21:21:34 -0000 --PgVg6bJejIHNFqRl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 24, 2013 at 10:45:17AM -0700, John-Mark Gurney wrote: > I'd like to understand why you think protecting these functions w/ > the _DETACHED check is correct... In kern_event.c, all calls to > f_detach are followed by knote_drop which will ensure that the knote > is removed and free, so no more f_event calls will be called on that > knote.. My current belief is that what happens is a glitch in the kqueue_register(). After a new knote is created and attached, the kq lock is dropped and then f_event() is called. If the vnode is reclaimed or possible freed meantime, f_event() seems to dereference freed memory, since kn_hook points to freed vnode. The issue as I see it is that vnode lifecycle is detached from the knote lifecycle. Might be, only the second patch, which acquires a hold reference on the vnode for each knote, is really needed. But before going into any conclusions, I want to see the testing results. --PgVg6bJejIHNFqRl Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (FreeBSD) iQIcBAEBAgAGBQJSQgJWAAoJEJDCuSvBvK1BW5UP/RKHmw7vio4PnCbXcBfjfWWX CKClfIeVOvMGmouOWzUUZzsVnb5ne9LMWOkpCyIwFMAxXrD5m9OKVmfWV5LTb5DF CXLGeK/DIAYUd1bJVhgTE/NCVCK2FpvYTLDW257+S+oGvwYaYK/n5QfOtwATf21l gAXn41A8mrfSLgvX05bNr+We05AJ5bB4NwIIDc3IkatbqNgPFnX+ffmiUut9yHOZ fjN15LhfHaIUz7f781x8Chyv6F89aQDZZFswl6dvzecU4cHSuiBu5YrSQMOEN9rs pYVS/fCQjEG0T9i0tvf0W2Tfhhxg8noU7wi5QSihhImg+3vyLdTyLPtMVE2r0C99 V4NqVSc3Tf1okAIUsZv1weKlMF9VdZ17yTOiDZ/wm5mzNu1u5zeZKhZBqEpfucCV hlnXA4qG34+crBVIeTn/PvxbBJIrHweddMZG1nE7P8+v7gZI7uIJbDSs7lWDGfbt K5VI3XhAMgr9hshG4XARNKhsIhcB7MaBStE2JkNM+Wckuo5jqaVtCEDJPh7mIHph 9bng0YRZtPn18zUfIIIj/yM2spwixMKkO4NI5JXF2+k+4pB9oSS+vv5qDKNvY0cH 1mJ89vHfQhEz8vOsvQp9rNHqPGzbuDjkcYxc451KdQFft8QcCThEf2i4pKdzZ44U 053gy6wKf3oaguNuS+kE =13Cg -----END PGP SIGNATURE----- --PgVg6bJejIHNFqRl--