From nobody Sun Apr 12 18:35:34 2026 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 4ftzkH0X3Hz6YVXt for ; Sun, 12 Apr 2026 18:35:35 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ftzkG4Jyvz3Zrs for ; Sun, 12 Apr 2026 18:35:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776018934; 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=BHpxmZeRE8Unjs/w0IcGYC++P8DCf24XT2YnHoKow64=; b=IREEBUJL2ZTQM9STDZqfZcIyn4n/RG7H9bBlPZ/MPkRm4cD6zbT13yyAr2TceyB7+FL1WB kmNc1T/EvEDym+nMc0yAondcJWpCWuQXzycq6w3/zs9e43WRMTtSH36ssYe8duD7tBiPIL tc/eAwU6cEkIW/OQEjKj0dTYHq9BfRD8qa1sNpH7e8OmxXg5q+QiyTEfBbSwqNnkMRWLUX HA8fu3plyhLnlwlUubey9o+XLt31OZXb/H2Rb1DO1kEJHLnflBB30PpBLBFn1k48UohJCm HVG6i+c1FB/H8qm8Gdgrp1a4RmVtMN4rGEitdOLuaIn23lfNzeHe+Cn0yhimjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776018934; a=rsa-sha256; cv=none; b=SfQBlJJ5KJkDdLWaFxN0Rwh86oF+5ZVpdtZGcUhl6XywFGiVAdWwBUvoVOgRbkEN4bu4ME lbU6JddaPYeruco5FjARHva6IH+m6lFjh/0FYEgzQSjvjg2kB7FpaEZJhX+xMNhBIUv/ZE o5PVWaIt+9MaoP3y9+9D7Vxsbq4yuMdKM71WGzLTyWNb61j+pquir5C3DqMNPbG4+uPK+U k6napopXIihCpB1txvieHtraxyaXAa8/1zV+dWWiRO41KWE0iDi4+2HdvRTddlpJcm0QYS IjwHtr6rlaYGYtwUneTtnWdoXyWmdBiu2WyCRznbQLcdpxhR0sFUVcVfhz7XDw== 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=1776018934; 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=BHpxmZeRE8Unjs/w0IcGYC++P8DCf24XT2YnHoKow64=; b=q0mZDhfae8ZysjdOWU4utujfA3HudCCfhLzV+dBg5CxCQcFEXLgog3qtnJbevpC7SWImKc 8wRE3O+2EOJguUV1pFRlXYpfOD4zdKKvpMpH0oxmjg6pqYMgA4j3zPstfE+YJl6HeiwI5t 7bRhbP93y4X+0ImYBiafamMt+TamLv04Y1UTk0aLNqivQtuHlapyDyPh7ZV6OlOcHMB5jP u0yadvYm6P8ZEiP3Lrdt+fgcbxNg8XZB1dUE1UzAbfIBpVkYoW12BTyPeT9Fw/pr0/ldgF lVfGPypHPefuRcunNlr8ArG3abLda8g9XgWFWYnwVwHlo+uMpJy20rbevxuKtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4ftzkG3fhqzDQ2 for ; Sun, 12 Apr 2026 18:35:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3917f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Apr 2026 18:35:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: ce283e115b02 - main - netinet6: remove INP_DROPPED checks from setsockopt(2) 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce283e115b023514a8886c1c1f1c68df7cd5e9a9 Auto-Submitted: auto-generated Date: Sun, 12 Apr 2026 18:35:34 +0000 Message-Id: <69dbe5f6.3917f.55aa6472@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=ce283e115b023514a8886c1c1f1c68df7cd5e9a9 commit ce283e115b023514a8886c1c1f1c68df7cd5e9a9 Author: Gleb Smirnoff AuthorDate: 2026-04-12 18:32:15 +0000 Commit: Gleb Smirnoff CommitDate: 2026-04-12 18:32:15 +0000 netinet6: remove INP_DROPPED checks from setsockopt(2) The INP_DROPPED is going to become an internal flag for inpcb. As of now it means a TCP pcb that is in TCPS_CLOSED. There is nothing wrong with calling setsockopt(2) on such socket, although has no practical use. This deletes a piece of code from 56713d16a06c5 / D16201. There is no description of the panic fixed, but I will speculate that the panic was about in6p->in6p_outputopts being NULL as the inpcb already went through in_pcbfree_deferred(). This also can be related to compressed TIME-WAIT, that is also gone now. With current locking this shouldn't be possible. An inpcb goes through in_pcbfree() only with pr_detach method, which is called from sofree(), and the latter is called on losing the very last socket reference. So, at the point when in_pcbfree() is called, the socket has lost its file descriptor reference and there can not be any running setsockopt() on it. Leave the call to ip6_pcbopt() still embraced with INP_WLOCK(), since we are modifying inpcb contents. NB: the IPv6 setsockopt(2) definitely has room for improvement. Several memory allocations should be moved out of lock and made M_WAITOK. Covering large piece of setsockopt(2) code with epoch(9) just because ip6_setpktopts() calls ifnet_byindex() isn't correct either. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56169 --- sys/netinet6/ip6_output.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 29374a39e336..359bfdd336e9 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1698,10 +1698,6 @@ do { \ break; } INP_WLOCK(inp); - if (inp->inp_flags & INP_DROPPED) { - INP_WUNLOCK(inp); - return (ECONNRESET); - } optp = &inp->in6p_outputopts; error = ip6_pcbopt(IPV6_HOPLIMIT, (u_char *)&optval, sizeof(optval), @@ -1827,10 +1823,6 @@ do { \ { struct ip6_pktopts **optp; INP_WLOCK(inp); - if (inp->inp_flags & INP_DROPPED) { - INP_WUNLOCK(inp); - return (ECONNRESET); - } optp = &inp->in6p_outputopts; error = ip6_pcbopt(optname, (u_char *)&optval, sizeof(optval), @@ -1919,10 +1911,6 @@ do { \ optlen = sopt->sopt_valsize; optbuf = optbuf_storage; INP_WLOCK(inp); - if (inp->inp_flags & INP_DROPPED) { - INP_WUNLOCK(inp); - return (ECONNRESET); - } optp = &inp->in6p_outputopts; error = ip6_pcbopt(optname, optbuf, optlen, optp, (td != NULL) ? td->td_ucred : NULL, @@ -2410,11 +2398,6 @@ ip6_pcbopt(int optname, u_char *buf, int len, struct ip6_pktopts **pktopt, optdata = malloc(sopt->sopt_valsize, M_TEMP, M_WAITOK); \ malloc_optdata = true; \ INP_RLOCK(inp); \ - if (inp->inp_flags & INP_DROPPED) { \ - INP_RUNLOCK(inp); \ - free(optdata, M_TEMP); \ - return (ECONNRESET); \ - } \ pktopt = inp->in6p_outputopts; \ if (pktopt && pktopt->field) { \ optdatalen = min(lenexpr, sopt->sopt_valsize); \