From nobody Mon Nov 23 12:10:16 2026 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 4jY4Wr6RL3z72lLT for ; Mon, 23 Nov 2026 12:10:16 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jY4Wr5X0dz4ShR for ; Mon, 23 Nov 2026 12:10:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795435816; 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=ACTy5iYp9eCcFwvBc8A1UqouN2Ci8n6Ur6lCWpcSerE=; b=OxhpvFDumbWiO2VIbT3OtvJgkUexKWPuS/3g+3bWvq2DAKNBi5IMwG0doCan26HHE985wD YpABYffWrkhigQi9jE5dm8Ho6Hsoc9GcXf/H+e1N0T+4354wNc5MUXN4rXFlzrHsQTBrrU 80hmpgVQ24oq+ka9/MiWZNvwe1Wsf6CdZNUAyG+wAd6zGmei0Brk6iQjGRufaaaH6S70Wn VPJnXk/CTHedmr1/oGD2/pEG0E1EeEyeLn9wIXJ8+mWCGAVilSFmqw18d+5sYZbZlLCSV8 G90Y08/LQ3NW6Eq9py7+6rLzlZo2+droSA5ByaDT/Io4lLI3CIkRr4Yz6IkXNA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795435816; b=nUo3mgMiNpSUr9VNxJMyAjFZqmJUfsgNzR7cNrrexJg+E9VFkNjxqVXURdbwSd9cbto/kz +y6qOh2y0Gd944CfpthoQ1GzDEJuschSVb2c0YvGEy9+ZFvGesY3tbyMLeEizT5CETPRWb SQduGYHJeOp+1FaXrNJOeguACWzUhLgQRxocEhu3yxNnMhOl2qhvm3aK+nx4N2Lr9TZux2 1Lpqb4boQnNNZILUT8YHKP/TaYb7wjgE8Nq7TrdUK23NmUwArb6Rkg+2ju5MAy3Uc79we5 tuJQMKUXyjw1y4fOcdaG9eAmVPjDURc6F4hjZfwUKf0RzmmAwYw10yp835kAvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795435816; 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=ACTy5iYp9eCcFwvBc8A1UqouN2Ci8n6Ur6lCWpcSerE=; b=BeCgXpm4auj7/LzVTEvjSHw8AwadaKEqf4Czi9IX1mjAh0iz/8KIEt5PgN6ncdyQBcl0fV edRfqaQla5jlntLFD5tW7GstsBzN+az75CjVxurxpcqbEA0Hxe8Woe2kVbHfxuRXhjKX7Y n3t2RMwtWKZf4SMtE4mG4nkjyWrdPfibXEqArj88WrT9XE/q3De65RWYikgAaiBWTE6HmL PuVexHdu93MwNljJYkje4Pzer7Vt8xWNUofKnJPQaEhSo8PhJFGtYjBEqAYzRMj12smJCp c17y5UaA4gNgLuUcOMYx6ESAAmsF+Ap1R3cFopdbvseZUnEevHX5fNb04ouBKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jY4Wr4tV6zqns for ; Mon, 23 Nov 2026 12:10:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 999 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 23 Nov 2026 12:10:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrey V. Elsukov Subject: git: e6e4e05afb96 - main - ipfw: fix value index allocation on shared value storage resize List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6e4e05afb96ab8ccd0473a13ce5b23dc573390b Auto-Submitted: auto-generated Date: Mon, 23 Nov 2026 12:10:16 +0000 Message-Id: <6b042d28.999.293cb701@gitrepo.freebsd.org> The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=e6e4e05afb96ab8ccd0473a13ce5b23dc573390b commit e6e4e05afb96ab8ccd0473a13ce5b23dc573390b Author: Andrey V. Elsukov AuthorDate: 2026-11-23 12:06:03 +0000 Commit: Andrey V. Elsukov CommitDate: 2026-11-23 12:06:03 +0000 ipfw: fix value index allocation on shared value storage resize alloc_table_vidx() treated a successful resize_shared_value_storage() as complete success and returned an uninitialized vidx instead of allocating a new index in the grown bitmap. The removed restart machinery in b0c13e7e2446 used to handle this case by restarting the whole operation. Also refresh pval pointer in ipfw_link_table_values() after the resize, otherwise the new value object is registered against the freed old storage. PR: 300802, 300803 Reported by: pouria Tested by: pouria --- sys/netpfil/ipfw/ip_fw_table_value.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw_table_value.c b/sys/netpfil/ipfw/ip_fw_table_value.c index 09e2ead6ec2c..554fd97b91dd 100644 --- a/sys/netpfil/ipfw/ip_fw_table_value.c +++ b/sys/netpfil/ipfw/ip_fw_table_value.c @@ -330,9 +330,19 @@ alloc_table_vidx(struct ip_fw_chain *ch, struct table_config *tc, IPFW_UH_WLOCK_ASSERT(ch); - if ((error = ipfw_objhash_alloc_idx(vi, &vidx)) != 0 && - (error = resize_shared_value_storage(ch)) != 0) - return (error); + error = ipfw_objhash_alloc_idx(vi, &vidx); + if (error != 0) { + /* + * Shared value storage is full. Grow it and retry + * index allocation. Note that resize replaces + * ch->valuestate pointer, so callers should re-fetch + * value pointers after this call. + */ + if ((error = resize_shared_value_storage(ch)) != 0) + return (error); + if ((error = ipfw_objhash_alloc_idx(vi, &vidx)) != 0) + return (error); + } vlimit = tc->ta->vlimit; if (vlimit != 0 && vidx >= vlimit && !(flags & IPFW_CTF_ATOMIC)) { @@ -499,6 +509,14 @@ ipfw_link_table_values(struct ip_fw_chain *ch, struct table_config *tc, if ((error = alloc_table_vidx(ch, tc, vi, &vidx, flags)) != 0) return (error); + /* + * Shared value storage might have been resized inside + * alloc_table_vidx(), refetch pointers to point to + * the actual data. + */ + if (pval != (struct table_value *)ch->valuestate) + get_value_ptrs(ch, tc, &pval, &vi); + /* Finally, we have allocated valid index, let's add entry */ ptei->value = vidx; ptv = (struct table_val_link *)ptei->ptv;