🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13835

Re: [PATCH net-next] netconsole: register one console per target

#13835
From: Breno Leitao
Date: Tue, 10 Nov 2026 11:25
50 lines
10605 bytes
On Tue, Nov 10, 2026 at 01:42:17AM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 4 potential
> [Severity: High]
> This isn't a bug introduced by this patch, but this patch now registers
> a console right after this lockless store of STATE_ENABLED. Can the store
> overwrite a deactivation done at the same time by a NETDEV_UNREGISTER?
> 
> By the time we get here, netcons_netpoll_setup() has published np.dev,
> dropped the RTNL and waited for a grace period:
> 
> drivers/net/netconsole.c:netcons_netpoll_setup() {
>     ...
> 	err = __netpoll_setup(np, ndev);
> 	if (err)
> 		goto put;
> 	rtnl_unlock();
>     ...
> 	synchronize_rcu();
>     ...
> }
> 
> The target is on target_list during that window, so this sequence looks
> possible:
> 
> enabled_store()                     NETDEV_UNREGISTER
>   netcons_netpoll_setup()
>     rtnl_unlock()
>     synchronize_rcu()               netconsole_netdev_event()
>                                       nt->state = STATE_DEACTIVATED;
>                                       list_move(..., &target_cleanup_list);
>                                     netconsole_process_cleanups_core()
>                                       netcons_release_dev()
>                                         do_netpoll_cleanup()
>                                           np->dev = NULL
>                                       target back on target_list
>   nt->state = STATE_ENABLED;
>   netconsole_register_console()
> 
> The next netconsole_write() would pass the state check and call
> netif_running() with a NULL dev:
> 
> 	if (nt->state != STATE_ENABLED || !netif_running(nt->np.dev))
> 		return;
> 
> process_resume_target() handles this race with the reg_state re-check
> under the RTNL, but enabled_store() has no such check. Does it need one?

I understand that this one got fixed by Gustavo's commit f94b9640bcf22b
("netconsole: finish enabling the target before releasing RTNL")
Technical Details
Message-ID: <avL-47QDYmOHN9Pv@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360117-linux-kernel-netdev=dewy.ru
References: <20261106-netcons_one_console_per_target-v1-1-c29dacdb9c1f@debian.org> <179427493788.994134.10458088525635523245@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360117-linux-kernel-netdev=dewy.ru
From: leitao@debian.org (Breno Leitao)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] netconsole: register one console per target
Date: Tue, 10 Nov 2026 03:25:02 -0800
Organization: Usenet Network
Message-ID: <avL-47QDYmOHN9Pv@gmail.com>
References: <20261106-netcons_one_console_per_target-v1-1-c29dacdb9c1f@debian.org>
 <179427493788.994134.10458088525635523245@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="596924"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2Jj1AI/s9o1HIuGKslfjzq5yZBY= sha256:fqLkYIvdOjJa52xwyepZsayuHfZVoNJFKkV72Wz1e0I=
	sha1:xTHS4QFiehAulzqgr+Sfh/XnAvU= sha256:m2WWBO2enBR34qzmatiz5aFVn0CFfzm5H/kSIb0eSU0=
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 9587A113B3A; Tue, 10 Nov 2026 14:55:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.152
X-Spam-Status: No, score=-3.152 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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=debian.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 uZ_GlxZ7Juke;
	Tue, 10 Nov 2026 14:55:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-360117-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=debian.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id AB1CD113AD9; Tue, 10 Nov 2026 14:55:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 1AD9C180CB4; Tue, 10 Nov 2026 11:26:17 +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=1794309931;
	b=vAlCEBdW7JlJ2g85NX8AqewXnQ72OyoDMlYGaHVexRl+463ZL+VtyAf1znp3PT0Yek9X
	 L3A/ztZ2uGqc5RaG/XzEzwfZMMYhrKDL9GDiolmlYWWweAn75u3i5lyuXcQCcpVKnfbph
	 xxefZU3t6DShgubQsHVTCQxMJ2hd6hGFII7E9G3ZmLxBcYPJf6Js6KuxzWkTvY/j9fbGI
	 9j1QsxtHuG9K0GWbWoZ5k43eyMmfvPZQJMU4Eu4JqAWAduOSdfOYDtK9UQk2HThz/ZdHy
	 gWx7/n4WIGXQWI9esqn0e6uaRz6i1ZC/ZuR+GdsudND8ZjU9i33YozWazM9wEr9CLig==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794309931;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: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:
	 X-Debian-User;
	bh=CceT9wfX1vncgrV/RpW14a0VXPyngwYFI/tpyYB9VI8=;
	b=JgLtoSOonchn+3kG5VOR7ou5sDarPQVSQlo58yl1sjQcFRAzMSda70GLCJo+by/2xELB
	 sOGtQHfpmex3dwhcQDGTALtd4fhel/5hAuT24KjYcq6EF8sqvwhEDHEBXqmSvt9Ew0/66
	 4tojLVfSbfSIDAtjR+eWaH7ZdU3wTfOCeZL80eBqbRvEY63jLePW3D4xojSASOi8+YXis
	 iAxLnZo94Rcd3lHTOqBSI2pujr/pkyKihEZ19EDoOkkRfGfeRdMW5eNZnF2R3oXX43Sxz
	 toNIEyZMvFt1FdFm3RB6h6vMG8o4GpZXs4qlxXcnUNmdvcZ9yakVsac4S+ww/Bf4Z5A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=E5uYlpKI;
	dmarc=pass header.from=debian.org;
	spf=pass smtp.mailfrom=debian.org;
	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 3E79C606A33F;
	Tue, 10 Nov 2026 11:25:31 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=E5uYlpKI
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794309930;
	b=Dsf0I95WdSFHBoa8Q3LJegOpeYiMFkyprj/wen8xz6ezeZDPM8CsG9WDAcRjwpktpCMo
	 cQaT/bwT/4w2xMOZKf64LUMWMdnq6ws/cDFiuHjL+/Fr1aP8Kshdjs+3r3IBTBhHOs3tA
	 YexNAUMJnKQvpYeDXRqkCJKzz3IEuqYO/fcv81ASKk+UTtrcXxg59XZfjedDx3e1vKXqQ
	 +N+xL1Yv1LxLhLySh4iF2smFk81A9TzBBqWR1cCMSkYfQPufc0/XzZnRyXimy3tF4/ZW8
	 8ubMIzZgToUxOFtdzNbMU8zmKXiXyJn/RE0CrARW3I03YWrSuBOE5ID9AW4qQum3cLQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794309930;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To:X-Debian-User;
	bh=CceT9wfX1vncgrV/RpW14a0VXPyngwYFI/tpyYB9VI8=;
	b=g6lKJ8ZDLryE5b+zxoHhMYnBvOLQJzvGo/jAK1aRjGhQRThwPwUEqHLGrEPm5XxuFxKy
	 x1Mryg1c0gXtiaHj28WDHlFkvU76wOKztIXvgKdMAqa4FyBj2UP/RfAQ2WoU08L41MkK9
	 hN18JaRbM/5mitKiTHlAzqvtlWdiM313xvKmiA5sKKCRV1C75JY9o5PZPYKG6k/EFzaor
	 y7z17trSXqEQodLlWUlgUPoYS6MsZVVYxors4fvEIBsyMjD3vccqRcAghW7J6ua2LZJip
	 MbkySmzOjGyitEOa5G9lQtNxhQSFSqSUFLqN+b5Eens8BGizTZPMsTBXZ/NQWFw7pew==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=debian.org;
	spf=pass smtp.mailfrom=debian.org;
	dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=E5uYlpKI;
	arc=none smtp.remote-ip=82.195.75.108
X-Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA471606A32E;
	Tue, 10 Nov 2026 11:25:29 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AA471606A32E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org;
	s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version:
	References:Message-ID:Subject:Cc:To:From:Date:Reply-To:
	Content-Transfer-Encoding:Content-ID:Content-Description;
	bh=CceT9wfX1vncgrV/RpW14a0VXPyngwYFI/tpyYB9VI8=; b=E5uYlpKIS6IA7v3LirY3PfL+wX
	90Gxhwb/2LRBIJ+TMvUu7simix86z7VbHXwnQpHzN1rBn26y1Kcghm8s+E+Rd5gSsflUTYDCq8SEx
	EJGkr5IUhVqLeCysI0Ka1xE3ZR+c5bC5kRADsJHkVVxDawk/VYYZ+SaYDBsnn1PgG5WYkeoIwLUKe
	5GsjEOfI6gulJjo/jOfYDB87pAvm0dX6NtT1pW4oKotRd68s/p047rsWzDQFu4Tm1A4kNPVldVzCT
	d0LqLR32AqcWdqvZVPTHLAtzaC9i9Sc/trAaHe5KjmGU1r30B7T4fXYnjEf/YXmRBJ/MdL3VsVeKu
	BakJpGtA==;
X-Received: from authenticated-user
	by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
	(Exim 4.96)
	(envelope-from <leitao@debian.org>)
	id 1xQjyP-00CMot-0u;
	Tue, 10 Nov 2026 11:25:09 +0000
X-Cc: gustavold@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, 
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, john.ogness@linutronix.de, 
	pmladek@suse.com, samuelcrossley@gmail.com, netdev@vger.kernel.org, 
	linux-kernel@vger.kernel.org, kernel-team@meta.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: <179427493788.994134.10458088525635523245@kernel.org>
X-Debian-User: leitao