🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10352

Re: [PATCH net v5 2/4] netconsole: read np.dev under target_list_lock in local_mac_show()

#10352
From: Breno Leitao
Date: Tue, 03 Nov 2026 12:08
36 lines
9998 bytes
On Mon, Nov 02, 2026 at 07:54:50PM +0000, Gustavo Luiz Duarte wrote:
> local_mac_show() loads nt->np.dev and dereferences it with no lock. It
> can race with the interface going away and netconsole_netdev_event()
> eventually calling netdev_put() and freeing the device before we
> dereference it, leading to a UAF.
> 
> The window is only a few instructions wide, so I could only reproduce it
> with an artificially widened window between the load and the
> dereference:
> 
>   BUG: KASAN: slab-use-after-free in local_mac_show+0x4e/0x80
>   Read of size 8 at addr ffff88800e990458 by task uaf/130
>    local_mac_show+0x4e/0x80
>    configfs_read_iter+0x187/0x260
>    vfs_read+0x453/0x5a0
> 
>   Allocated by task 116:
>    alloc_netdev_mqs+0x78/0x830
>    rtnl_create_link+0x53b/0x5c0
> 
>   Freed by task 121:
>    kfree+0x159/0x420
>    device_release+0x77/0x120
>    kobject_put+0xb5/0x160
>    netdev_run_todo+0x420/0x850
>    rtnl_dellink+0x259/0x5b0
> 
> Two places can free np.dev: (1) netconsole_netdev_event() moves a target
> out of STATE_ENABLED under target_list_lock before netdev_put(), and (2)
> process_resume_target() releases np.dev under dynamic_netconsole_mutex.
> 
> Fixes: 0953864160bd ("[NETPOLL]: no need to store local_mac")
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>

Reviewed-by: Breno Leitao <leitao@debian.org>
Technical Details
Message-ID: <aunOzXgE-kz6twvK@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-355554-linux-kernel-netdev=dewy.ru
References: <20261102-netcons-fixes-v5-0-bdada2f03563@gmail.com> <20261102-netcons-fixes-v5-2-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-355554-linux-kernel-netdev=dewy.ru
From: leitao@debian.org (Breno Leitao)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 2/4] netconsole: read np.dev under
 target_list_lock in local_mac_show()
Date: Tue, 3 Nov 2026 04:08:53 -0800
Organization: Usenet Network
Message-ID: <aunOzXgE-kz6twvK@gmail.com>
References: <20261102-netcons-fixes-v5-0-bdada2f03563@gmail.com>
 <20261102-netcons-fixes-v5-2-bdada2f03563@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3168494"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:I91d2MZKCCbS1hse2iXhalOIpcA= sha256:l9JbisIfw0178C1twBrvwBYTOewp7xE1KutHpNTiYMs=
	sha1:MMhebZMaMSwObTSU9lWKZ2kAHVk= sha256:vDChI0d7vw6CuBk0r8x8MQ1EIxoFxHl6Ys0fCHeKYnI=
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 3CEA011288C; Tue,  3 Nov 2026 15:56:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.052
X-Spam-Status: No, score=-3.052 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 QdhDPVg-dTBz;
	Tue,  3 Nov 2026 15:56:13 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355554-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 8192711287C; Tue,  3 Nov 2026 15:56:05 +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 AB08837D00; Tue,  3 Nov 2026 12:09:05 +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=1793707745;
	b=rbgGO8KUWYnUFCmbZODLstC9u1RXnKMv6gWkmenVEgXM5oy0PQF8QBTn0zF3buvkZZo7
	 8AH1HgSv7xtvPQ6UkDGxcQvjRbsIy5obqSBXap0RSp+liiC/0EuY/qX9KprLOXghkJ3R3
	 K/Enx/jQGnyteELUL/u//Z9pgdJQuTosV6bb+DZt5vxu2t4JCRh/XZ33yzVqi/G6wdSXX
	 bm9gVchkTLRHQEiGDOb5qAL9kGhRNuxTN6FLpGF0nesS+jT0fBmd4HNBP5C3FoN9aAmre
	 8xabQMtBUjRdaF5qSt9w/6VfAKcdIR0QRC3pn31xuCKAxrAtzAas0Q2gM1/nbZD642A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793707745;
	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=eZc0hYex0KzI0Z54pU8RsaeZFamyJIJK55zZ8egZ8No=;
	b=AtDdUIqvRHd2jqVYtbgsHTeIgtQn4SANWgavbccFdfjYA4/iw69AOixV4iwaG/Vql13K
	 QeCxoMbWwLXLhwVUSIZ8eBa7Mjx3gkyLotO5xHbi+kUvGl5XFbx6TidVIB1uH8clbEe61
	 /tSAVXAV6pXourz73MMeiljy3hZOjl0hzhhb5R1d4RiaERciyk3WhRBqwFeAz9HiThC+p
	 BpROw8LE1UvHDKeWjK0CcGq1lwMQIE2AjZb7g5D20GSJ33zvkuE58Ubx2NFmXTdm7WLTT
	 6ysUXeaOn37qJt8wbU3UKwi1oV6prgwO0g9hMaAnzLQskXtMEVeQkO7U8a4nrf05ekQ==
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=SJk4Zm9k;
	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 254C9606A330;
	Tue,  3 Nov 2026 12:09:05 +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=SJk4Zm9k
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=1793707744;
	b=0HHjVHE9O8A7ZWd51dnW9hjdUt/M+PBEGEGgiDoOe+70/ycPSAFQBtV8T3r1nqnvyNQB
	 EldPJ44YriSkZNtgBa9007OKdT6+TDdSvLW3Y0LTyaYRbDPBj7cTVVrSCn6VwEF74XVe+
	 udh6xFuXA9CoLx6pnSDwfGG3doX39DyqYe+dLu85HeRfFjRACyWvlmB4eayGLj6a2onC9
	 SLa0g6iSKY8bjmNOWCjwz6v2KO1ygxTwt8e8l7krySgGGEfUTts+kecbmePgUY7t3L+U6
	 nJa1bPVofjrcOFGkE+Gmc7UcPj7IoEU2Hgl1t4nYWBropGTr2Yet3tapJLCwsJqevbQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793707744;
	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=eZc0hYex0KzI0Z54pU8RsaeZFamyJIJK55zZ8egZ8No=;
	b=Fut9ch5toaN9nsd4nyhWyjw1iOQvuZwf9/K515XQh6NgCqhtxkAVa4T+1zjTH99Gv8V5
	 vCwoyAYcFgYgT6+1hG20hP1IHQwWr3GK9dtv/IYwV3hBTspQwaUIozEtz/Kd+tDW2OLX1
	 6XdVidxtSToOeSN1OpPj1JljL3QPDEO2LJbylcbxZUA8G3x0qDxB7CAuZ07l7iwOWbbE2
	 5KxuAbtQ4J0dqtD3d5IzdTUyeM9HKN3T9Ta0Z3l60QW30kSwexmTlVZ+qBAdSd9unlpGU
	 Y8bXtpwH4c31GD56Fzwuh6OvwwENLlHumflK5tfmTlRytzl+8lwjjQWQzrbV5+ibXWQ==
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=SJk4Zm9k;
	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 AED66606A326;
	Tue,  3 Nov 2026 12:09:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AED66606A326
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=eZc0hYex0KzI0Z54pU8RsaeZFamyJIJK55zZ8egZ8No=; b=SJk4Zm9kLgK8isXPedday4Xgas
	bpAPr3Dxp1wKxTBSb2WT6HRKT6rUnXKqJ94PF5QXN4nfIaJhiKg+vQ20t8M6MhErq7jVHDNjJWmtM
	g/Pn7vMyHlVSYm4yG5sPfiuDVP25nezsPuQJ+/wPn6XBxdLluZwog2iBAyd+CxABPxT5vIdiLDhDH
	qxCZlv3ACkYxUlttPdDW0koSQNs1gAZXClxQNkXYnJKsOjwL/lus1IS/p2Z8FQN520ACOCnT8ADFI
	CCaX+UKYuj5rmy+/Ppn67XD5J1Q77Ggl/wnU5rbISsS9f+52//NSd9RKLiP0l37jRDdIZjbxnu8B0
	TBLhKwOw==;
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 1xODJx-006vIW-23;
	Tue, 03 Nov 2026 12:08:58 +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-2-bdada2f03563@gmail.com>
X-Debian-User: leitao