From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.144 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795991802; b=EPaz+IAeMEL343cKVzqYRzwdGqB2T5SlW6j7s6DTch8wCCOdox28BKBPIJ9AWPtV+uaL 3Q1i8cXWuQhwPy3uN6lPURJUNMNUo8hcKyZRo0x6bgKoxw6uaOKNhTSNJbHo3X9yhlkk1 lg4M1h9euP2WLB+OrA3Xt4xVW113z7E/ydqco917QAdo8Y6ZdA8kCC2QRsvgMqyRrgX9m kXSzNTU8i5VMaM8554JxXtNuXO3bC9ErEudeg5WPvMGWsXe380K5EGFr6RQsn8WFAMSc8 DFZvyWNCqz07+WxqWPMJOZAeOXpX7Bopmjw+M0blPAfniqAsS9Qc+g2rODNK8GDT7eg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795991802; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=qj8dhSF9Qd/QoV2avVmtqyt0sk2gleWc6V91YNfSdtc=; b=pYtVET3ihOqd+nr3efiz17IWQkOyBVRLmpRqak1o88e5jWNGBZOlCIlGzzWgyaJsIbra eEmkEnkNJn83v2Nx6u33Pu/g70YHq47YIOyxbfywuhhR9x5hh2gl20ru8LBuWN8XpeWt9 Id9VJ6jARwlFmOFrkWyCKkpsx3+yRrLMZqInnywVtw053V642J11vMpP3SybanYimk0D7 YfkZPc8fN2f3R9s6smu/dKa7VjVy+jFy8DNxqIVPCCQSRVKkc2QHJf8cpHNltCnr00WMk HAuHc17doJLwgKfIr+bRBUlU1VC/NDrC/tqF7j2b2PDVXJgG5xhkuoU/BypPpXH39rA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cbannister.uk; spf=pass smtp.mailfrom=cbannister.uk; dkim=pass header.d=cbannister.uk header.i=@cbannister.uk header.a=rsa-sha256 header.s=fm3 header.b=GClABYiz; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=eu1MQ8pl; arc=none smtp.remote-ip=103.168.172.144 Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8332B606A31C for ; Sun, 29 Nov 2026 22:36:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8332B606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cbannister.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cbannister.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=cbannister.uk header.i=@cbannister.uk header.a=rsa-sha256 header.s=fm3 header.b=GClABYiz; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=eu1MQ8pl Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id A7D3DEC0ABA for ; Sun, 29 Nov 2026 17:36:40 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sun, 29 Nov 2026 17:36:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbannister.uk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm3; t=1795991800; x=1796078200; bh=qj8dhSF9Qd /QoV2avVmtqyt0sk2gleWc6V91YNfSdtc=; b=GClABYizgSwl4kvUbPIXcLHiHs VgSzhz+SKls5UTtX5cT5oKyQc3G/T3dmJx9HLPFjm2L+XBop+4lUB2xc57syTcPp 6tFLn9Ts+Wx0irxiF+Y/0Yo9LaMI13rvlDvQo3ZM71bx81AT5qE0dZ6iuSmznnd+ WWkHMZ+X/p8nwemKJksTAbBGThwyoyyDtH6OgJW2BVg5vMCAExh+VKLTB24Sh2PN AmI2yuVxrf1O14MhaNldU2zEY65iO/f6QF3y0QMQtn6Zr6SLec+GsjwY8ul30tAR CbBa8xu5hP+smFd1jWZ+SSC7WsLHzfGkGBEvyYuD3tg+krOjCKBQ3qFyNIhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1795991800; x=1796078200; bh=qj8dhSF9Qd/QoV2avVmtqyt0sk2gleWc6V9 1YNfSdtc=; b=eu1MQ8plE1K901rNPsFJKrmPjpykppsniOCdKMrpT44rUBTsd8y mQDiad+9e9eRR3pECKSff35bnHtRiwimZaEJkRXxFFfT4tS1uoqHxtSyZAZC9k+8 bjGXr5+sXooY/u22T1HrHlcAQsIz+ukuBEMuHJVYnXApGLl6Vh6ypMs55XzslyQP Jm4qxSCNB1IOjN6DnaB3TR6b9r9JlA9veVkqBVzxM98yfW5vVNJlM4tbKSKpI24K AwFflvCVK6OAgWqzGhqxCWiVJq7ciZsU53TVoi/vzaFWTn0naxPwu+PJW24aK3GC KB8rV96NtNR2WGHOATT0rCxsq/9216xFEQg== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=cbannister.uk a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1795991800; d=cbannister.uk; mf=PGtlcm5lbEBjYmFubmlzdGVyLnVrPg==; rt=PGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:VzRqJbBNo3UnPCjBCsMFLVYgvedvtVW68zVnsLiHvshLn1Y z93iwO8e/pKVtQpW6KQfdG/xhGmgKngH3rBDTzhRyZUl3SwYJzHEEC0msVujQON1 BnK73qG/MlS1WGi8FuRHwvZQAybfv4pPRUGyzJlAj9wFRgyLdnCakkbGDQDcNib2 8Kkx5up7vk9jbS0pmkeqmayk6Nr+Xgg1f86myFV7AtikklCdQegXPEROcZpYWFda eYnBCyG6cg0VkEJ5AbPp2fOI6UskHa+22yUjbpvobOjF7G9cbTnN1NmUeagTjsnv +wDf5yO4Ja7VsgnKY9yh542OY0HZET5qTXPEgbw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=9; hn=cc,content-transfer-encoding,date,feedback-id,from, message-id,mime-version,subject,to; Message-Instance: m=1; h=sha256:E5yoAsI8Cwd6mr7xLPh2/ozp7ibn5I9vGzs9mIJp11A=:tuXPFvgmoPMhB6Mg/1kRd9SnL8rVC1pA6RO9i8RRynI=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFp8+U4ZPNXtVo4/XFRY73kihlQyRSGo6RHccqTXw3cW8Coe2i2vOsgn4nQtZT47R y/RKSx2OsoPcuqTEWuyT1c0/8qv5IRz3mHMDXzPftHxE6BosenyFYF/SS/B8lmZSmVapNd bm7PrSk8z/oxZDqkse9iJTV9nVDQGjgcEGVTp87JsQMGtIfbl8gaYuVVAUEgFzW1dIih8d 3f5j+KNvhV8SLDBT+O8lbCACk5pUnZLd9toXqq6t1bbzwajs9A3ikLJWmrRob897Qh/2Aj UNRlGtsI3/Ot0aaqYsFNXZXJz2M8h8qpBwENau/VbCyOT8NDdUIHVh7dUzeQhVItKgI1BE I0t5Tik7Vm5gqJOXy6yjhUhYW2r6NiRgdq8+WDkGW8k2rLNHUDb3za2FQxTWGIgS2+urWH 07bUXfw4Edt5CNJyZQJ8vAREslmWvh8pd6fyP0ACXAd32CoIg2KN9dcYQMQeeSQ2bCOv0P iVbt5D9x6xVCFvaWRXL73S8wBGOo0ZbLmf2ZYPq2cF0cXoJdKLLYDPiDAEtnqgzHe3TPxz D5UMUEWQj0kheRPDu8K6yxMvjIrCuU5ub/vF2KaMljA8fBAy4usSXkdDpZBMkwaSDJ9dkk BxB9ymDUiUuvq2sPS0vhOEZZWjgwxzkwhD3yNm9nwMDHAmGMd5rQ+y82sY2A X-ME-Proxy: Feedback-ID: ic4a04a9c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Nov 2026 17:36:39 -0500 (EST) From: Chris Bannister To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , "David S. Miller" , netdev@vger.kernel.org Cc: Willem de Bruijn , Simon Horman , Kuniyuki Iwashima , Shuah Khan , linux-kselftest@vger.kernel.org, regressions@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH net 0/3] rtnetlink: build full rtnl_getlink() replies in one RTNL section again Date: Sun, 29 Nov 2026 22:36:25 +0000 Message-ID: <20261129223628.2167924-1-kernel@cbannister.uk> X-Mailer: git-send-email 2.56.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since commit e896e5c0734b ("rtnetlink: do not acquire RTNL in rtnl_getlink() with RTEXT_FILTER_NAME_ONLY"), an RTM_GETLINK request that still needs RTNL looks the device up before taking RTNL and sends the reply after releasing it. Both gaps are reproduced on unmodified kernels: - A reply can be queued after a link notification built from newer state on the same socket. systemd-networkd applies such a reply as the current state, which is consistent with the VM boots where this was found: they lost carrier just after gaining it and got no DHCP lease. Reported in https://lore.kernel.org/all/20261129214529.4059732-1-kernel@cbannister.uk/. - A request by ifindex that races a move of the device to another netns can be answered with the device's data from its new netns. Reported in https://lore.kernel.org/all/20261129215752.251291-1-kernel@cbannister.uk/. 1/3 looks the device up under RTNL again for requests that need RTNL. 2/3 sends the reply before releasing RTNL. 3/3 adds a deterministic selftest for the netns case, which fails on that commit and on v7.4-rc4 and passes with 1/3 and 2/3. There is no deterministic selftest for the ordering. A single-patch version of 1/3 and 2/3 is available if preferred. One point on 3/3 needs a maintainer's judgement. The test holds RTNL by making the copy_to_user() in SIOCGIFCONF fault on a userfaultfd page, so it rests on dev_ifconf() copying out under RTNL. I cannot judge whether a test that depends on that detail is acceptable; if it is not, 1/3 and 2/3 stand without it. Each patch states how its bug was found and how the fix was tested. In short, on v7.4-rc4 against v7.4-rc4 with this series, with the same config, host and binaries: the ordering reproducer nlrace.c [1] saw 8 to 20 inversions in each of five 60-second runs, against none; the netns reproducer counted 47 foreign replies in 20,000 iterations, against none; and a lockdep, PROVE_RCU and KASAN build of the series ran the reproducers with no report. The only modified kernels cited here were diagnostic v7.3.6 builds with an inserted delay, used to confirm the effect on systemd-networkd boots. AI assistance: the investigation, the reproducers, the fix, the selftest, the commit messages and this cover letter were produced by AI tools directed by me: Claude Opus 5.5, Claude Fable 5.2 and Claude Sonnet 5.5 (Anthropic), and OpenAI gpt-6.2-sol and gpt-6.2-astra via Codex. Claude Fable 5.2 designed the fix and the selftest, and gpt-6.2-astra reviewed the fix. I personally reproduced both regressions on a bare-metal machine, reviewed nlrace.c and the fix patches, read the selftest without running it, and read rtnl_getlink() and __dev_change_net_namespace(). [1] https://github.com/zariel/linux-rtnetlink-getlink-regressions/blob/main/nlrace/c/nlrace.c Chris Bannister Chris Bannister (3): rtnetlink: look the device up under RTNL in full rtnl_getlink() requests rtnetlink: queue the rtnl_getlink() reply before releasing RTNL selftests: net: test that RTM_GETLINK answers from the target netns net/core/rtnetlink.c | 73 +++-- tools/testing/selftests/net/.gitignore | 1 + tools/testing/selftests/net/Makefile | 2 + tools/testing/selftests/net/config | 1 + tools/testing/selftests/net/rtnl_getlink.c | 356 +++++++++++++++++++++ 5 files changed, 405 insertions(+), 28 deletions(-) create mode 100644 tools/testing/selftests/net/rtnl_getlink.c base-commit: fad0d57b12f6979bc0127f0a4f704c6d7177ca78 -- 2.56.0