Article View: linux.kernel.netdev
Article #7152Re: [PATCH nf] netfilter: nft_set_pipapo: skip transaction elements during GC
From: Florian Westphal
Date: Sun, 25 Oct 2026 05:38
Date: Sun, 25 Oct 2026 05:38
65 lines
9720 bytes
9720 bytes
Joas Antonio dos Santos <joasantonio108@gmail.com> wrote:
> The catch is that the expiration isn't stamped at activation, it's
> stamped when the element is allocated. nft_set_elem_init() does:
>
> nft_set_ext_timeout(ext)->expiration = get_jiffies_64() + expiration;
>
> and that happens back in the parse phase (nft_add_set_elem), while we're
> still going through the batch. The element only goes active later, in
> nf_tables_commit(), which is also where the gc tstamp is taken
> (nft_net->tstamp = get_jiffies_64()).
Can you name the line in the source code?
I am not seeing it :-(
> So the expiration is really parse_time + timeout, and the commit-time gc
> scan checks it against commit_time. If you add a big batch of elements
> with a short timeout, they get parsed one by one and the commit only
> happens at the very end, so the ones parsed early in the batch have
> already gone past their timeout by the time we reach the commit tstamp.
Thats not supposed to cause a gc?
All the sync gc functions are supposed to check against the reference
timestamp taken at the beginning of the transaction start, in
nf_tables_valid_genid().
They are NOT supposed to check against wall clock time.
Even if transaction takes 5 minutes: the sync gc step should
NOT observe even a single timed out elemenent.
They become stale only AFTER the sync gc step.
tstamp is coming from nft_nat->tstamp, i.e. start of transaction.
e->ext timestamp therefore should never be in the past compared
to that reference time.
1751 if (__nft_set_elem_expired(&e->ext, tstamp)) {
1752 if (!nft_trans_gc_space(gc)) {
1753 gc = nft_trans_gc_alloc(set, 0, GFP_KERNEL);
1754 if (!gc)
> I confirmed it on an unpatched 7.3-rc6 + KASAN: add 20000 elements with
> "timeout 10ms" to an interval+timeout pipapo set (the parse alone takes
> ~6s) and the set ends up basically empty. pipapo_gc_scan() collected the
> new, not-yet-activated elements during the same commit that added them.
How? I'm not seeing it :-(
> It's the same thing you already fixed for rbtree in 86b6471e690c, the
I thought that was about false zap of rbtree end nodes which doesn't
apply here :-(
> races the grace period just like the rbtree case, but the precondition
> (gc picking up the not-yet-active elements) reproduces every time.
How?
> If it'd help, I can respin v2 with the parse-time vs commit-time
> expiration written out in the commit message, just let me know.
Yes, please explain in detail how time can advance during transaction,
because its supposedly impossible.
Technical Details
Message-ID:
<at2V3g-B1Ko2x1iK@strlen.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351493-linux-kernel-netdev=dewy.ruReferences:
<179287943591.17355.17353179557993329094@gmail.com> <at0vzdlVTF8XAzHj@strlen.de> <179288180870.24716.7833838593165388250@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351493-linux-kernel-netdev=dewy.ru From: fw@strlen.de (Florian Westphal) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH nf] netfilter: nft_set_pipapo: skip transaction elements during GC Date: Sun, 25 Oct 2026 06:38:38 +0100 Organization: Usenet Network Message-ID: <at2V3g-B1Ko2x1iK@strlen.de> References: <179287943591.17355.17353179557993329094@gmail.com> <at0vzdlVTF8XAzHj@strlen.de> <179288180870.24716.7833838593165388250@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="947128"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:duDABoe+rbobHdkpmH+BNvtKVwQ= sha256:/eG0ntW9Ynr2nnHfrdSdSj3EdcFHYpty5SAgVyNTn2k= sha1:RSPdtc/HOfFLxa+8Sw2p47DDiLI= sha256:mwadlJmhyeFFcOVAns/8o3JAMiF4GZO7eHUunW7yXNA= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 20AEC125B2A; Sun, 25 Oct 2026 08:39:19 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.95 X-Spam-Status: No, score=-2.95 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qEMpu1_meOQ8; Sun, 25 Oct 2026 08:39:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351493-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=strlen.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 260EB125B28; Sun, 25 Oct 2026 08:39:06 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 66D9A29CFE; Sun, 25 Oct 2026 05:38:57 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792906736; b=T2O2WJfvSDEjARdIFcW3xBsHtCjS920/UfeIlQhRSrIHwIQ+ErbKkAwbcZS8FlI6wrIQ tt4m9YfAkk2TcEkLsrKAqpRKySbMPObk9zB96ZhzHE0Gl8X+kH6QODoxLKSzRFKhtMDuQ AeD/ymynguPJvFg+rcIgZ1fbSjjy6pvsz0TjloMuBOO56yGH8+JkQo5wCJPdd79N2vonI GuKB+0kbtsM4vdVpGQUfDTvyj+oUsI/466Oq0dWxahANL0PWfLDzonP0sJSKyLFCBmGeV qzTSD3fgY6xp67h4u9hyTpedmB1rGAM71wNSiiEFOeXeFUaO078ZwC/Cjd0yWcS0xbw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792906736; h=X-Original-To:Received:DMARC-Filter:Received:Date:From:To:Cc:Subject: Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=SN6wOZUIlZ///Jc+P20zHJ6bq1VafVf3nqSx9XZrB0k=; b=XUzCUlXgNBI3LVEJu02BTx4MwUOARN9ynOzCsarinXI/IOd1aq8ViXE+D1PymAqfhQ/+ Jo8lQPNEU0U8FD2R/qy2tyFjZdbLCCtvRWyeUoG3k2B0g53215SwMMSHtvCZgC35sSzrV ERmVkPbboxlanlGk2hC3F8l/w4GHCDcR8pXLxYnS5CHKOHcbAxrtKQ/1R5lAtmMBGXRSs sTLrIoXfOUYTrMvWDFDk/vftJqJp/VrTSXyipwyUnXEJhJ6KmzswHx13RJsuQiH1ixjC1 xm5aEWT6NghhYC3xMrR9ZvmoLuKEYk06WzR46yY2Rw/Rs+vsak+IvJGsUlHdPMgmnWQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC7C6606A324; Sun, 25 Oct 2026 05:38:56 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.216.245.30 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792906726; b=asvBojGPVWNi6RdnXoqY2lKdCwqhGVskrQTqE7mvwSmkgXMUfbQ07AcFkaEPZXQazf0N vZuo1Iwk9U69vNx04HayYlRzq0RNfoSF3sFXJVDms1P2fEgbva3llyK5dFj0TGqALFEAb oUnM/MtFK+eXMzILSKliMoeHSdnASVAstHVPX2jssKTVXV5L2hw00uQRScdGZxjj19cqi FyH4RBV3HLKViqQt3V8wpbuwmuwAfqZSFkzuZzA1R4kf2N5Mkt6d1JjAhv3n/SkI6GSuJ /V66I/LJknF5RrYGlgIPnwsRhMl6fYJTV4uMcidL5ODs4u/N2zwAWP7TL0QG7QUrZTw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792906726; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=SN6wOZUIlZ///Jc+P20zHJ6bq1VafVf3nqSx9XZrB0k=; b=GavnyA3Yx17f5LKjX1PATq5B02gXtnbotjpIb5/qxq5IaCoLik6pI0wI8fbN4FXDpSJ7 nieVQfofOCiklc7tsEnksLpoZ5cTyHykOeuhBuh9XCmGy4YVIHhQaLm1rxrBGWgNQJW89 Kv67+FTx1Uh4FHLBUKBHOiEuZgNMC6pWdFs2vgHkBtQQjqL/aSaShDrrlqL8M4N6HqNUQ HKE+BIc6vcqu2KSkZfHhCRqavbi3aaYkxKG1m46pWcsRqVxJaEs07N0+xWtrxipDjFsha my2zZu8GzdfOT5AudrT2vMHsNuGcjHHXDn6vD08Pamh6sQN37lOfbXeidLdbCMg5W8w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.remote-ip=91.216.245.30 X-Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F40EF606A31A; Sun, 25 Oct 2026 05:38:44 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F40EF606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de X-Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id A01C660796; Sun, 25 Oct 2026 06:38:42 +0100 (CET) X-Cc: Pablo Neira Ayuso <pablo@netfilter.org>, Phil Sutter <phil@nwl.cc>, Weiming Shi <bestswngs@gmail.com>, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <179288180870.24716.7833838593165388250@gmail.com>