All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Anastasov <ja@ssi.bg>
To: Ren Wei <weir@nebusec.ai>
Cc: lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org,
	Simon Horman <horms@verge.net.au>,
	pablo@netfilter.org, fw@strlen.de, phil@nwl.cc,
	darby.payne@gmail.com, vega@nebusec.ai, zzyy19904204639@163.com
Subject: Re: [PATCH net 0/1] ipvs: bound twos scheduler destination walks
Date: Mon, 14 Sep 2026 21:01:05 +0300 (EEST)	[thread overview]
Message-ID: <861399d8-c71f-6589-d4cd-3549d9c5bc00@ssi.bg> (raw)
In-Reply-To: <cover.1789117690.git.zzyy19904204639@163.com>


	Hello,

On Sun, 13 Sep 2026, Ren Wei wrote:

> From: Darong Lu <zzyy19904204639@163.com>
> 
> Hi Linux kernel maintainers,
> 
> We found and validated an issue in net/netfilter/ipvs/ip_vs_twos.c. The
> bug is reachable by a non-root user via user and net namespace.
> We've tested it, and it should not affect any other functionality.
> 
> We will provide detailed information about the bug
> in this email, along with a PoC to trigger it.
> 
> ---- details below ----
> 
> Bug details:
> 
> The IPVS TWOS scheduler performs two RCU-protected walks over the service
> destination list. The reproducer repeatedly deletes and recreates the
> service, including its destinations, while the scheduler is traversing the
> list. If a destination list entry is relinked before the RCU reader
> completes, the reused entry can make the iterator follow a link outside the
> original service list.
> 
> The root cause is that both walks are unbounded. If the iterator follows a
> reused list entry, it can continue walking indefinitely and prevent the
> scheduler from returning. The fix reads the service destination count before
> each walk and stops after that many entries, while preserving the existing
> scheduler algorithm and RCU list traversal.

	I'm trying to understand how the iterator can be
tricked to loop forever: to loop, it should never reach 
&svc->destinations, so it must walk unlinked nodes which
create some loop between them. But READ_ONCE soon or later
will read actual ptr from memory, so it should reach to
&svc->destinations. We know that entries end up in reverse
order in the list after they are added but how looks the
list that causes the loop?

	OTOH, I don't understand why we need two full lookups to
trigger the problem, can it happen with one list_for? Other
schedulers also walk the list twice, for example, RR remembers
previous position.

	I assume the problem is caused by the dest_trash.
It seems, we need a general solution to this problem.
One option is to penalize with synchronize_rcu() if we detect
dest that is reused too soon. But even that looks complex to
implement.

Regards

--
Julian Anastasov <ja@ssi.bg>


  parent reply	other threads:[~2026-09-14 18:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 17:31 [PATCH net 0/1] ipvs: bound twos scheduler destination walks Ren Wei
2026-09-12 17:31 ` [PATCH net 1/1] " Ren Wei
2026-09-14 18:01 ` Julian Anastasov [this message]
2026-09-17 12:42   ` [PATCH net 0/1] " Jiayuan Chen
2026-09-17 20:06     ` Julian Anastasov
2026-09-20  2:59       ` Yuan Tan
2026-09-20 13:19         ` Julian Anastasov
2026-09-20 13:35           ` Jiayuan Chen
2026-09-20 14:09             ` Julian Anastasov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861399d8-c71f-6589-d4cd-3549d9c5bc00@ssi.bg \
    --to=ja@ssi.bg \
    --cc=darby.payne@gmail.com \
    --cc=fw@strlen.de \
    --cc=horms@verge.net.au \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=vega@nebusec.ai \
    --cc=weir@nebusec.ai \
    --cc=zzyy19904204639@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.