From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795214697; b=k55IUbyuXqz5Z6wJAl07DlWVQqjvY0IC+CfITORogde3WTmdC9GHY+yM/GH+ryncKMC/ kCF/sMZSjisbLVHHUXP5Kp/Sk6Ix3D5WoL9ZOC7kMCHqsWyhoJV4u9NsBPnI9YspUisUq M/dk5k1ciP94jU5LFVwOS5nJxYy/JZlqDjSYqI3UoV42qs/wz7E1or/mJ75xUt4K5tzaO eVtYpBxb5ycd82KuAw1XFTKrT3z2beL2JMxPPeU4ytnihq3duGqPrmeRDjbMrXyHvNnb2 JNZ0ln5LbqorZuTUpo6kpGbu8jtILxEqGpQfkZvLtNX5M4gRHKNcwbCCH2dYnQhyHbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795214697; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=p2Lf6qpcYVJhQ5+q/779aR/iL3yLTW5qgQJ75weSGn4=; b=hG21ps0OshoInEDU7soLfE+Dw4AWZc1NrzKUxNhF1hiCaUeKkebPOgdoLTmKAnsQ3F6m XQ5R2UT62lA+J8qcpSLM/T3MTWH5RdzjurAI69JXGzrURS1f5GqirZ2EWMVWX868r8HQ/ eNWwuPjY+6MFgIzx912HFD2dACgLwVJx06fVM6dd+g3C+YRmIkDzldTko2R5F/fNQYTAw 62/qHkdH/yA48dgl9aphW4Fp+APM7xpQRYmgEosS+tkoz1eBvdp/05YGyCZPR2WrHHIK3 +Gsvehme4eJSoAQlzskCM6tUERH3ovH4zIg12z5HBo8wv1mrieUgFjejtU3RFUwjFwA== 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=VS5VVo7j; arc=none smtp.remote-ip=100.103.45.18 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 C8B4F606A684 for ; Fri, 20 Nov 2026 22:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VS5VVo7j Received: by smtp.kernel.org (Postfix) with ESMTPSA id D168D1F000E0; Fri, 20 Nov 2026 22:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795214697; bh=p2Lf6qpcYVJhQ5+q/779aR/iL3yLTW5qgQJ75weSGn4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VS5VVo7jR8o9HFGRVBMaebXWwvuWWI8YlUW/45Fk+GzxPhR5b82izYDOtFYH74FD4 FkZtvDm5bTTPH1SyT+RSOm8jKHjtbdUmYWtBlCMGw4La2B3p1phgsBE4IW6yM9E2kv lqjxol/m+d7i9nSgiQBtoklLVYGFMrdxr9HiIQXEPW8HXqkbEmmJWKtu8Avuu4nkZz eJWeN1lEqr5xxU+JwV78FwX9nlLAaTRnEy3gP+htbeWSa3b/Vzfn+3ALeMpuMnN0R5 uRP+RCU2x26NhQtg/3FHhW5NOh1eb50DR3FJem32SfLytVRCzBMlAEVWzwF2iPwFXM OszCw/wOYPplQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v4 13/14] selftests/rootns: Add root namespace test suite Reply-To: sashiko-reviews@lists.linux.dev To: "Jarkko Sakkinen" Cc: linux-mm@kvack.org, linux-security-module@vger.kernel.org, "Albert Ou" , "Alexander Gordeev" , "Alexander Viro" , "Alexandre Ghiti" , "Andreas Larsson" , "Andrew Morton" , "Andy Lutomirski" , "Andy Lutomirski" , "Anna-Maria Behnsen" , "Arnd Bergmann" , "Ben Segall" , "Borislav Petkov" , "Casey Schaufler" , "Catalin Marinas" , "Christian Borntraeger" , "Christian Brauner" , =?utf-8?b?Q2hyaXN0b3BoZSBMZXJveSAoQ1Mg?= =?utf-8?b?R1JPVVAp?= , "Chris Zankel" , "Dave Hansen" , "David Hildenbrand" , "David Howells" , "Davidlohr Bueso" , "David S. Miller" , "Dietmar Eggemann" , "Frederic Weisbecker" , "Geert Uytterhoeven" , "Hallgrimur H. Gunnarsson" , "Heiko Carstens" , "Helge Deller" , "H. Peter Anvin" , "Ingo Molnar" , "James E.J. Bottomley" , "Jan Kara" , "John Johansen" , "John Paul Adrian Glaubitz" , "Jonathan Corbet" , "Josef Bacik" , "Juri Lelli" , "Kees Cook" , "K Prateek Nayak" , "Liam R. Howlett" , "Lorenzo Stoakes" , "Madhavan Srinivasan" , "Magnus Lindholm" , "Manfred Spraul" , "Mark Rutland" , "Matt Turner" , "Max Filippov" , "Mel Gorman" , "Michael Ellerman" , "Michal Hocko" , "Michal Simek" , "Mike Rapoport" , "Neal Gompa" , "Nicholas Piggin" , "Palmer Dabbelt" , "Paul Moore" , "Paul Walmsley" , "Pavel Tikhomirov" , "Peter Zijlstra" , "Randy Dunlap" , "Richard Henderson" , "Rich Felker" , =?utf-8?b?Uml0ZXNoIEhhcmphbmkgKElCTSk=?= , "Russell King" , "Serge Hallyn" , "Shrikanth Hegde" , "Shuah Khan" , "Steven Rostedt" , "Suren Baghdasaryan" , "Sven Schnelle" , "Thomas Bogendoerfer" , "Thomas Gleixner" , "Valentin Schneider" , "Vasily Gorbik" , "Vincent Guittot" , "Vincenzo Frascino" , "Vlastimil Babka" , "Will Deacon" , "Yoshinori Sato" , "Zygmunt Krynicki" In-Reply-To: <20261119224312.1037966-14-jarkko@kernel.org> References: <20261119224312.1037966-1-jarkko@kernel.org> <20261119224312.1037966-14-jarkko@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 20 Nov 2026 22:44:52 +0000 X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] selftests/rootns: wrong _IOC_NONE direction in _io() on wide-ioc archs - [Low] selftests/rootns: non-blocking accepted socket in CellService._on_accept() - [Low] selftests/rootns: resource leaks on Cell init and test setUp() failures -- commit 646cdbb1cf35062e2a914f151927bb968fe747a7 Author: Jarkko Sakkinen selftests/rootns: Add root namespace test suite This commit adds a kselftest suite for the rootns and mount-namespace configuration uAPI, covering privileged, unprivileged, and edge-case scenarios. > diff --git a/tools/testing/selftests/rootns/rootns_cells.py b/tools/testi= ng/selftests/rootns/rootns_cells.py > new file mode 100755 > index 0000000000000..b690ed71a5211 > --- /dev/null > +++ b/tools/testing/selftests/rootns/rootns_cells.py [ ... ] > +def _io(magic: int, nr: int) -> int: > + return _ioc(0, magic, nr, 0) > + > + > +def _iowr(magic: int, nr: int, size: int) -> int: > + rw =3D 6 if _is_wide_ioc_arch() else 3 > + return _ioc(rw, magic, nr, size) [Severity: Medium] Should _io() pass direction 1 instead of 0 when _is_wide_ioc_arch() is True? On PowerPC, SPARC, Alpha, and MIPS, _IOC_NONE is 1U rather than 0U, so _IO() sets bit 29. Passing 0 encodes the wrong ioctl numbers for ROOTNS_GET_NSFD, ROOTNS_KILL, and NS_GET_*, causing the kernel to reject them with ENOTTY. [ ... ] > +@dataclass > +class Cell: > + name: str > + flags: int =3D ROOTNS_KILL_ON_CLOSE | ROOTNS_CLOSE_ON_EXEC > + cfd: int =3D field(init=3DFalse, default=3D-1) > + mntns_fd: int =3D field(init=3DFalse, default=3D-1) > + root_dfd: int =3D field(init=3DFalse, default=3D-1) > + init_pid: int | None =3D field(init=3DFalse, default=3DNone) > + exit_status: int | None =3D field(init=3DFalse, default=3DNone) > + > + def __post_init__(self) -> None: > + self.cfd =3D rootns(self.flags) > + self.mntns_fd =3D rootns_get_nsfd(self.cfd, CLONE_NEWNS) [Severity: Low] Does Cell.__post_init__() leak self.cfd and the namespaces it pins if rootns_get_nsfd() raises OSError? Similarly, in rootns_test.py, unittest does not run tearDown() when setUp() fails or raises an exception, so CellServiceTest.setUp() leaks self.daemon_pid and self.tmpdir if the daemon readiness loop calls self.fail(), and RootnsUapiTest.setUp() leaks self.cell's file descriptors if setup_rootfs() fails. [ ... ] > +class CellService: > + def __init__(self, sock_path: str) -> None: [ ... ] > + self.srv.setblocking(False) > + self.sel.register(self.srv, selectors.EVENT_READ, self._on_accep= t) [ ... ] > + def _on_accept(self) -> None: > + conn, _ =3D self.srv.accept() > + with conn: > + data =3D b"" > + while not data.endswith(b"\n"): > + chunk =3D conn.recv(4096) > + if not chunk: > + break > + data +=3D chunk [Severity: Low] Can conn.recv(4096) raise an uncaught BlockingIOError here? In Python, socket.accept() on a non-blocking listening socket returns a non-blocking client socket. If _on_accept() runs after connect() wakes the listening socket but before the client sends its request line, conn.recv() fails with EAGAIN and crashes serve_forever() unless conn.setblocking(True) is called first. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261119224312.1037= 966-1-jarkko@kernel.org?part=3D13