🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5371

Re: [linus:master] [sysctl] 8d75c338f0: BUG:KASAN:slab-use-after-free_in_touch_wq_lockdep_map

#5371
From: Joel Granados
Date: Tue, 20 Oct 2026 09:06
219 lines
14444 bytes
--pcvh7stf5trtufk4
Content-Type: text/plain; protected-headers=v1; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: [linus:master] [sysctl]  8d75c338f0:
 BUG:KASAN:slab-use-after-free_in_touch_wq_lockdep_map
MIME-Version: 1.0

On Mon, Oct 19, 2026 at 05:35:54PM +0200, Oleg Nesterov wrote:
> On 10/19, Oleg Nesterov wrote:
> >
> > But. rds_init() can also fail even if CONFIG_SYSCTL=3Dy, after
> > rds_sysctl_init(), so to me this looks like a bug in net/rds/.
> >
> >
> > In any case, I guess net/rds/ init paths should not fail if
> > CONFIG_SYSCTL=3Dn ?
>=20
> So I think that something like the uncompiled/untested patch below makes
> sense anyway even if doesn't fix all the potential problems with rds_wq.
>=20
> What do you think?

That is a good option. I also did not compile not test it, but guarding
the error inside an ifdef would work and is a pattern that is used
elsewhere.

You can also do this (also untested and not compiled):

diff --git i/net/rds/ib_sysctl.c w/net/rds/ib_sysctl.c
index 2af678e71e3c6..bc97a3eecad69 100644
--- i/net/rds/ib_sysctl.c
+++ w/net/rds/ib_sysctl.c
@@ -114,7 +114,7 @@ void rds_ib_sysctl_exit(void)
 int rds_ib_sysctl_init(void)
 {
        rds_ib_sysctl_hdr =3D register_net_sysctl(&init_net, "net/rds/ib", =
rds_ib_sysctl_table);
-       if (!rds_ib_sysctl_hdr)
+       if (!rds_ib_sysctl_hdr && IS_ENABLED(CONFIG_SYSCTL))
                return -ENOMEM;
        return 0;
 }
diff --git i/net/rds/sysctl.c w/net/rds/sysctl.c
index 025f518a43495..41c65b98c94bd 100644
--- i/net/rds/sysctl.c
+++ w/net/rds/sysctl.c
@@ -93,7 +93,8 @@ static struct ctl_table rds_sysctl_rds_table[] =3D {

 void rds_sysctl_exit(void)
 {
-       unregister_net_sysctl_table(rds_sysctl_reg_table);
+       if (rds_sysctl_reg_table)
+               unregister_net_sysctl_table(rds_sysctl_reg_table);
 }

 int rds_sysctl_init(void)
@@ -103,7 +104,7 @@ int rds_sysctl_init(void)

        rds_sysctl_reg_table =3D
                register_net_sysctl(&init_net, "net/rds", rds_sysctl_rds_ta=
ble);
-       if (!rds_sysctl_reg_table)
+       if (!rds_sysctl_reg_table && IS_ENABLED(CONFIG_SYSCTL))
                return -ENOMEM;
        return 0;
 }


Both are ok IMO.

Best

>=20
> Oleg.
> ---
>=20
> diff --git a/net/rds/ib_sysctl.c b/net/rds/ib_sysctl.c
> index 2af678e71e3c..bccdb5c4df1d 100644
> --- a/net/rds/ib_sysctl.c
> +++ b/net/rds/ib_sysctl.c
> @@ -36,19 +36,10 @@
> =20
>  #include "ib.h"
> =20
> -static struct ctl_table_header *rds_ib_sysctl_hdr;
> -
>  unsigned long rds_ib_sysctl_max_send_wr =3D RDS_IB_DEFAULT_SEND_WR;
>  unsigned long rds_ib_sysctl_max_recv_wr =3D RDS_IB_DEFAULT_RECV_WR;
>  unsigned long rds_ib_sysctl_max_recv_allocation =3D (128 * 1024 * 1024) =
/ RDS_FRAG_SIZE;
> -static unsigned long rds_ib_sysctl_max_wr_min =3D 1;
> -/* hardware will fail CQ creation long before this */
> -static unsigned long rds_ib_sysctl_max_wr_max =3D (u32)~0;
> -
>  unsigned long rds_ib_sysctl_max_unsig_wrs =3D 16;
> -static unsigned long rds_ib_sysctl_max_unsig_wr_min =3D 1;
> -static unsigned long rds_ib_sysctl_max_unsig_wr_max =3D 64;
> -
>  /*
>   * This sysctl does nothing.
>   *
> @@ -61,6 +52,14 @@ static unsigned long rds_ib_sysctl_max_unsig_wr_max =
=3D 64;
>   */
>  unsigned int rds_ib_sysctl_flow_control =3D 0;
> =20
> +#ifdef CONFIG_SYSCTL
> +static unsigned long rds_ib_sysctl_max_wr_min =3D 1;
> +/* hardware will fail CQ creation long before this */
> +static unsigned long rds_ib_sysctl_max_wr_max =3D (u32)~0;
> +
> +static unsigned long rds_ib_sysctl_max_unsig_wr_min =3D 1;
> +static unsigned long rds_ib_sysctl_max_unsig_wr_max =3D 64;
> +
>  static struct ctl_table rds_ib_sysctl_table[] =3D {
>  	{
>  		.procname       =3D "max_send_wr",
> @@ -105,6 +104,8 @@ static struct ctl_table rds_ib_sysctl_table[] =3D {
>  	},
>  };
> =20
> +static struct ctl_table_header *rds_ib_sysctl_hdr;
> +
>  void rds_ib_sysctl_exit(void)
>  {
>  	if (rds_ib_sysctl_hdr)
> @@ -118,3 +119,15 @@ int rds_ib_sysctl_init(void)
>  		return -ENOMEM;
>  	return 0;
>  }
> +
> +#else
> +
> +void rds_ib_sysctl_exit(void)
> +{
> +}
> +
> +int rds_ib_sysctl_init(void)
> +{
> +	return 0;
> +}
> +#endif
> diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
> index 025f518a4349..a0673a41633a 100644
> --- a/net/rds/sysctl.c
> +++ b/net/rds/sysctl.c
> @@ -36,11 +36,6 @@
> =20
>  #include "rds.h"
> =20
> -static struct ctl_table_header *rds_sysctl_reg_table;
> -
> -static unsigned long rds_sysctl_reconnect_min =3D 1;
> -static unsigned long rds_sysctl_reconnect_max =3D ~0UL;
> -
>  unsigned long rds_sysctl_reconnect_min_jiffies;
>  unsigned long rds_sysctl_reconnect_max_jiffies =3D HZ;
> =20
> @@ -49,6 +44,10 @@ unsigned int  rds_sysctl_max_unacked_bytes =3D (16 << =
20);
> =20
>  unsigned int rds_sysctl_ping_enable =3D 1;
> =20
> +#ifdef CONFIG_SYSCTL
> +static unsigned long rds_sysctl_reconnect_min =3D 1;
> +static unsigned long rds_sysctl_reconnect_max =3D ~0UL;
> +
>  static struct ctl_table rds_sysctl_rds_table[] =3D {
>  	{
>  		.procname       =3D "reconnect_min_delay_ms",
> @@ -91,6 +90,8 @@ static struct ctl_table rds_sysctl_rds_table[] =3D {
>  	},
>  };
> =20
> +static struct ctl_table_header *rds_sysctl_reg_table;
> +
>  void rds_sysctl_exit(void)
>  {
>  	unregister_net_sysctl_table(rds_sysctl_reg_table);
> @@ -107,3 +108,15 @@ int rds_sysctl_init(void)
>  		return -ENOMEM;
>  	return 0;
>  }
> +
> +#else
> +
> +void rds_sysctl_exit(void)
> +{
> +}
> +
> +int rds_sysctl_init(void)
> +{
> +	return 0;
> +}
> +#endif
>=20

--pcvh7stf5trtufk4
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmrXLwMACgkQupfNUreW
QU9Yjwv/cCHjunDrXXsuyNvatzPDExXb5X0UzfkQLy2qA3coR/DKb4c6DSrxHAXb
KpHrt6e9QT0I2SPoxXj4PltCuUz848uz0awIUBqnTzndf0VHj3hXQlnOzH0fZ65b
Wn0qAyxnEitEIbt1uSa7Xq24CfbATRcSjtPthG34yTnbF733Fz4lvwVkXbJi4TPl
uoyvrPEcXxnogCVN0W9XNu8u5UHk0CuHOFVj13NvhFcoykqRQbMQcpefAKpJzm2Y
0yUyZK+zZ2CyFchpYt4khOGyW5RLiwV0d1kER0UKqD9lnH4cznErsgqU0tb34Rn1
Xig5W0V/rLLEemKlyC6sdnq1ZeigxxSHlwcRUVMt1UOsECTmaTfaTaO79R2BVLSU
y8a8NvfPWzuASlTcNMV+AT03DA/syjvh2OihVN7ec7ExnUAdfEmpibahUar/MDZA
bBMHemB+kEmt61+nBWc6VAsa6/WJEzxKtDaaR4rMdSuyi20EQBPQsryOF1YPAYRT
Lm5E7bEc
=mg3e
-----END PGP SIGNATURE-----

--pcvh7stf5trtufk4--
Technical Details
Message-ID: <atctwUB5NlRLk4Wy@hobbes>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349128-linux-kernel-netdev=dewy.ru
References: <202610190310.9737b2e3-lkp@intel.com> <atYB0bm9eEXp8A2g@redhat.com> <atYW0K3t57puHeLW@hobbes> <atYuE1xnVYe0BDG4@redhat.com> <atY42k00k0Waj6o4@redhat.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-349128-linux-kernel-netdev=dewy.ru
From: joel.granados@kernel.org (Joel Granados)
Newsgroups: linux.kernel.netdev
Subject: Re: [linus:master] [sysctl]  8d75c338f0:
 BUG:KASAN:slab-use-after-free_in_touch_wq_lockdep_map
Date: Tue, 20 Oct 2026 11:06:18 +0200
Organization: Usenet Network
Message-ID: <atctwUB5NlRLk4Wy@hobbes>
References: <202610190310.9737b2e3-lkp@intel.com>
 <atYB0bm9eEXp8A2g@redhat.com>
 <atYW0K3t57puHeLW@hobbes>
 <atYuE1xnVYe0BDG4@redhat.com>
 <atY42k00k0Waj6o4@redhat.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="pcvh7stf5trtufk4"
Injection-Info: usenet.network;
	logging-data="3818565"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Z7gJv6O4KYT1Bvl+UstkNpGX2Xg= sha256:WVQtiigdd9ytBWdAGmSgoa1RwsUDvKLcjmjvU91L76k=
	sha1:3KUaHfQJ+OiVnzvNl34SCw9A7UE= sha256:U1dtzxS0a+EhTQQngtq4JwfUmCzw5fCCzS64REn6hOw=
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 A3229110C52; Tue, 20 Oct 2026 12:11:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, 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 MZ76A8mv05U2;
	Tue, 20 Oct 2026 12:10:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349128-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 B8D21110C15; Tue, 20 Oct 2026 12:10:49 +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 DA67A3369B; Tue, 20 Oct 2026 09:06:35 +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=1792487195;
	b=Tzkff+vaWNqDxsGm5v4FbI0sjciqrDVRN4n2xCOEPe9PVRjHVtZDjQq8QE5Eb0+/jFsh
	 bEmkPl6Xu7NUD+r6S78l6qIqfY1NoB7tD926x5Or5Goe3grpV6NhtSp8R2FZMEiCdBLFg
	 S2sw175GhrrKYxUVfQiCogehj9/mugIW8g4QPM4m/wAmvKnLC2cUyyNTbJH1pnTIIET9j
	 OTmc2r+sPZzmCxApJGUIsbJAiAKpA8FA9xucUTJA2SDLB7tf4wQbACCrkfV5oq6nsa8lt
	 SEQB3ngrETZWxY7gqHcEEPGqsW/G60R3qYAn4pg7y/bWPM+u1rsiWRoPeg1P7SvZTIA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792487195;
	h=X-Original-To:Received:Received:DKIM-Signature: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=byMpnzMiLTG8THNjkNmp9UgpYnNMNTx0auzeW57yB8U=;
	b=VyDoQdLFPcbCSzazz59UDaAOqfjle/HyF0tl8fk/n4Ay66IamolmTBbetH+9VY2CL3QQ
	 Ll+eaDi92uhYnUxBcgiUmwBJNsjSOehhgkKP70PcKQbYGIkXoPBbCO3yP+cJdEvKcCa7z
	 ueDuAlcXjdtO37DGfa5fJx8PRkYtYBddcWHaZ44wbli07fbXVJNEDaZsQ9wEDqXVfRPRB
	 AcvEGA+/txV0jKufX/kLNfOb8NzmpmPW6TTqNk/yBOdgaXQjQenqA8UqTjx9AMOmqQHdD
	 n58oKG0P50ctpPDvSo2QH9PZZOQqNY0PA8Z/HmaGXlnNnVPJyxueHLpdCNoJUWxZ9AQ==
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=RtgQErrW;
	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 33D60606A327;
	Tue, 20 Oct 2026 09:06:35 +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=RtgQErrW
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=1792487194;
	b=lMIF5G8hSnIDsSNpEbkxFIjnUeYX1131ahtQPgSpZ7EmXcFQjcUCnZs3yDGLvRsYEduC
	 weyeUGAYof/M8ARnJjSaKY0Fk73RunXGChIbwhUE9LgyjDx7RYqYKjJhgjkEYpzPvNQuA
	 20lOF52d+DbHu7rxUIregTJqioGrdYKjicdJmmWMznhOGZBLO0CJ4I6zozPnhU3irSZu4
	 80pAU3dykihT7EWhTMk+CzCM4Kbr5N8/R0Z7OgF7Fba7IC19JLhG3gLL9fxSVQFdfpQLD
	 pDyEingtD0MCwmoygbHTGmFC3Rx3Whba2o3vstvkBteKh8YuB2ZoxO5ilOsQpAjm+Bw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792487194;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=byMpnzMiLTG8THNjkNmp9UgpYnNMNTx0auzeW57yB8U=;
	b=DtLJAWSm6u9JGHTnz96Wvg+QhH2eX/jIcBCHC5FDpLnhaEai4CX9+EbmCPlMT/xG/T/g
	 CW0LzQ8qiZDZc3VWDwhcaY99OiGzizFQ0t2U5FFQkhNcLV+v3HAtyGQ76pnmQLyrKkFuM
	 6WTbm6m4w65C+8+0aeEDcUVMDd8nOTGWR04X3BX1VHFCqINf7WsDkl4BkXL1MaQt1j75B
	 nnR/TmjwXNweeA/9+yIp4ON5P9ocKrXSZ247duhXMK62Mc2RKKa0Eb85IJ3ZmRWAGYTx4
	 bes00efT0Q30H4rxHD38hjt3C/4coTTT41xK3DaGXIZlKuryyX+3FVvV7ngnxKzbwyQ==
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=RtgQErrW;
	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 03763606A31B;
	Tue, 20 Oct 2026 09:06:33 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 340EF1F000C4;
	Tue, 20 Oct 2026 09:06:33 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792487193;
	bh=byMpnzMiLTG8THNjkNmp9UgpYnNMNTx0auzeW57yB8U=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=RtgQErrWcSXkn4om10fEUZVsYPQS8E0C/5ZMqJW739OOKCRRH5cgZYWz6k9JW+NEA
	 TXlyeYKprnZiyrNMoxCJbbwx/VXBq45YssFHz1sFkjxDHLYntyV8QmG1eGeLwBJeXZ
	 79cdAncfI+BcHaxn3CPdPzDm1iSaInRvneceLD7fGwATCqRl2B+GAqG6GeVWRk/KmF
	 VR1bAD3ZDJ9IabcZtURZJUnMDYc5qfuKlPdxlUDPi5+ksFEQyy+2HiccWtke1b315Y
	 4ytv3hocK/lsNGOKxbtNmiQHyzD5hUINETjPtNB7EMhCIC7slgaFYzF9BrNWaAmyJo
	 lDTQCa4S6emGw==
X-Cc: Allison Henderson <achender@kernel.org>, 
	kernel test robot <yi1.lai@intel.com>, oe-lkp@lists.linux.dev, lkp@intel.com, 
	linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-s390@vger.kernel.org, 
	linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, wireguard@lists.zx2c4.com, 
	rds-devel@oss.oracle.com
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: <atY42k00k0Waj6o4@redhat.com>