From nobody Wed Oct 22 15:47:44 2025 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 4csD805xKQz6CllM; Wed, 22 Oct 2025 15:47:44 +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" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4csD805LVpz3Nq3; Wed, 22 Oct 2025 15:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761148064; 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=HqAjFA2fOykKoW+cEsaqiLOUt/4IP29DmHCWrJWQrK4=; b=LJe6upJvKXlwrExF4MDHpHnSHcl9a63jbxJ3WpHock8luKzFOK6NZfpXYbRQlZfpp56Vky 3Gc4Y5shDfAAyBhc9BIXdNoV2fgMGLgUSbf3nKoYvd6jo+PZCCgV/g2eZv9/D8cpA40MQS KwMpU4GDUujGNnRs8/nvdYqqlvClXJ7k9A24Vs61wXTQr7W7VFxBndYjtJXUXtI7CHp+7w Z8KntAJ+jbVP5TVTCUCL/wNim/KeodFWKB7BJQ7a1KCQUKa2f5tCB8E/7DZlnRLOiKeEM0 AvcpUvEL/1vpzOCExrAtlzBNvdLTurtLNrEAR8gp8XhoqRoXshh1aEmkXIxrng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761148064; 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=HqAjFA2fOykKoW+cEsaqiLOUt/4IP29DmHCWrJWQrK4=; b=M4c/FglLXSCOGmVACvnbvd5/PFgwxTA4UdmUVKcDGo7Y0KjzHW0TQd/fcFdYLXFBIVAsBs WISJHRbndZRrsxEWYf9fRY8mkRYtx26zqRwGquMDJX9r8LscWuJLGt9EN5kI3jLsK4PRwU TQZXsMhiiSHKbx7RN9HlAvAVgOBhHZlyJHZmZ63x04aNX8vJ7TKW1LDIz8HulcxSBSSACm QLWA6XhexoSBfpIZE9TSc0hsUs5jTGHFhpzSaEgOanPEwPaL8PazxqppYfv9m3/2qZ0H02 peiRLq+KSUVXVLJJWEdgqVU7yVYiDxRhIJJX1Lv0i8caBWgwCPMNbqWdT+wI0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761148064; a=rsa-sha256; cv=none; b=cGL6SY4DM7/CBYjn2a7xFUlG+Om5I+v0Eq0Tv+0FzL+TjjbPPh+wT6s5jNVavYNYUYfrPS 3EqlJF+l7PZWoStNKXW55UfdlbwafNwJLAhJ3Ib9PUOGjLE3xsYhVEygddGNtQw9lTrw29 tYlHWMs4C9pQMdoQwi+8F80MhKyzbSuIkBLpGBIdmS4wA3ahiHxVwvAK8zPbkXzFDml8SH SsSvdvlQYXMU+XvZrC4A9mc2BtVbkA3JRC6hEFgOKT2JRxpa6uVgTPJcFrp7IaDsWfVul2 ND63Bei/0Yx5WbhJCdE5Ogb86M8KGjf4eQkRXOFRZFB/uwgiapZu1+gm1koaJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4csD804YsFzblj; Wed, 22 Oct 2025 15:47:44 +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 59MFliEO021821; Wed, 22 Oct 2025 15:47:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59MFliDN021818; Wed, 22 Oct 2025 15:47:44 GMT (envelope-from git) Date: Wed, 22 Oct 2025 15:47:44 GMT Message-Id: <202510221547.59MFliDN021818@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: 320ad3dec5ff - main - inpcb: Ignore SO_REUSEPORT_LB on connected sockets 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: 320ad3dec5ff1b37f6907a47961c18b9d77e6a53 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=320ad3dec5ff1b37f6907a47961c18b9d77e6a53 commit 320ad3dec5ff1b37f6907a47961c18b9d77e6a53 Author: Mark Johnston AuthorDate: 2025-10-06 13:37:47 +0000 Commit: Mark Johnston CommitDate: 2025-10-22 15:42:49 +0000 inpcb: Ignore SO_REUSEPORT_LB on connected sockets While TCP disallows connect()ing a socket with SO_REUSEPORT_LB, UDP does not. As a result, a connected UDP socket can be placed in the lbgroup hash and thus receive datagrams from sources other than the connected host. Reported by: Amit Klein Reported by: Omer Ben Simhon Reviewed by: glebius Approved by: so Security: FreeBSD-SA-25:09.netinet Security: CVE-2025-24934 --- sys/netinet/in_pcb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index dbe48242381d..712ff28768dc 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2665,10 +2665,13 @@ in_pcbinshash(struct inpcb *inp) INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_porthashmask)]; /* - * Add entry to load balance group. - * Only do this if SO_REUSEPORT_LB is set. + * Ignore SO_REUSEPORT_LB if the socket is connected. Really this case + * should be an error, but for UDP sockets it is not, and some + * applications erroneously set it on connected UDP sockets, so we can't + * change this without breaking compatibility. */ - if ((inp->inp_socket->so_options & SO_REUSEPORT_LB) != 0) { + if (!connected && + (inp->inp_socket->so_options & SO_REUSEPORT_LB) != 0) { int error = in_pcbinslbgrouphash(inp, M_NODOM); if (error != 0) return (error); @@ -2770,6 +2773,10 @@ in_pcbrehash(struct inpcb *inp) connected = !in_nullhost(inp->inp_faddr); } + /* See the comment in in_pcbinshash(). */ + if (connected && (inp->inp_flags & INP_INLBGROUP) != 0) + in_pcbremlbgrouphash(inp); + /* * When rehashing, the caller must ensure that either the new or the old * foreign address was unspecified.