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=1796048094; b=fc9Fg3S2JnhO4UcEZFWsulKbnET+fRVODn2hGTZM9vN2+X//AA3SnO1ZoBCayiKkTfBR L1ZW4fo1sZ2G3VzkSfzcVuTIUm5PqZaVE56fNCl4UGYuDuAQNHdHOzZ+S2oC+r0E7P9CN 76ZcxGrzNV5nXjYEqJKjEi2TPkA14BK+BWxD6aXuUteO06781LgqsPvWb6BnXjsX1mXpN 5YDAL1cO9o66utK23wnjO997rq6zU70nZu0smRSt1StbzQSDo48iRDTGD9c39fTxKLsCr kMRcmZpxA3uEhH3GkgAUmCFGYryA8z0XmOJ65+NMoYbCoT2VZN4wqHFLl2qWoBVY21w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796048094; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=GQvpuy03j8Klknwts1zFN1vkCAF8SThjoMZP/l2YqGM=; b=ok1iz18Zku56u0nTIUVOIKmcOIFDIKiSHX6DSPJGWGmqIeaMy/06FIqyuOyRTev1zgsV Q8Miwh5jgq6a3Ag2Pr0AQZZrU9LJ8WF2Y71uvt8+VSt7/nuEZtgfWaW/4sEVLjsQQ+d67 KzBoIKN3r+eK9A9QrxmzR0ptlGilJ1X+qDW/fSudDcO8JYpNeuuIYP+m9NLCEGIjm/qXU YaPt0drcKdcjyngQcgPB8WIW3Illwc2y3CKcPM4/ur7m0fmmasD8PIa1o4Ir74tjAwvu7 6KTK6uiUruTmYvJeuIGR1JXI1qBn8GMv6b4fKUCz1EFLZIlHHrBZQcJhcz/ru+55t+Q== 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=P+0WLN+k; 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 UTF8SMTPS id 02A4B606A327; Mon, 30 Nov 2026 14:14:53 +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=P+0WLN+k Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 0A23F1F00896; Mon, 30 Nov 2026 14:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796048093; bh=GQvpuy03j8Klknwts1zFN1vkCAF8SThjoMZP/l2YqGM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=P+0WLN+khcdhML4mqtydlL10YsHJbsl+c6sX+cFBuwQPypyEzzl/q63WRTYeIDCzf YYyYyS9WAb3ne+mgGtNpsIIJz2/91/2ix9sPBoNYtVkFZRR2S9kci3KdBJRHYKDI76 knj1GWyr2Lt2yNX0KMFW/6ySWccfv980lX94BgpXnBicxTV0wZFePkF0JMqIGLNo+9 KJsmDi7qFitTeu7Dx6a2731JPCGr4hNhbxJNLe1ExcAj6wGD0uJaeyclqhlqZSa1Rv iMpMohl94SlnapqlTMfUz944dlts6pU5PU/g4XTYrZpXHrVihkAGbY8uCaxBsy3LGC M7EdhnGBha1vw== Date: Mon, 30 Nov 2026 16:14:49 +0200 From: Jarkko Sakkinen To: fsdevel@vger.kernel.org Cc: bpf@vger.kernel.org, containers@lists.linux.dev, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, Aleksa Sarai , Alexander Mikhalitsyn , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Christian Brauner , David Howells , Eric Biggers , Georgia Garcia , Giuseppe Scrivano , Hugh Dickins , James Morris , Jan Kara , Jeff Layton , John Johansen , Jonathan Corbet , Josef Bacik , Kees Cook , KP Singh , Lennart Poettering , Matt Bobrowski , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Neal Gompa , Oleg Nesterov , Paul Moore , Pavel Tikhomirov , Serge Hallyn , Shuah Khan , Stephen Smalley , Zygmunt Krynicki Subject: Re: [RFC PATCH v8 28/29] selftests/userland: Add userland test suite Message-ID: References: <20261128235808.2369970-1-jarkko@kernel.org> <20261128235808.2369970-29-jarkko@kernel.org> X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Nov 30, 2026 at 02:14:23PM +0200, Jarkko Sakkinen wrote: > On Mon, Nov 30, 2026 at 12:11:08PM +0200, Jarkko Sakkinen wrote: > > On Mon, Nov 30, 2026 at 09:01:34AM +0200, Jarkko Sakkinen wrote: > > > On Mon, Nov 30, 2026 at 08:49:42AM +0200, Jarkko Sakkinen wrote: > > > > On Mon, Nov 30, 2026 at 04:39:42AM +0200, Jarkko Sakkinen wrote: > > > > > On Mon, Nov 30, 2026 at 03:34:23AM +0200, Jarkko Sakkinen wrote: > > > > > > On Sun, Nov 29, 2026 at 01:58:07AM +0200, Jarkko Sakkinen wrote: > > > > > > > Verify the userland_open() control object, namespace sharing, > > > > > > > mount-namespace configuration, waitid(P_USERLAND), pidfd_send_signal(), > > > > > > > and userns_set_idmap() uAPI and security invariants across privileged, > > > > > > > unprivileged, SCM_RIGHTS delegation, and edge-case scenarios. > > > > > > > > > > > > > > Signed-off-by: Jarkko Sakkinen > > > > > > > > > > > > > > > > > > At https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd-test.git/: > > > > > > > > > > > > $ make > > > > > > make help Show this help > > > > > > make list List available defconfigs > > > > > > make download Prime the download cache > > > > > > make sdk Build and cache SDK toolchains > > > > > > make configure Force configuration > > > > > > make savedefconfig Save minimal defconfig > > > > > > make linux-update-defconfig Save minimal kernel defconfig > > > > > > make build Incrementally build (FORCE=1 to run again) > > > > > > make userland Build with userland trees (FORCE=1 to run again) > > > > > > make ssh Open an SSH session to > > > > > > make burn Write existing image to DEVICE (does not build) > > > > > > make clean Remove build artifacts > > > > > > make clean-sdk Remove cached SDK toolchains > > > > > > make lint Run linters > > > > > > > > > > > > "userland" target builds a a hybrid ISO containing a bootc/composefs > > > > > > based OS build, and having Userland-patched Linux, SystemD, Bubblewrap > > > > > > and Podman. My kernel testing suite has developed into a Silverblue'ish > > > > > > environment because I needed something like that for testing lockdown > > > > > > hibernate patches. > > > > > > > > > > > > Here's virsh hosted "tpmdd_amd64.iso" built with "make userland > > > > > > BOARD=tpmdd_amd64" running the kselftest: > > > > > > > > > > > > TAP version 13 > > > > > > 1..1 > > > > > > kselftest: Running tests in userland > > > > > > # timeout set to 45 > > > > > > # selftests: userland: test_smoke.sh > > > > > > # TAP version 13 > > > > > > # 1..17 > > > > > > # ok 1 UserlandUapiTest.test_cell_broadcast_kill > > > > > > # ok 2 UserlandUapiTest.test_cell_lifecycle_exec_and_hot_mount > > > > > > # ok 3 UserlandUapiTest.test_clone_flags_and_pidns_ancestry > > > > > > # ok 3 UserlandUapiTest.test_clone_flags_and_pidns_ancestry > > > > > > # ok 3 UserlandUapiTest.test_clone_flags_and_pidns_ancestry > > > > > > # ok 3 UserlandUapiTest.test_clone_flags_and_pidns_ancestry > > > > > > # ok 3 UserlandUapiTest.test_clone_flags_and_pidns_ancestry > > > > > > # ok 4 UserlandUapiTest.test_concurrent_bootstrap > > > > > > # ok 5 UserlandUapiTest.test_create_flags > > > > > > # ok 6 UserlandUapiTest.test_get_nsfd > > > > > > # # UserlandUapiTest.test_landlock_namespace_use: Landlock not enabled > > > > > > # ok 7 UserlandUapiTest.test_landlock_namespace_use # SKIP > > > > > > # ok 8 UserlandUapiTest.test_mount_and_fsconfig_validation > > > > > > # ok 9 UserlandUapiTest.test_pivot_root_and_standalone_mntns_hot_mount > > > > > > # ok 10 UserlandUapiTest.test_proc_submount_and_nested_namespaces > > > > > > # ok 11 UserlandUapiTest.test_send_signal_and_kill_on_close > > > > > > # ok 12 UserlandUapiTest.test_setns_owner_vs_foreign > > > > > > # ok 13 UserlandUapiTest.test_share_nsfd > > > > > > # ok 14 UserlandUapiTest.test_unprivileged_without_entering_userns > > > > > > # ok 15 UserlandUapiTest.test_userns_set_idmap > > > > > > # ok 16 UserlandUapiTest.test_userns_set_idmap_delegation > > > > > > # ok 17 UserlandUapiTest.test_wait_poll_and_clone_dead > > > > > > # # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage. > > > > > > # # Totals: pass:16 fail:0 xfail:0 xpass:0 skip:1 error:0 > > > > > > ok 1 selftests: userland: test_smoke.sh > > > > > > # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 > > > > > > > > > > > > Yes, I should "CONFIG_LANDLOCK=y". It's the next thing on the list. > > > > > > > > > > > > Generally I plan to make it model based stochastic test with seed > > > > > > printed at start so that failures can be replayed. > > > > > > > > > > > > I've used model based testing lately very successfully in my Landstrip > > > > > > stateless parametric agent sandbox (compatible with Anthtropic's policy > > > > > > format): https://github.com/landstrip/landstrip > > > > > > > > > > > > It feels like right way to go so that the syscall interface can be > > > > > > actually stressed. > > > > > > > > > > It's also "crypto-ready" architecture. I.e. given that entities are > > > > > inspired by confidential computing workloads, there's a clean staging > > > > > phase, and that provides integration points for having cryptograhic > > > > > measurement, if that is ever wanted. Obviously, that would be still > > > > > non-trivial problem but architecture is doing best effort on helping > > > > > to resolve it. > > > > > > > > This could be useful actually in lockdown-hibernate. It could have > > > > more zeroing host OS state mode as long as boostrap can decrypt > > > > the container after powering up back from S4. > > > > > > > > Unconsidered idea, and partly off-topic but had to write this down > > > > as lockdown-hibernate is active review process. > > > > > > > > I.e., possibly in addition to PCR 5 trampoline, it should have > > > > "container mode". > > > > > > In container-S4-wakeup the same trampoline would be used but I'm > > > thinking could you only sign a critical portion of the RAM and > > > forget rest and wake up rest of the state from a container. > > > > > > Might be a bad idea but highlights how important it would be for a > > > container abstraction to be relatively opaque object so that other > > > things like authentication and power management have also room for > > > consideration. > > > > > > I think where the design is going wrong all the time is to consider this > > > as Linux namespaces feature while container is actually more like "soft > > > arch" and the feature that I've been doing can be imagined as "soft > > > kexec". > > > > I have now rudimentary model-based test. Initially it just generates a > > test case per category but before I push this I'll make it generate a > > bunch of test cases per category; each randomized per run. > > > > I also pixel-perfected Cells-emulator quite a lot and it is much more > > comparable than the one in this patch set. These obviously exercise > > also kselftest/cells/userland stack. The test is now in fact in good > > shape enough that it would be easy to to make it even cross patch > > set compatible. > > > > Example output: > > > > TAP version 13 > > 1..1 > > # timeout set to 120 > > # selftests: userland: test_smoke.sh > > # TAP version 13 > > # 1..6 > > # # seed 0xdeac25bb4153280d (replay: USERLAND_SEED=0xdeac25bb4153280d) > > # ok 1 reproduce > > # ok 2 lifecycle > > # ok 3 idmap > > # ok 4 mounts > > # ok 5 cells > > # # landlock: Landlock not enabled > > # ok 6 landlock # SKIP > > # # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage. > > # # Totals: pass:5 fail:0 xfail:0 xpass:0 skip:1 error:0 > > ok 1 selftests: userland: test_smoke.sh > > # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 > > Perhaps this should be named as userns_* something i.e. from > userland_open to userns_something() (userns_container()?). It's userns > subsystem "enough" feature so that I don't think it really even needs a > subsystem. Subsystem partitioning has not been considered much yet. > > I just had a well-though solution for the long-running problem, > and wanted to address that. MAINTAINERS exists in the patch set > only because the current partitioning enforces to do so. > > I wanted to address that because I'm not seeking for "influential power" > willingly or eagerly. > > I look at different things in Linux, and namespaces is more alien world > to me. Sometimes it helps to look at alien topics because it enforced me > to play flipper with the sequencing to see what happens, what works and > what does not. > > Informal reasoning is a great thing, isn't it? :-) > > And I absolutely had to do all the wiring and Python-Cells because it > would be ultimately stupid (or trolling) to put out something like this > if you are not bullet proof on what you're saying about your work. Or > alternatively, be wrong but from honest grounds. > > I extended tests to 16 per category (and will enable landlock): > > TAP version 13 > 1..1 > # timeout set to 120 > # selftests: userland: test_smoke.sh > # TAP version 13 > # 1..192 > # # seed 0x7c037cb17bfb774a (replay: USERLAND_SEED=0x7c037cb17bfb774a) > # ok 1 reproduce.00 > # ok 2 reproduce.01 > # ok 3 reproduce.02 > # ok 4 reproduce.03 > # ok 5 reproduce.04 > # ok 6 reproduce.05 > # ok 7 reproduce.06 > # ok 8 reproduce.07 > # ok 9 reproduce.08 > # ok 10 reproduce.09 > # ok 11 reproduce.10 > # ok 12 reproduce.11 > # ok 13 reproduce.12 > # ok 14 reproduce.13 > # ok 15 reproduce.14 > # ok 16 reproduce.15 > # ok 17 reproduce.16 > # ok 18 reproduce.17 > # ok 19 reproduce.18 > # ok 20 reproduce.19 > # ok 21 reproduce.20 > # ok 22 reproduce.21 > # ok 23 reproduce.22 > # ok 24 reproduce.23 > # ok 25 reproduce.24 > # ok 26 reproduce.25 > # ok 27 reproduce.26 > # ok 28 reproduce.27 > # ok 29 reproduce.28 > # ok 30 reproduce.29 > # ok 31 reproduce.30 > # ok 32 reproduce.31 > # ok 33 lifecycle.00 > # ok 34 lifecycle.01 > # ok 35 lifecycle.02 > # ok 36 lifecycle.03 > # ok 37 lifecycle.04 > # ok 38 lifecycle.05 > # ok 39 lifecycle.06 > # ok 40 lifecycle.07 > # ok 41 lifecycle.08 > # ok 42 lifecycle.09 > # ok 43 lifecycle.10 > # ok 44 lifecycle.11 > # ok 45 lifecycle.12 > # ok 46 lifecycle.13 > # ok 47 lifecycle.14 > # ok 48 lifecycle.15 > # ok 49 lifecycle.16 > # ok 50 lifecycle.17 > # ok 51 lifecycle.18 > # ok 52 lifecycle.19 > # ok 53 lifecycle.20 > # ok 54 lifecycle.21 > # ok 55 lifecycle.22 > # ok 56 lifecycle.23 > # ok 57 lifecycle.24 > # ok 58 lifecycle.25 > # ok 59 lifecycle.26 > # ok 60 lifecycle.27 > # ok 61 lifecycle.28 > # ok 62 lifecycle.29 > # ok 63 lifecycle.30 > # ok 64 lifecycle.31 > # ok 65 idmap.00 > # ok 66 idmap.01 > # ok 67 idmap.02 > # ok 68 idmap.03 > # ok 69 idmap.04 > # ok 70 idmap.05 > # ok 71 idmap.06 > # ok 72 idmap.07 > # ok 73 idmap.08 > # ok 74 idmap.09 > # ok 75 idmap.10 > # ok 76 idmap.11 > # ok 77 idmap.12 > # ok 78 idmap.13 > # ok 79 idmap.14 > # ok 80 idmap.15 > # ok 81 idmap.16 > # ok 82 idmap.17 > # ok 83 idmap.18 > # ok 84 idmap.19 > # ok 85 idmap.20 > # ok 86 idmap.21 > # ok 87 idmap.22 > # ok 88 idmap.23 > # ok 89 idmap.24 > # ok 90 idmap.25 > # ok 91 idmap.26 > # ok 92 idmap.27 > # ok 93 idmap.28 > # ok 94 idmap.29 > # ok 95 idmap.30 > # ok 96 idmap.31 > # ok 97 mounts.00 > # ok 98 mounts.01 > # ok 99 mounts.02 > # ok 100 mounts.03 > # ok 101 mounts.04 > # ok 102 mounts.05 > # ok 103 mounts.06 > # ok 104 mounts.07 > # ok 105 mounts.08 > # ok 106 mounts.09 > # ok 107 mounts.10 > # ok 108 mounts.11 > # ok 109 mounts.12 > # ok 110 mounts.13 > # ok 111 mounts.14 > # ok 112 mounts.15 > # ok 113 mounts.16 > # ok 114 mounts.17 > # ok 115 mounts.18 > # ok 116 mounts.19 > # ok 117 mounts.20 > # ok 118 mounts.21 > # ok 119 mounts.22 > # ok 120 mounts.23 > # ok 121 mounts.24 > # ok 122 mounts.25 > # ok 123 mounts.26 > # ok 124 mounts.27 > # ok 125 mounts.28 > # ok 126 mounts.29 > # ok 127 mounts.30 > # ok 128 mounts.31 > # ok 129 cells.00 > # ok 130 cells.01 > # ok 131 cells.02 > # ok 132 cells.03 > # ok 133 cells.04 > # ok 134 cells.05 > # ok 135 cells.06 > # ok 136 cells.07 > # ok 137 cells.08 > # ok 138 cells.09 > # ok 139 cells.10 > # ok 140 cells.11 > # ok 141 cells.12 > # ok 142 cells.13 > # ok 143 cells.14 > # ok 144 cells.15 > # ok 145 cells.16 > # ok 146 cells.17 > # ok 147 cells.18 > # ok 148 cells.19 > # ok 149 cells.20 > # ok 150 cells.21 > # ok 151 cells.22 > # ok 152 cells.23 > # ok 153 cells.24 > # ok 154 cells.25 > # ok 155 cells.26 > # ok 156 cells.27 > # ok 157 cells.28 > # ok 158 cells.29 > # ok 159 cells.30 > # ok 160 cells.31 > # # landlock: Landlock not enabled > # ok 161 landlock.00 # SKIP > # ok 162 landlock.01 # SKIP > # ok 163 landlock.02 # SKIP > # ok 164 landlock.03 # SKIP > # ok 165 landlock.04 # SKIP > # ok 166 landlock.05 # SKIP > # ok 167 landlock.06 # SKIP > # ok 168 landlock.07 # SKIP > # ok 169 landlock.08 # SKIP > # ok 170 landlock.09 # SKIP > # ok 171 landlock.10 # SKIP > # ok 172 landlock.11 # SKIP > # ok 173 landlock.12 # SKIP > # ok 174 landlock.13 # SKIP > # ok 175 landlock.14 # SKIP > # ok 176 landlock.15 # SKIP > # ok 177 landlock.16 # SKIP > # ok 178 landlock.17 # SKIP > # ok 179 landlock.18 # SKIP > # ok 180 landlock.19 # SKIP > # ok 181 landlock.20 # SKIP > # ok 182 landlock.21 # SKIP > # ok 183 landlock.22 # SKIP > # ok 184 landlock.23 # SKIP > # ok 185 landlock.24 # SKIP > # ok 186 landlock.25 # SKIP > # ok 187 landlock.26 # SKIP > # ok 188 landlock.27 # SKIP > # ok 189 landlock.28 # SKIP > # ok 190 landlock.29 # SKIP > # ok 191 landlock.30 # SKIP > # ok 192 landlock.31 # SKIP > # # 32 skipped test(s) detected. Consider enabling relevant config options to improve coverage. > # # Totals: pass:160 fail:0 xfail:0 xpass:0 skip:32 error:0 > ok 1 selftests: userland: test_smoke.sh > # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 > > Not yet pushed. I think it could generate a test name just for the > output based on the sequence. > > Just wanted to address maintainer part. Nope. Not that interested. Now kselftest run also generates also names of the tests on fly and output is more useful. This also led into finding a whole shebang of bugs that I'm fixing ATM. MDT fuzzing seems to be a winner for this type of feature. And since the runs are shuffled, they can from time to time squeeze out a bug or two. There's USERLAND_SEED for replay. This is still local (I'll address the bugs before pushing). For what it is worth, I would think that userns is the most logical location for this, as it is the frame structure. For example, userns_set_idmap() and userns_container() would sound like common sense names, and does not prevent naming the constants with just "CONTAINER"-prefix. I.e., then "CLONE_INTO_USERLAND" would be substituted with "CLONE_INTO_CONTAINER". Not clever but naming gets the message delivered (what it is). Br, Jarkko