Article View: linux.kernel.netdev
Article #10324Re: [PATCH net v5 1/4] netconsole: finish enabling the target before releasing RTNL
From: Breno Leitao
Date: Tue, 03 Nov 2026 12:08
Date: Tue, 03 Nov 2026 12:08
25 lines
9651 bytes
9651 bytes
On Mon, Nov 02, 2026 at 07:54:49PM +0000, Gustavo Luiz Duarte wrote:
> netcons_netpoll_setup() publishes nt->np.dev inside __netpoll_setup(),
> then releases the RTNL and waits for an RCU grace period before
> returning. Only after that does its caller store STATE_ENABLED.
>
> A NETDEV_UNREGISTER event landing in that window tears the target down
> and we end up storing STATE_ENABLED with a NULL np->dev, leading to a
> null-ptr-deref in netconsole_write():
>
> BUG: KASAN: null-ptr-deref in netconsole_write+0xb9/0x7f0
> Read of size 8 at addr 00000000000000a8 by task pr/netcon_ext0/135
> netconsole_write+0xb9/0x7f0
> nbcon_emit_next_record+0x501/0x550
> nbcon_emit_one+0x10e/0x170
> nbcon_kthread_func+0x2ff/0x3b0
> kthread+0x199/0x1e0
>
> Store STATE_ENABLED before dropping the RTNL lock to avoid racing with
> netconsole_netdev_event().
>
> Fixes: 2382b15bcc39 ("netconsole: take care of NETDEV_UNREGISTER event")
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
Technical Details
Message-ID:
<aunOsP4n9McXj_mI@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-355553-linux-kernel-netdev=dewy.ruReferences:
<20261102-netcons-fixes-v5-0-bdada2f03563@gmail.com> <20261102-netcons-fixes-v5-1-bdada2f03563@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-355553-linux-kernel-netdev=dewy.ru From: leitao@debian.org (Breno Leitao) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5 1/4] netconsole: finish enabling the target before releasing RTNL Date: Tue, 3 Nov 2026 04:08:26 -0800 Organization: Usenet Network Message-ID: <aunOsP4n9McXj_mI@gmail.com> References: <20261102-netcons-fixes-v5-0-bdada2f03563@gmail.com> <20261102-netcons-fixes-v5-1-bdada2f03563@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3162728"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LyvAfeCpDerforlVfjgcf+oFm2E= sha256:zuUvu4BsB+fyZyFr0nQGxCo72Ue+5+YHqeUh2VOuITI= sha1:ltiiMvWorvMYs3alTm7iX7lUxVU= sha256:LnDP+s+4MM9KdyrIwQI1A0v99jk2varsdQIGOjvsB3w= 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 2438711285F; Tue, 3 Nov 2026 15:15:18 +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 3PMBFiFATsqx; Tue, 3 Nov 2026 15:15:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-355553-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id D75E8112853; Tue, 3 Nov 2026 15:15:05 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 710CE6106E6; Tue, 3 Nov 2026 12:08:53 +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=1793707726; b=Cmn4pfiZYrV2n1aDvJRnTHeiAfRDTX0uH+tlZbFdGfz5eewcXG7/rZ1djODF6hZdiPK9 evT0u1Tqh2Szrnv32hSx3U4PZgBRDgyw7t/lWM8FUErDhsoh98eE1LmcmIZHvYGOLEFsq gAAbt1flWIfZwlg6267SDE2Q9sXWTeIJ4mh+tsSJ9PG5OgVAL6TejFLEpyNwzQjCNmoa+ OfmS0rJ9c4KD73NYSOL5f/1HSyzvNViKvs1goZiXisblT64pYdeXB6dWn7yAiF6gTgdiA NZyn0vPT6QSq1AedYLJ8+7Knou68Ke0OzUw/Jn5y1efWl4IPCSAMoB73cJYBSF8DWwQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793707726; 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=M1HpJIBKVwB4sBe5LelfhtNY+qip7wrToh9kTtlLHj4=; b=PW1dqrL5hVykQF7T6NFyCSW2bRFxb5UcbBRqn9v9lqT+8fSQRH1WBF+EaokxzwCLAV70 XYmjWIPgdgx2C7ey+m3djDBmrBD366TI7ehteA1kipYx6LNC9PyiLZktmFwINEc7dCQ4R Gtw634IC1P3MvErvvG0USAhnyc6u7KUKyitr8MD19MPa3ycJ9CuMpDd8ZCueEwvIVLsm6 nsHh9x03KbAZVpaLFY8khSHoswWOYm5qQE2iTYWlRKgJJsA04Lrf2jqD8OfJ40CfbhM+m mNlIvEeCTPfEIxlQs2MOprparz5tZCEdabc4iebmU9eM4WH067vFA8LeSKcsTYYDvbQ== 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=MkJxAzsX; 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 7D7D0606A33C; Tue, 3 Nov 2026 12:08:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=MkJxAzsX 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=1793707720; b=PH3Ei2x9aGnIpYcTa0TfB/t53VmAKsypPDR5i9NLx7YvjfFYwW+YyouGAc4T/X4E8EoE NxcNM6d0XQW/XyPMEHBi8EAwo4Zl7GaeHxZ7FbiOx/JNChkmuX5dm1jZWAqzYVkk7ZYZz n5pCFZcT8SYRCnN10mnpp3YCTX3/WQSEBkwM1fypFkRJ/n7LWIiVaeS4JKaESQO+FM6Ds ZWyV5yAlP+lKoOXrmYHNSnAJ+u5IoypoPm5cggirExWwWDskdmVkIv4wvSulIKeymjkIh PDgKlgv0OmNi1YVQ/dyZDeC7LjAhP+vdKqFN1qcwbXbnP34YwOMsaUPs28VdkyorB2Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793707720; 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=M1HpJIBKVwB4sBe5LelfhtNY+qip7wrToh9kTtlLHj4=; b=iVQJDbFiKVcY2yA9X2QDEZhsmsvAgvqYKWvAGrkKMNEuKnKwqm/rBYpm+yX0UQjvblOQ /ngtOsgUQk13AL5OxnKmtH507xa1jeuy92HFYCFOUgw3ZEL6JEIk+Hm6lbqpANFBW+SNz JS/2sjs2ps3pIRNmDWdDYzMJjsD55+chj6g0TAXPYykDd1m8atzqvvVpa9O0DYQxKz4/Y vW5tZQ5RZiDdDhRGXUzl0YjEFDTSoLN1deuvc1zf4B941gkPAwKA2N/0M0YUxHBaR+H4m WFiUpVsrJsuW6MXZUryNB6MYC0hhEFXv5aq9tZloUOK5KxgvewaI5/qKBt99wOLGanw== 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=MkJxAzsX; 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 EEC2D606A33F; Tue, 3 Nov 2026 12:08:39 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EEC2D606A33F 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=M1HpJIBKVwB4sBe5LelfhtNY+qip7wrToh9kTtlLHj4=; b=MkJxAzsXMyXJ9XRbTDS0PZpFac ExeuR1CTGx9+HMqHL7aDyU7b60rYcS4gkj9Dr3iWj6aBUM2SB1EciHZ3TzPm4UIyZvAsl0mZdEja9 lApW6we0hxeYwjp/XofnWXfGI9XQ5svpNIZmsHsLN1JlTDnb9HgsNjT15495J3howxZzqqB6v79iB Ix5h7B9Hu/za5+19o3UKNimelcW4epqCc31WVvzhkKVgm8bEmiPJudunZIznhY6S/64+GyhWiUxHs Tn1qRGbY5eqt/VV8P9UjbvjTMa/Wnc1zdCwjxiH4dtnI+QqIoA3XYW8D7i3w003fsW7AtRIIHSw/s L7JHr/bw==; 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 1xODJY-006vCG-0m; Tue, 03 Nov 2026 12:08:32 +0000 X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Stephen Hemminger <stephen@networkplumber.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: <20261102-netcons-fixes-v5-1-bdada2f03563@gmail.com> X-Debian-User: leitao