Received: by mail.netbsd.org (Postfix, from userid 605) id 278D884D82; Thu, 30 Nov 2017 02:45:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id A3FD784D81 for ; Thu, 30 Nov 2017 02:45:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id fCqbsTdyViG5 for ; Thu, 30 Nov 2017 02:45:12 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 3F97D84D39 for ; Thu, 30 Nov 2017 02:45:12 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 3D4C4FB40; Thu, 30 Nov 2017 02:45:12 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Thu, 30 Nov 2017 02:45:12 +0000 From: "Ryota Ozaki" Subject: CVS commit: src/sys/netipsec To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20171130024512.3D4C4FB40@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: source-changes.NetBSD.org Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Ryota Ozaki" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: ozaki-r Date: Thu Nov 30 02:45:12 UTC 2017 Modified Files: src/sys/netipsec: key.c Log Message: Fix a deadlock happening if !NET_MPSAFE If NET_MPSAFE isn't set, key_timehandler_work is executed with holding softnet_lock. This means that localcount_drain can be called with holding softnet_lock resulting in a deadlock that localcount_drain waits for packet processing to release a reference to SP/SA while network processing is prevented by softnet_lock. Fix the deadlock by not taking softnet_lock in key_timehandler_work. It's okay because IPsec is MP-safe even if !NET_MPSAFE. Note that the change also needs to enable pserialize_perform because the IPsec code can be run in parallel now. Reported by christos@ To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/sys/netipsec/key.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.