๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6408

Re: [PATCH] xfrm: disable state hash resize work on netns exit

#6408
From: Eric Dumazet
Date: Thu, 22 Oct 2026 10:48
43 lines
10559 bytes
Le jeu. 22 oct. 2026 ร  12:27, Eduard Zateev <hackerowskiy@gmail.com> a รฉcrit :
>
> xfrm_state_fini() flushes state_hash_work before it inspects and frees the
> per-net state hash tables. A concurrent state insertion can queue another
> resize while that flush is in progress. The resize worker may then replace
> and free a table while teardown is still walking it.

Which concurrent state insertion ? At this point the netns refcount
is zero, there are no user sockets left, and pernet device exits
have already run. If such an insertion really existed, disabling the
work would not help: the state would land in tables we are about to
free.

More importantly, the syzbot report does not match this theory:

- The object is 64 bytes, allocated at xfrm_state_init()
  (net/xfrm/xfrm_state.c:3358), so this is the initial 8-bucket
  state_byseq table, read at bucket 0 (line 3402).

- It was freed from an RCU callback (rcu_do_batch -> rcu_free_sheaf),
  that is via kfree_rcu().

xfrm never frees these tables with kfree_rcu(). xfrm_hash_resize()
swaps the pointers, calls synchronize_rcu() and then kfree() from the
worker, so its free stack would show xfrm_hash_resize(), and
xfrm_state_fini() would read the new tables, not the old ones.

What the report shows instead is a stray kfree_rcu() on a stale
pointer to a kmalloc-64 object, issued after the slot had been
recycled for this table. The culprit is somewhere else, and the
report cannot tell us where: the kfree_rcu() sheaf fast path does not
call kasan_record_aux_stack(), so we lose the caller.

This patch therefore does not fix the bug, and the Closes: tag would
close it based on an untested theory.

Thanks.

pw-bot: rejected
Technical Details
Message-ID: <CAL4Wiiq3Bg75Gtnid8cGuhmCVZ7yhd+kEF78mXtdq5ce-CJxag@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350516-linux-kernel-netdev=dewy.ru
References: <20261022102641.1429128-1-hackerowskiy@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-350516-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] xfrm: disable state hash resize work on netns exit
Date: Thu, 22 Oct 2026 12:48:39 +0200
Organization: Usenet Network
Message-ID: <CAL4Wiiq3Bg75Gtnid8cGuhmCVZ7yhd+kEF78mXtdq5ce-CJxag@mail.gmail.com>
References: <20261022102641.1429128-1-hackerowskiy@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="192321"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o4WL4sVqBvNqiwvCYyZc09XRfgk= sha256:qwjNFXDpgPZg8yIlh6Vs9DcomuoOOA3eeXYOGSNkjPs=
	sha1:Cky0BhA7eCU2pBG6rYkIsA56oGQ= sha256:25pH7j6IF2WSGif5uMyTPM3riZYLtYWzHGbw0CPYiQs=
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 7500F111248; Thu, 22 Oct 2026 13:53:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 OvFuSJq4CJda;
	Thu, 22 Oct 2026 13:53:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350516-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 97415111221; Thu, 22 Oct 2026 13:53:48 +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 3F72E40C51; Thu, 22 Oct 2026 10:49:03 +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=1792666142;
	b=KKTVQa6OWVXyLG2FKWtqtPPPzHg5sDhKwCdjc5SyP+bFgnMcWnHW6PKiJBGQD/2qQZEO
	 p48jDqBCjcS5oKK/vacTHOzU1UOL5COJ5NwXEtrHgnH65ZimgAlmL50Y1SevhWBeRvZL1
	 4M+GCLchq6C8ZEyVLU2n46HkjGf9Xws4jmBJtr7AK/XKFgkJTtVLYI3iCjvfgQ8RiCsEo
	 wI1nF04BCPI/bcxImzWAsGYMwuy8qzKQm0EY3Plyo/L+JqjT8TNmx/gsAYEI0q3UJXc/2
	 ze88I3VbCDWjU3Nht7BEXo2TAExbx7a9iLizMLTTvNqT3iI2sdXRmCkaRv6UeicrcvQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792666142;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=6h+090XV4AUbcVggLD95jkyA3B0dznfa0uKt5/mUhAw=;
	b=LIiEk4WgqDuwVNrRFVHx5Q7ra9G0aCVQg2B64dJ9zLDYWEBWeYGBDqIq2eSTyNIk3ruz
	 fjqQ6P8catqOsYSDDvvWicJu9D3BBWvqBTrbBUTwFB+DHyT8KPQd/ODBFut01CiYAPjbw
	 rgvdSiCgHcybrJSdvySpZ1WJ4jTVBlZUWvVwq/EtY8TzBqdE9kDJ6IdH2iIIvwwor7qBC
	 2l6sfMPkySe74KFLvO9tGZ0ElfkZLGo378MtIiiQZSqp40ZY1E7hht6eLK7jNnwtLRRWA
	 WTWHM70DkpOGOL8PsRaBq0n0NdsKFDbhtpeb/HKOWel4elnRcJUhr9Z4kG9dPEKzItg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jfVJMHsB;
	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 80BFD606A322;
	Thu, 22 Oct 2026 10:49:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jfVJMHsB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792666131;
	b=0Xc4IvXpMwyYf1jSsACv8kndCWSwFst7TlIE8Hh7P5p88r5x1jYTEHeQoOxTJ+chlcl9
	 kWkuNMZ4U6eDvhyR0pAUFjCRYwtWaNGPvqri7NiVhX/fJMgUEGbLSi9+5VvqIm9kysv/c
	 ZczeIpWdD8ICs+vYMDDwBQiBeKwYrYNfZC4pZUM56LinauIRCDCQE+pAxDL8ClFc0++j9
	 gL4suzz69DqrJSsMA8CGSGx+TWielP/fbhdmSAXF52dNS62ylDOu1k8WKHiLe7D8ZxKec
	 K/3gws2mu9PA72pjtdKwtmkaM5KcP22UZCgM5GhwM064vsD0NA/m7L+95tRhmvXmDyw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792666131;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=6h+090XV4AUbcVggLD95jkyA3B0dznfa0uKt5/mUhAw=;
	b=TlZUqQKRnbgx6xsW8j85vU3IKGOxg87RzH/qGAMxCE6R5I+SaTkTu5KZKbh0BT8vw/QX
	 Y6tUi7PQ5oiyGiWU2t4oogY7LV7nQi8pxKLfbj90a2Q+er6fXjVjorOVPa8Rivztd9UHa
	 WzU+QX+ItITgEjCN1TCsxNj15gz93jRZlf2gX/g/hzm0DXGvZCLckF0XxV+BA5QnGMOzC
	 ObO2GGFtLXDQa0lWERk165O+pJHjzjzpeMe4QWj7IPURhAJnuiaDYsK7kTcU9h0TT+w55
	 2eln7gxjTFxaWi4iec/A/hLeNoyJPBwWs3HrGnUbpgdMxlSXBzKSsjWSplOQTL72ZqA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jfVJMHsB;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F9BB606A31B
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 10:48:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A5C91F000C8
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 10:48:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792666131;
	bh=6h+090XV4AUbcVggLD95jkyA3B0dznfa0uKt5/mUhAw=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=jfVJMHsByPaXl8YwBxBP1xzbR1WQ8D3eebUQUPlGJiBcQdsfMjObN0K/Rmob4SxyG
	 ckj1Rx2khXhSTwHfZcvbMXCI/W+ORSKDF8E1Bx2TtbIXrOAhLh5LImiQ+nl/BLdY05
	 pJuMQg9V1ogBhP+8i0Mks1jd8Z3esYO/UwvDvO6azKfgyjpanm+czZT9nuXs270br2
	 bTxMKhn4diJbp1LyqPZ/Z3MunW0rHW5vfFzESb6sUbl/2P7mEdpRVvihAeqg4enY3q
	 9lsde9vhtSqe22RY8SbMAK05RGDFJOZSjXwlVDstusKvhV13rrKwjfL3putNKfcodr
	 /vGTjtwC9HWcA==
X-Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-4932b13c4ccso873718fac.3
        for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 03:48:50 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBxWX98S0dOoL9/t6Am9RiY2mU2/zHmSiTDnpaI1PXjuf6f629u+Yff23r5OwEmoweeXrId9s/c=@vger.kernel.org
X-Gm-Message-State: AFq9FYK0t2FDT8FrI+aD6t7eosX9+2SaNvgfJd1QSxI1c7rtSrqNOOl0
	ozcIzVjKKYF+BJjraukh0NHJoMgUstAnZGVP9JmU84Ro6DR3ILTCPCrUNGSVtMHUdz64yz3+4a/
	1tidlDri7n2f6VsGxeNEPNq31aoK0m3M=
X-Received: by 2002:a05:6870:214e:b0:494:a6ba:53de with SMTP id
 586e51a60fabf-4a7dc311d74mr3316797fac.60.1792666130335; Thu, 22 Oct 2026
 03:48:50 -0700 (PDT)
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: <20261022102641.1429128-1-hackerowskiy@gmail.com>
X-Gmail-Original-Message-ID: <CAL4Wiiq3Bg75Gtnid8cGuhmCVZ7yhd+kEF78mXtdq5ce-CJxag@mail.gmail.com>
X-Gm-Features: AclHuK9Aw1IQ0g_DyyCsu-kE4upblkb_k_cLT1MAGcNgv1aEWAaEyD1MSeJF7PI
X-Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au, 
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, 
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
	syzbot+f3f4fce0609f8e91b540@syzkaller.appspotmail.com