From nobody Tue Nov 12 03:47:25 2024 X-Original-To: dev-commits-src-main@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 4XnXRf0Bmwz5d59t; Tue, 12 Nov 2024 03:47:26 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XnXRd6l97z4C9r; Tue, 12 Nov 2024 03:47:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731383245; 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=XjRUxBy0fKuiW0GTnH86JTPJigjATbOG7KGNy59APwk=; b=AJAyUu62kpVsriUh7fefjX8VXsW+RicKzw/VtOPyKJzRHNuexxtwprJ8fiQ7v/TqNR0Xbi ym0rkUnJTrQzafU4dtIUKI9HgKjdsSCzrhiKRa+SH7XmhitgwbbkAAGFMKqlkKLJtHyZ8C jl9Qbj7+RoXBKn16REmYj8HR0VrJL/qcV6XkkEa7VTmwd/nUFoVgGRQZQMBK1UK4v1TICr HzVbVjm2L2EJVt80YAexuS5oQ/6hVp2cCCvWHN5IGq9MzrdA92WqdQUMKJF1No5BjjbyPl oSfisYE0tY1PB56bbinVBR9BOCd5dNrtKjvUolQsPpPVSREHuZPM9/Kf4NVnIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731383245; 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=XjRUxBy0fKuiW0GTnH86JTPJigjATbOG7KGNy59APwk=; b=ZMNOZYGW0Wn0BUqOoqkin2A1mlc15xchTurjEc+W1Q4b6EdvrnXYYRKTWdBLFDdb8MoQCX 42UlqIO97BIkCQJnytckmO6DL4b8mDaKjpzmvDQiWF5jm94HZ8xnVzoN627nAwLWeB5raW PI8zaxZ+tNf3WXhUA7EwsZUBr4bWac/sSe/KkDnS5mxRRXwq33bIXtpn0Ld7WwFNVdtkGY Epn2WzqheuShISCBUHPToZJObmMDjP9MA2h8T3JzsDcrS1OOw8dVMX8pTp4aoHHI7VwW2L TPD4aQZCtDQbroXRbvRqNPcsLqD6SlWC8LVPtRuxrt8v1i4VZln7oziEkuAeFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731383245; a=rsa-sha256; cv=none; b=o1oeWgbngG9u1KtWAWrvTGa7LjShEdSvMwwbEdhGk6aJaIsIecm05LIZ3Hl1a7ZEqpIH7I zRAOa2IUgQ9A0OjTSzUKWBfLVCYbMaiihv0kcXXRJvNi8vpecEO1fF3lRB1vaK0e1j88ro af9bR37H/xcSGtN6zT/AWjDoM4hfjBbfD7BFw8BIgEbbFkm0FJNMf/E+n0Kr2RbTHeu/gz J7hSMjdxLdlgMC+/JRBfXCD07LWjGVEHMv0z8R2YcnmFDr7ckPMKNt89gdQEKjQuPSgSl5 JI/PgVDFBbXaa/E64/OXXND/D17+3Es5mVuEvvwbYqQmb6rFSgkK/hEqoI//UA== 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 4XnXRd600xzv0L; Tue, 12 Nov 2024 03:47:25 +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 4AC3lPHr015170; Tue, 12 Nov 2024 03:47:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AC3lPOA015167; Tue, 12 Nov 2024 03:47:25 GMT (envelope-from git) Date: Tue, 12 Nov 2024 03:47:25 GMT Message-Id: <202411120347.4AC3lPOA015167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 1fa6daaafd74 - main - ipfilter: Avoid stopping with a lock held List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1fa6daaafd74c1a457dcfe26e0a5943b5441dc9d Auto-Submitted: auto-generated The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=1fa6daaafd74c1a457dcfe26e0a5943b5441dc9d commit 1fa6daaafd74c1a457dcfe26e0a5943b5441dc9d Author: Jose Luis Duran AuthorDate: 2024-11-02 17:58:59 +0000 Commit: Jose Luis Duran CommitDate: 2024-11-12 03:46:15 +0000 ipfilter: Avoid stopping with a lock held Avoid calling _callout_stop_safe with a non-sleepable lock held when detaching by initializing callout_init_rw() with CALLOUT_SHAREDLOCK. It avoids the following WITNESS warning when stopping the service: # service ipfilter stop calling _callout_stop_safe with the following non-sleepable locks held: shared rw ipf filter load/unload mutex (ipf filter load/unload mutex) r = 0 (0xffff0000417c7530) locked @ /usr/src/sys/netpfil/ipfilter/netinet/fil.c:7926 stack backtrace: #0 0xffff00000052d394 at witness_debugger+0x60 #1 0xffff00000052e620 at witness_warn+0x404 #2 0xffff0000004d4ffc at _callout_stop_safe+0x8c #3 0xffff0000f7236674 at ipfdetach+0x3c #4 0xffff0000f723fa4c at ipf_ipf_ioctl+0x788 #5 0xffff0000f72367e0 at ipfioctl+0x144 #6 0xffff00000034abd8 at devfs_ioctl+0x100 #7 0xffff0000005c66a0 at vn_ioctl+0xbc #8 0xffff00000034b2cc at devfs_ioctl_f+0x24 #9 0xffff0000005331ec at kern_ioctl+0x2e0 #10 0xffff000000532eb4 at sys_ioctl+0x140 #11 0xffff000000880480 at do_el0_sync+0x604 #12 0xffff0000008579ac at handle_el0_sync+0x4c PR: 282478 Suggested by: markj Reviewed by: cy Approved by: emaste (mentor) MFC after: 1 week --- sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c index bcde0d2c7323..b3dea40c3d8c 100644 --- a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c @@ -181,7 +181,7 @@ ipf_timer_func(void *arg) #if 0 softc->ipf_slow_ch = timeout(ipf_timer_func, softc, hz/2); #endif - callout_init(&softc->ipf_slow_ch, 1); + callout_init_rw(&softc->ipf_slow_ch, &softc->ipf_global.ipf_lk, CALLOUT_SHAREDLOCK); callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT, ipf_timer_func, softc); @@ -221,7 +221,7 @@ ipfattach(ipf_main_softc_t *softc) softc->ipf_slow_ch = timeout(ipf_timer_func, softc, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT); #endif - callout_init(&softc->ipf_slow_ch, 1); + callout_init_rw(&softc->ipf_slow_ch, &softc->ipf_global.ipf_lk, CALLOUT_SHAREDLOCK); callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT, ipf_timer_func, softc); return (0);