From nobody Wed Sep 04 14:29:03 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WzPxq4Rnrz5V0yd; Wed, 04 Sep 2024 14:29:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzPxq1gtfz48tG; Wed, 4 Sep 2024 14:29:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725460143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jO2eFrjoAmCrs6oVS/naEdxsIRMIOrg5Tx8xV7uIGfk=; b=UnjXWG0qRmBaKvDNBbkF2YdI9TKnaGaK76DnWhF/ZaxhtOPePi7OzdVqkR6J7JgX8CJFzX v1sLpvCLweXeV9FL6x7XR/o0JbAOCZMd52YxraBdPkenkFuGlNryNorf6SgZnosHJ61oJP ppVNRaMxMkpL9LPkx8jEl/maqp6Lp0mlIfRoH3le9Fp/reNchNSFBzRAWz4N3vNkZcHvd3 Nf9ZpDipIj//0VjFZdQKHWGZME6NkSQHPpDUk9WdGMgxOI6PnDQPxpHG3MZ1OpOi08AALE RVUCd+LljkC8vwwqKZ5ep9gwepGO68kOMj3Tm8eI6SE8rZqzSRy08AMQu4K61A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725460143; a=rsa-sha256; cv=none; b=mLjO6q41v5f5p7VjyfghYRNs25S9Ndp2wt/Qu+gSWeEfL5UbjMHrJMkTds+gyHZ1uO0kGY RaJQR2JQZzqwsixPVUlQGUB0w+RDVKpIV7ndBNgsZ89Nrvmb5f8IjpkTtUIWcKE/KyEtj2 inZLYfmSvdsgnTTTsewmgMITJxegpCFLVFO2WWqOfV9BRCIJCfPTJEtOgPg6s7y0Oj2f9f RDtc26HGynfFIBzvq05Kn7FMKXewJq6oQ/I68xaPMHUzlv9nCtWLWEteH0hfOO2X+yHMgQ i+0UqDcYgab+HetrwTIvlDWgxLY+1oj3ZjyD2syqyz3AOlNbVMl8C+ePW6fxKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725460143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jO2eFrjoAmCrs6oVS/naEdxsIRMIOrg5Tx8xV7uIGfk=; b=PLQXDRo/e67Z3bto1lO9EhD7UrbFXNifJcboDEm1wonUEjk9CNpaLTxSY2wAB5KNNneQIE vUmUgzdNAe3DNonQtfWDkyk1qoqkz+OvzNc72iqGz8R4VYakt/6LTBg65dcUyJR2OXw0EL kdQzyHvh0EXiFf8dK3YOr0Fk7935KfSJmRRRNMXkaFl11R6WIgRX5KBMeHz7Oc8ib1X/6z xLZFUQrcpdT22jJjYMxlwjZLouwS/u6B5EYVjr7QwgS4A3lDb+dthWWOtfh3v7KY2nxCgo 5wrYTbqs4j0+1nK5VO4YVoO147DcrapPMPRQy3n0XfilzGrztT+29h+vdmbdiA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WzPxq0jWLzShG; Wed, 4 Sep 2024 14:29:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 484ET3qL066112; Wed, 4 Sep 2024 14:29:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484ET3qf066109; Wed, 4 Sep 2024 14:29:03 GMT (envelope-from git) Date: Wed, 4 Sep 2024 14:29:03 GMT Message-Id: <202409041429.484ET3qf066109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 01f43479b592 - main - ipsec: Drain async ipsec_offload work when destroying a vnet List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01f43479b5925d5e1f996a5ae2929aa2d2aab83b Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=01f43479b5925d5e1f996a5ae2929aa2d2aab83b commit 01f43479b5925d5e1f996a5ae2929aa2d2aab83b Author: Mark Johnston AuthorDate: 2024-08-30 00:44:45 +0000 Commit: Mark Johnston CommitDate: 2024-09-04 14:28:28 +0000 ipsec: Drain async ipsec_offload work when destroying a vnet Re-apply commit e196b12f4d4d. This was reverted by commit 28294dc92476 because it could trigger a deadlock, but the underlying problem there was fixed in commit f76826b892de. Reported by: KASAN Reviewed by: kib Fixes: ef2a572bf6bd ("ipsec_offload: kernel infrastructure") Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D46483 --- sys/netipsec/ipsec_offload.c | 2 +- sys/netipsec/key.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c index a06e91ada1a1..19719a8f171b 100644 --- a/sys/netipsec/ipsec_offload.c +++ b/sys/netipsec/ipsec_offload.c @@ -392,7 +392,7 @@ ipsec_accel_sa_newkey_impl(struct secasvar *sav) TASK_INIT(&tq->install_task, 0, ipsec_accel_sa_newkey_act, tq); tq->sav = sav; - tq->install_vnet = curthread->td_vnet; /* XXXKIB liveness */ + tq->install_vnet = curthread->td_vnet; taskqueue_enqueue(ipsec_accel_tq, &tq->install_task); } diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 5a3e5727bc2e..ad1d6164f158 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -8713,6 +8713,9 @@ key_vnet_destroy(void *arg __unused) } SAHTREE_WUNLOCK(); + /* Wait for async work referencing this VNET to finish. */ + ipsec_accel_sync(); + key_freesah_flushed(&sahdrainq); hashdestroy(V_sphashtbl, M_IPSEC_SP, V_sphash_mask); hashdestroy(V_savhashtbl, M_IPSEC_SA, V_savhash_mask);