From nobody Fri Jun 19 20:15:29 2026 X-Original-To: freebsd-net@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 4ghpkG5Ts3z6gl6q for ; Fri, 19 Jun 2026 20:15:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ghpkG4qWzz3xSl; Fri, 19 Jun 2026 20:15:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781900134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KJrfHTdgpMjjJlMBtgjDNdMbouee/6i+kMFSk/AUCPE=; b=V838axb0a4/JdkKfRJjiEsBI6fP0f1iY2jyaI6e3yVupxhh+NB9+fJk6UWUSCLBhEb/8F5 d4PykSgi0vfUqzG/7LXCsE/kZJVcNcFTGKeS9DzaV51dl4GaU9E4N/1PSX/Ho0TzbpMoBg cfc4xsaE/x/Gm1ZcOY05Q+iSC6QL1EJzKmUx/moCYn0iH7G1eiTcioLit9rEPgOGbBMXFa BUZQWsyQw/t+b0hLMLi6u8Ar+W9MnLEYIrsl8A+jrbZSrHC/VIaNNQWqDciPP3U4ll26Ej Ggp8CVqSEAnN7S3HhJjJMlqn/MfUYAs32eWePF+kV6A1bvCMSoE975HApSFq2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781900134; a=rsa-sha256; cv=none; b=gjHJ7myd6bAHR76w698k73XyweDnCG/bdkGT62mPlNLSaIs+Kcn+fjd3/wWbfMlsgWrJB8 245P2+1x/6ODk4d17De99u5gjM5e/h2ncc6cd8Oea1jKfIF6g49NmuUx+mJQ+TdV/CLvK+ wXD+t2UNFRCI5hzjVUa1zDwifoaXDVsU40RirVEmr7uYYb3+BGdgqAcOgRTdnQJw+LfLb5 BNrIA3yyqa0Cv5xxHGh+nFU2UshIAT+UeOVFf5E1gZp0Gr6L2OsWn9t5vXqwtQsK/4WWlv tm/RPYFizdFOmB/r4m7saVbtszx02N3wSpRLL5Xt71TbLRebLVxjgPPbtT32VQ== 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=1781900134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KJrfHTdgpMjjJlMBtgjDNdMbouee/6i+kMFSk/AUCPE=; b=jptGwNa9+8KDl4c+BQKBgjy477CXx8C4dysRLdkIfLkaOhGcPQa1ko6qJskPqTjhDSRaY1 ICjzWtS/wVgm5lBAD3tJuYscrD2sEqYMXXCHnkawEXnPH564Vuh15ldIN3BQVnq3u0lTBg +2KKUaYS0F3l+/I087cUR4f7SE6Vb0PFeCISvWMN0fOrhIG63gZUbvJnzAWl3NIUD/8paU i2YWF56ffyVa+nBRdvnO6/M+2pytz9pREODk6eYWiVJgbpFjAQY/VR7/v5Qmows/74O8kb bYC6s21ES87HWcwJHELSeKnwGSFqDT5cb5S4sz2IFcXDZuRSG762/wU+ZTQtyQ== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (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 (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R12" (not verified)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4ghpkG2r98z10gj; Fri, 19 Jun 2026 20:15:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 8070F40519; Fri, 19 Jun 2026 22:15:31 +0200 (CEST) From: Kristof Provost To: FreeBSD Net Cc: Gleb Smirnoff Subject: ng_socket refcount bug? Date: Fri, 19 Jun 2026 16:15:29 -0400 X-Mailer: MailMate (2.0r6272) Message-ID: <6ECA9A1D-7D7B-44ED-BAEE-3314E38DDB32@FreeBSD.org> List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_9ADBF173-FF1A-4C3A-BB88-1DBB94D7BE37_=" Content-Transfer-Encoding: 8bit --=_MailMate_9ADBF173-FF1A-4C3A-BB88-1DBB94D7BE37_= Content-Type: text/plain; charset=UTF-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit Hi, I pretty consistently see a panic running if_pppoe tests. These tests use `/usr/libexec/pppoed -l pppoe-pap epair0b` (or similar) to be a PPPoE server in one vnet (so that I can test if_pppoe in another vnet). Unfortunately I can’t share the if_pppoe module required to run them. They reliably panic like this: panic: ng node won't die cpuid = 39 time = 1781899222 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x36/frame 0xfffffe004ac1cb40 vpanic() at vpanic+0x149/frame 0xfffffe004ac1cc70 panic() at panic+0x43/frame 0xfffffe004ac1ccd0 vnet_netgraph_uninit() at vnet_netgraph_uninit+0x171/frame 0xfffffe004ac1cd00 vnet_destroy() at vnet_destroy+0x154/frame 0xfffffe004ac1cd30 prison_deref() at prison_deref+0xb15/frame 0xfffffe004ac1cdb0 sys_jail_remove() at sys_jail_remove+0x1a7/frame 0xfffffe004ac1cdf0 amd64_syscall() at amd64_syscall+0x179/frame 0xfffffe004ac1cf30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe004ac1cf30 --- syscall (508, FreeBSD ELF64, jail_remove), rip = 0xfe32964660a, rsp = 0xfe324ddabb8, rbp = 0xfe324ddac40 --- KDB: enter: panic [ thread pid 17271 tid 102985 ] Stopped at kdb_enter+0x33: movq $0,0x15abeb2(%rip) This patch avoids the problem for me, but I don’t actually understand why. To the extent that I understand the reference counting done in the relevant code it looks correct to me. diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index c570584d4b44..685ad1e892d0 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -1102,7 +1102,6 @@ ngs_shutdown(node_p node) if (pcbp != NULL) soisdisconnected(pcbp->ng_socket); - priv->node = NULL; NG_NODE_SET_PRIVATE(node, NULL); ng_socket_free_priv(priv); Does this sound familiar to anyone? Thanks, Kristof --=_MailMate_9ADBF173-FF1A-4C3A-BB88-1DBB94D7BE37_= Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi,

I pretty consistently see a panic running if_pppoe tests.=
These tests use /usr/libexec/pppoed -l pppoe-pap epair0b (or similar) to be a= PPPoE server in one vnet (so that I can test if_pppoe in another vnet).<= /p>

Unfortunately I can=E2=80=99t share the if_pppoe module r= equired to run them.

They reliably panic like this:

pa=
nic: ng node  won't die
cpuid =3D 39
time =3D 1781899222
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x36/frame 0xfffffe004ac=
1cb40
vpanic() at vpanic+0x149/frame 0xfffffe004ac1cc70
panic() at panic+0x43/frame 0xfffffe004ac1ccd0
vnet_netgraph_uninit() at vnet_netgraph_uninit+0x171/frame 0xfffffe004ac1=
cd00
vnet_destroy() at vnet_destroy+0x154/frame 0xfffffe004ac1cd30
prison_deref() at prison_deref+0xb15/frame 0xfffffe004ac1cdb0
sys_jail_remove() at sys_jail_remove+0x1a7/frame 0xfffffe004ac1cdf0
amd64_syscall() at amd64_syscall+0x179/frame 0xfffffe004ac1cf30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe004ac1cf3=
0
--- syscall (508, FreeBSD ELF64, jail_remove), rip =3D 0xfe32964660a, rsp=
 =3D 0xfe324ddabb8, rbp =3D 0xfe324ddac40 ---
KDB: enter: panic
[ thread pid 17271 tid 102985 ]
Stopped at      kdb_enter+0x33: movq    $0,0x15abeb2(%rip)

This patch avoids the problem for me, but I don=E2=80=99t= actually understand why. To the extent that I understand the reference c= ounting done in the relevant code it looks correct to me.

di=
ff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index c570584d4b44..685ad1e892d0 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -1102,7 +1102,6 @@ ngs_shutdown(node_p node)
        if (pcbp !=3D NULL)
                soisdisconnected(pcbp->ng_socket);

-       priv->node =3D NULL;
        NG_NODE_SET_PRIVATE(node, NULL);
        ng_socket_free_priv(priv);

Does this sound familiar to anyone?

Thanks,
Kristof

--=_MailMate_9ADBF173-FF1A-4C3A-BB88-1DBB94D7BE37_=--