From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 22 23:00:33 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 6D46216A41F for ; Fri, 22 Jul 2005 23:00:33 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 985D943D53 for ; Fri, 22 Jul 2005 23:00:32 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j6MN0Wca034852 for ; Fri, 22 Jul 2005 23:00:32 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j6MN0W6m034849; Fri, 22 Jul 2005 23:00:32 GMT (envelope-from gnats) Resent-Date: Fri, 22 Jul 2005 23:00:32 GMT Resent-Message-Id: <200507222300.j6MN0W6m034849@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, Paweł Jakub Dawidek Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D7D6216A420; Fri, 22 Jul 2005 22:53:29 +0000 (GMT) (envelope-from pjd@darkness.comp.waw.pl) Received: from darkness.comp.waw.pl (darkness.comp.waw.pl [195.117.238.136]) by mx1.FreeBSD.org (Postfix) with ESMTP id 994E743D45; Fri, 22 Jul 2005 22:53:28 +0000 (GMT) (envelope-from pjd@darkness.comp.waw.pl) Received: by darkness.comp.waw.pl (Postfix, from userid 1009) id 0F460ACAF4; Sat, 23 Jul 2005 00:53:20 +0200 (CEST) Message-Id: <20050722225320.0F460ACAF4@darkness.comp.waw.pl> Date: Sat, 23 Jul 2005 00:53:20 +0200 (CEST) From: Paweł Jakub Dawidek To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: sam@FreeBSD.org Subject: kern/83930: crypto_q_mtx recursion when unloading hifn.ko. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Paweł Jakub Dawidek List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2005 23:00:33 -0000 >Number: 83930 >Category: kern >Synopsis: crypto_q_mtx recursion when unloading hifn.ko. >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 22 23:00:32 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Pawel Jakub Dawidek >Release: FreeBSD 5.x >Organization: >Environment: >Description: I had a panic related to mutex recursion when unloading hifn.ko module. The code path is as follows: crypto_dispatch() CRYPTO_Q_LOCK() crypto_invoke() crypto_done() cryptodev_cb() (via crp->crp_callback) crypto_dispatch() CRYPTO_Q_LOCK() <- recursion. >How-To-Repeat: >Fix: Not sure how to fix it. Calling 'locked' version of crypto_dispatch() is not an option, as we can call cryptodev_cb() with or without crypto_q_mtx held. The only fix I can came up with right not is a "pseudo-recursion" in crypto_dispatch(): int unlock = 0; [...] if (!mtx_owned(&crypto_q_mtx)) { unlock = 1; CRYPTO_Q_LOCK(); } [...] if (unlock) CRYPTO_Q_LOCK(); >Release-Note: >Audit-Trail: >Unformatted: