From nobody Sun Feb 8 06:56:24 2026 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD9F72BFC85 for ; Wed, 4 Feb 2026 02:28:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770172126; cv=none; b=u8kxM2LrPghe7DI0HfKUOPrFkp+vZ5jsSuHJw5FA5wHyikILNfbbkKaRvZp9sKdSbqCGOrUVCu2OTByIKhvVCeFXKeuxUBGV2cHsuWQLS+dq2Tjj1ql5Jh+wVy0QPipeEGaVhXZnnpN5jC3FMsU+vaL7XGIMfpC5zki5u9wVPyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770172126; c=relaxed/simple; bh=4EOBn6D9NOchkWdntR2OzGY3J6Nkq9fmc4qX1hahIuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lY176CG5wcfFLGWd0wb7XneILlBExDD3EdeutdnNFXiXbKzYx+xwsBtxVORDUojf3m7eBEiiMobz0ehdZ+kqpvB0JYSn/GCI7mUuvYPEt4djKEu8Af7eItwJUy3+Uzg78wpgXDHfbd/Sv7P5OKBZAk7hwsMYrZE0OArSFpBRIJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GsFfRnx9; arc=none smtp.client-ip=209.85.210.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GsFfRnx9" Received: by mail-pf1-f196.google.com with SMTP id d2e1a72fcca58-82311f4070cso274201b3a.0 for ; Tue, 03 Feb 2026 18:28:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770172116; x=1770776916; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6ipAR8Fz6rCIEqHC+jf7avJINpUheKc7NzcjSyRooHM=; b=GsFfRnx9P6ucJCKaM1DYw8pp+XsvslW8+utpWM5aeDw3WTVuuQaA3BjILIoXRHjByZ 7NeyFI3ljJPbHgoi4REpkebux5a0yw76U4Blk+Jk/M6SLTjDbI9U9rgoN2mksKiJsGDp bTzAGG7nnOKp1ag9uQ7gQYcBQBtDROZY9WGYst6AIEsdcgZMjA38RVYS16n56VPxbOex hJmUcRajEhZxumuKz12F3Ns6wbVi0/yLtQdi6kbB/pJxl6GX52ia0W9qcP3q+7zYnXZy 2edB7NUc8oVMp2J1EfvehXyPyTovL/fa5+KAIRvm3ziHCMR7ie1Sp49ujpBWC6pLD1fw 0NFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770172116; x=1770776916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6ipAR8Fz6rCIEqHC+jf7avJINpUheKc7NzcjSyRooHM=; b=S6tD3smYs4MR2XSMYfxhShqUlqV7d47oFByTsEF/LU1cxxeCkrRniCR30G0KEFqA++ ZvHrmnzyOf9EEraZAUby+D0Fhq5Oh1d/Sf7Ro1XDwGKcn3vgH9B5t/aSVLQNQEalIZ9J yJFtUxJ4muWwN93srQ9hQ7YnUSDyo3CyUk363Kpj1Uk6gi38ZCtmmaFYGt+FlxsyKKBS vDuLWIHTqNXrSBxc+ANMBbDkgIrXpEKMCxzWpkiiG23gPBTDtbdxfWgzOiFjg/csd4OB AKZ9k84n0IQrS0ayr7wni+/as0xcyPd+m09WWDGmcKdRWI+FjkcXL8qKpSlvMiNgXGHG NmzQ== X-Forwarded-Encrypted: i=1; AJvYcCXwRcL1xzE/dYxolnqVXZl3eZrbmFzMVDEoZsnqXUupQUZsvrGp6tg5Yp/hZjdlI2BD3vBKX7hYyFfOOgo=@vger.kernel.org X-Gm-Message-State: AOJu0YwjUoQzPwkmVXSTf6S2bdAS3gyw6TNtAC/Bb8qlIrkhGZNnUyzK yuwTKEow0mdsbXlEFCPakTWGOvZSRS9MsFk/9SwkiH2TaaU6R2wA1l6j X-Gm-Gg: AZuq6aJesHn08TmzF+qZ2mFWazn2nlOEfTPx2tahm1ok9bmUbFc3tW9NRfnF9+6Q3z3 bGA0D1OA3MdnbIR+Ha0ld1DWnksLCu8Uy7vjeu3H7SHj0tfjAD9bewoYwR/92uhMnAnc6hdRgrC 3S1ZBW5KaATTkWoU/vt+Q7lDDHhJd9YW/3VGaonxXkeCE+kyXIvd/eCW96zF4u0UA6gRSB7cimU AEwyYaUPDQWjBaIqgguEkJX327OABVjROjvowMkmmLlZO9gjBjdYXaoahrzaTFOhx06loQ1e9D4 8+UWydP+d+42hyMXBL/bBDnA0yVMIGzRqGfuuVRlUwxwNxpGHZYgOHOHsgvtUQ0YIz02oGGAM5l XwWbVScE6/RqposkRZ25O0Cmd+kDqxCBNCRLdK1H6fcf4W/ke33cEIsrQ2N3isRVlwf7NhDOZ1Y V/6Y5bq5N2gOf/hHCzo1y+nJPyfSEQMgzrIovKB5VTp+m6mJ06ek+3O7QbYIxwdfWlQiv9HKDf5 IZzYNMIwoORsoBn X-Received: by 2002:a05:6a00:3927:b0:81f:be27:8d16 with SMTP id d2e1a72fcca58-8241c676169mr1501741b3a.21.1770172116190; Tue, 03 Feb 2026 18:28:36 -0800 (PST) Received: from ikb-h07-29-noble.in.iijlab.net ([202.214.97.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8241d47b875sm682709b3a.55.2026.02.03.18.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Feb 2026 18:28:34 -0800 (PST) Received: by ikb-h07-29-noble.in.iijlab.net (Postfix, from userid 1010) id D1AE91200C47; Wed, 4 Feb 2026 11:28:33 +0900 (JST) From: Hajime Tazaki To: linux-um@lists.infradead.org Cc: thehajime@gmail.com, ricarkol@google.com, Liam.Howlett@oracle.com, linux-kernel@vger.kernel.org Subject: [PATCH v14 12/13] um: nommu: add documentation of nommu UML Date: Wed, 4 Feb 2026 11:28:10 +0900 Message-ID: <950680efa307cd1512ffb029c6d04abb0eed4deb.1770170302.git.thehajime@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki --- Documentation/virt/uml/nommu-uml.rst | 181 +++++++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 182 insertions(+) create mode 100644 Documentation/virt/uml/nommu-uml.rst diff --git a/Documentation/virt/uml/nommu-uml.rst b/Documentation/virt/uml/= nommu-uml.rst new file mode 100644 index 000000000000..b359af1155bb --- /dev/null +++ b/Documentation/virt/uml/nommu-uml.rst @@ -0,0 +1,181 @@ +.. SPDX-License-Identifier: GPL-2.0 + +UML has been built with CONFIG_MMU since day 0. The patchset +introduces the nommu mode on UML in a different angle in order to +cover broader code to be executed over UML. + +.. contents:: :local: + +What is it for ? +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +- To exercises nommu code over UML (and over KUnit) +- Reduce syscall latency triggered with the interactions of multiple + processes + + +How it works ? +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +To illustrate how this feature works, the below shows how syscalls are +called under nommu/UML environment. + +- boot kernel, install seccomp filter if ``syscall`` instructions are + called from userspace memory based on the address of instruction + pointer +- (userspace starts) +- calls ``vfork``/``execve`` syscalls +- ``SIGSYS`` signal raised, handler calls syscall entry point ``__kernel_v= syscall`` +- call handler function in ``sys_call_table[]`` and follow how UML syscall + works +- return to userspace + + +What are the differences from MMU-full UML ? +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The current nommu implementation adds 3 different functions which +MMU-full UML doesn't have: + +- kernel address space can directly be accessible from userspace + - so, ``uaccess()`` always returns 1 + - generic implementation of memcpy/strcpy/futex is also used +- alternate syscall entrypoint +- alternate syscall hook with a different seccomp filter + +With those modifications, it allows us to use unmodified userspace +binaries with nommu UML. + + +History +=3D=3D=3D=3D=3D=3D=3D + +This feature was originally introduced by Ricardo Koller at Open +Source Summit NA 2020, then integrated with the syscall translation +functionality with the clean up to the original code. + +Building and run +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +:: + + make ARCH=3Dum x86_64_nommu_defconfig + make ARCH=3Dum + +will build UML with ``CONFIG_MMU=3Dn`` applied. + +Kunit tests can run with the following command:: + + ./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_MMU=3Dn --kconf= ig_add CONFIG_KUNIT_UML_PCI=3Dn + +To run a typical Linux distribution, we need nommu-aware userspace. +We can use a stock version of Alpine Linux with nommu-built version of +busybox and musl-libc, which are available as additional packages. + + +Preparing root filesystem +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +nommu UML requires to use a specific standard library which is aware +of nommu kernel. We have tested custom-build musl-libc and busybox, +both of which have built-in support for nommu kernels. + +There are no available Linux distributions for nommu under x86_64 +architecture, so we need to prepare our own image for the root +filesystem. We use Alpine Linux as a base distribution and replace +busybox and musl-libc on top of that. The following are the step to +prepare the filesystem for the quick start:: + + container_id=3D$(docker create ghcr.io/thehajime/alpine:3.20.3-um-nom= mu) + docker start $container_id + docker wait $container_id + docker export $container_id > alpine.tar + docker rm $container_id + + mnt=3D$(mktemp -d) + dd if=3D/dev/zero of=3Dalpine.ext4 bs=3D1 count=3D0 seek=3D1G + sudo chmod og+wr "alpine.ext4" + yes 2>/dev/null | mkfs.ext4 "alpine.ext4" || true + sudo mount "alpine.ext4" $mnt + sudo tar -xf alpine.tar -C $mnt + sudo umount $mnt + +This will create a file image, ``alpine.ext4``, which contains busybox +and musl with nommu build on the Alpine Linux root filesystem. The +file can be specified to the argument ``ubd0=3D`` to the UML command line:: + + ./vmlinux ubd0=3D./alpine.ext4 rw mem=3D1024m loglevel=3D8 init=3D/sbin/= init + +We plan to upstream the apk packages for busybox and musl so that we +can follow the proper procedure to set up the root filesystem. + + +Quick start with docker +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +There is a docker image that you can quickly start with a simple step:: + + docker run -it -v /dev/shm:/dev/shm --rm ghcr.io/thehajime/alpine:3.20.3= -um-nommu + +This will launch a UML instance with an pre-configured root filesystem. + +Benchmark +=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The below shows an example of performance measurement conducted with +lmbench and (self-crafted) getpid benchmark (with v6.17-rc5 uml/next +tree). + +.. csv-table:: lmbench (usec) + :header: ,native,um,um-mmu(s),um-nommu(s) + + select-10 ,0.5319,36.1214,24.2795,2.9174 + select-100 ,1.6019,34.6049,28.8865,3.8080 + select-1000 ,12.2588,43.6838,48.7438,12.7872 + syscall ,0.1644,35.0321,53.2119,2.5981 + read ,0.3055,31.5509,45.8538,2.7068 + write ,0.2512,31.3609,29.2636,2.6948 + stat ,1.8894,43.8477,49.6121,3.1908 + open/close ,3.2973,77.5123,68.9431,6.2575 + fork+sh ,1110.3000,7359.5000,4618.6667,439.4615 + fork+execve ,510.8182,2834.0000,2461.1667,139.7848 + +.. csv-table:: do_getpid bench (nsec) + :header: ,native,um,um-mmu(s),um-nommu(s) + + getpid , 161 , 34477 , 26242 , 2599 + +(um-nommu(s) is with seccomp syscall hook, um-mmu(s) is SECCOMP mode, +respectively) + +Limitations +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +generic nommu limitations +------------------------- +Since this port is a kernel of nommu architecture, the implementation +inherits the characteristics of other nommu kernels (riscv, arm, etc), +described below. + +- vfork(2) should be used instead of fork(2) +- ELF loader only loads PIE (position independent executable) binaries +- processes share the address space among others +- mmap(2) offers a subset of functionalities (e.g., unsupported + MAP_FIXED) + +Thus, we have limited options to userspace programs. We have tested +Alpine Linux with musl-libc, which has a support nommu kernel. + +supported architecture +---------------------- +The current implementation of nommu UML only works on x86_64 SUBARCH. +We have not tested with 32-bit environment. + + +Further readings about NOMMU UML +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + +- NOMMU UML (original code by Ricardo Koller) + - https://static.sched.com/hosted_files/ossna2020/ec/kollerr_linux_um_nom= mu.pdf +- introduction at FOSDEM 2026 + - https://fosdem.org/2026/schedule/event/HWLQDV-nommu-uml-thehajime/ diff --git a/MAINTAINERS b/MAINTAINERS index 0d044a58cbfe..00912c1a70c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -27195,6 +27195,7 @@ USER-MODE LINUX (UML) M: Richard Weinberger M: Anton Ivanov M: Johannes Berg +M: Hajime Tazaki L: linux-um@lists.infradead.org S: Maintained W: http://user-mode-linux.sourceforge.net --=20 2.43.0