]> git.codelabs.ch Git - muen.git/blob - README
060b73b2dc9841a0897f92d6a98f82ca89d01c62
[muen.git] / README
1 The Muen Separation Kernel
2 ==========================
3
4 Muen is an Open Source separation kernel (SK) for the Intel x86/64 architecture
5 that has been formally proven to contain no runtime errors at the source code
6 level. It is developed in Switzerland by https://www.codelabs.ch[codelabs
7 GmbH]. Muen was designed specifically to meet the challenging requirements of
8 high-assurance systems on the Intel x86/64 platform. To ensure Muen is suitable
9 for highly critical systems and advanced national security platforms, codelabs
10 closely cooperates with the high-security specialist secunet Security Networks
11 AG in Germany.
12
13 image::doc/images/example.svg[Example Architecture, width=70%, align="center"]
14
15 A separation kernel is a specialized microkernel that provides an execution
16 environment for components that exclusively communicate according to a given
17 security policy and are otherwise strictly isolated from each other.  The
18 covert channel problem, largely ignored by other platforms, is addressed
19 explicitly by these kernels. SKs are generally more static and smaller than
20 dynamic microkernels, which minimizes the possibility of kernel failure,
21 enables the application of formal verification techniques and the mitigation of
22 covert channels.
23
24 Muen uses Intel's hardware-assisted virtualization technology VT-x as core
25 mechanism to separate components. The kernel executes in VMX root mode, while
26 user components, so called 'subjects', run in VMX non-root mode. Hardware
27 passthrough is realized using Intel's VT-d DMA and interrupt remapping
28 technology. This enables the secure assignment of PCI devices to subjects.
29
30 NOTE: Muen is under active development and verification of kernel properties is
31       ongoing.
32
33
34 Features
35 --------
36
37 Kernel
38 ~~~~~~
39 The following list outlines the most-prominent features of the Muen kernel:
40
41 * Minimal SK for the Intel x86/64 architecture written in SPARK 2014
42 * Full availability of source code and documentation
43 * Proof of absence of runtime errors
44 * Multicore support
45 * Nested paging (EPT) and memory typing (PAT)
46 * Fixed cyclic scheduling using Intel VMX preemption timer
47 * Static assignment of resources according to system policy
48 * PCI device passthrough using Intel VT-d (DMAR and IR)
49 * PCI config space emulation
50 * Support for Message Signaled Interrupts (MSI)
51 * Minimal Zero-Footprint Run-Time (RTS)
52 * Event mechanism
53 * Shared memory channels for inter-subject communication
54 * Crash Audit
55 * Support for 64-bit native and 32/64-bit VM subjects
56   - Native 64-bit Ada subjects
57   - Native 64-bit SPARK 2014 subjects
58   - Linux 32/64-bit VMs
59   - SMP for Linux VMs
60   - MirageOS unikernels <<mirageos>>
61
62
63 Tau0
64 ~~~~
65 _Tau0_ (τ₀) is the Muen System Composer. In its current static mode of
66 operation, the task of Tau0 is to compose a system image while making sure that
67 certain invariants are not violated. The Tau0 concept is a mechanism to
68 gradually increase the flexibility of component-based systems running on top of
69 Muen, while keeping a high level of assurance regarding the correctness of
70 isolation enforcement.  Read more about Tau0 https://muen.sk/tau0.html[here].
71
72
73 Components
74 ~~~~~~~~~~
75 The Muen platform includes re-usable components which implement common services:
76
77 * AHCI (SATA) driver subject written in SPARK 2014
78 * Device Manager (DM) written in SPARK 2014
79 * Subject Monitor (SM) written in SPARK 2014
80 * Subject Loader (SL) written in SPARK 2014
81 * Subject Lifecycle Controller written in SPARK 2014
82 * Timeserver subject written in SPARK 2014
83 * Debugserver subject written in Ada 2012
84 * PS/2 driver subject written in Ada 2012
85 * Virtual Terminal (VT) subject written in Ada 2012
86
87 Furthermore the <<muenfs>>, <<muennet>> and <<muenblock>> Linux kernel modules
88 provide virtual filesystem, network interface and block I/O drivers based on
89 inter-subject memory channels.
90
91 Toolchain
92 ~~~~~~~~~
93 The Muen platform includes a versatile toolchain which facilitates the
94 specification and construction of component-based systems in different
95 application domains.
96
97 The <<mugenhwcfg>> tool for automated hardware description generation simplifies
98 the addition of support for new target machines. There is also a Debian
99 Live-based bootable image <<mugenhwcfg-live>> with persistence to simplify the
100 collection of hardware configurations from new targets.
101
102 Resources
103 ---------
104
105 Documentation
106 ~~~~~~~~~~~~~
107 The following detailed project documentation is available:
108
109 * Muen System Specification +
110   https://muen.sk/muen-system-spec.pdf
111
112 * Muen Kernel Specification +
113   https://muen.sk/muen-kernel-spec.pdf
114
115 * Muen Component Specification +
116   https://muen.sk/muen-component-spec.pdf
117
118 * Bootloader Signed Block Stream of Commands Specification +
119   https://muen.sk/bsbsc-spec.pdf
120
121 * Original Muen master thesis +
122   https://muen.sk/muen-report.pdf
123
124 * Muen project presentation +
125   https://muen.sk/muen-slides.pdf
126
127 * Presentation given at High Integrity Software Conference HIS 2014 +
128   http://www.slideshare.net/AdaCore/slides-his-2014secunethsr
129
130 * Technical articles on Muen +
131   https://muen.sk/articles.html
132
133 Mailing list
134 ~~~~~~~~~~~~
135 The muen-dev@googlegroups.com mailing list is used for project announcements and
136 discussions regarding the Muen separation kernel.
137
138 * To subscribe to the list, send a (blank) mail to
139   mailto:muen-dev+\subscribe@googlegroups.com[].
140   Note: A Google account is *not* required, any email address should work.
141 * To post a message to the list write an email to muen-dev@googlegroups.com.
142 * The list has a Google Groups web interface:
143   https://groups.google.com/group/muen-dev.
144
145
146 Download
147 --------
148 The Muen sources are available through the following git repository:
149
150   $ git clone --recursive https://git.codelabs.ch/git/muen.git
151
152 A browsable version of the repository is available here:
153
154 https://git.codelabs.ch/?p=muen.git
155
156 A ZIP archive of the current Muen sources can be downloaded here:
157
158 https://git.codelabs.ch/?p=muen.git;a=snapshot;h=HEAD;sf=zip
159
160 NOTE: The ZIP archive cannot be used to build the example system since it does
161       not contain all sub-projects.
162
163
164 Build
165 -----
166
167 Environment
168 ~~~~~~~~~~~
169 The Muen SK has been developed and successfully tested using the development
170 environment listed in the following table.
171
172 |===================================================================
173 | Operating systems      | Debian GNU/Linux 12 x86_64 +
174                            Ubuntu 22.04 x86_64
175 | Linux kernel/KVM       | >= 5.2.0 with GUEST_CR3 fix <<lnxcr3>>
176 | Ada compiler           | GNAT FSF 12.2
177 | GCC version            | gcc (GCC) 12.2
178 | SPARK version          | 12.1
179 | Emulator               | qemu-system-x86_64 (>= 3.1.0)
180 | Intel AMT SoL client   | amtterm (>= commit 0ece513...)
181 | Intel vPro AMT / WSMan | amtc (github.com/schnoddelbotz/amtc)
182 |===================================================================
183
184 The following hardware is used for the development of Muen. There is a good
185 chance similar hardware works out-of-the box if the microarchitecture is Ivy
186 Bridge or newer.
187
188 |===================================================================
189 | ASUS Prime Z690-P D4           | Alder Lake  | i5-125000
190 | iBASE MI995VF-X27              | Coffee Lake | Xeon E-2176M
191 | Lenovo ThinkPad T480s          | Kaby Lake   | i7-8650U
192 | HPE DL380 Gen10 Server         | Skylake     | Xeon Gold 6130
193 | Lenovo ThinkPad X260           | Skylake     | i7-6500U
194 | Intel NUC 6i7KYK               | Skylake     | i7-6770HQ
195 | UP^2^ maker board              | Apollo Lake | Atom E3950
196 | Intel NUC 6CAYH                | Apollo Lake | Celeron J3455
197 | Intel NUC 5i5MYHE              | Broadwell   | i5-5300U
198 | Cirrus7 Nimbus                 | Haswell     | i7-4765T
199 | Lenovo ThinkPad T440s          | Haswell     | i7-4600U
200 | Lenovo ThinkPad T430s          | Ivy Bridge  | i7-3520M
201 | Kontron Technology KTQM77/mITX | Ivy Bridge  | i7-3610QE
202 |===================================================================
203
204 The first step to build Muen is to install the required packages. See the
205 `tools/docker/Dockerfile.muen-dev-env` file in the project repository for the
206 current list of required packages.
207
208 Muen is built using a GNAT FSF toolchain provided via <<alire>>, see the
209 project's website about instructions on how to install the `alr` command-line
210 tool for your distribution. Then clone and build the Muen meta crate for alire,
211 which takes care of installing and configuring the toolchain:
212
213   $ git clone https://git.codelabs.ch/alire/muen-dev-env.git
214   $ cd muen-dev-env
215   $ make
216   $ source ./env
217
218 Docker
219 ~~~~~~
220 There is also a ready-made Docker image which contains all necessary tools for
221 Muen development. You can install it using the following command:
222
223   $ docker pull ghcr.io/codelabs-ch/muen-dev-env
224
225 Compilation
226 ~~~~~~~~~~~
227 To build the Muen tools, RTS, kernel and example components change to the Muen
228 source directory and issue the following command:
229
230   $ make
231
232 This will create a bootable ISO image containing the example system. See below
233 for deployment instructions.
234
235 The following command gives a short description of the top-level Makefile
236 targets:
237
238   $ make help
239
240
241 Deploy
242 ------
243 The build system provides two ways to instantly deploy and test the created
244 system image.
245
246 Emulation
247 ~~~~~~~~~
248 To ease kernel development and testing, the Muen project makes use of nested
249 virtualization provided by QEMU/KVM. In order for this to work, a Linux
250 kernel (>= 5.2.0) with applied KVM GUEST_CR3 fix <<lnxcr3>> and the
251 `qemu-system-x86_64` binary must be installed on the build machine.
252
253 Issue the following command in the Muen project directory to start the nested
254 virtualization of a Muen system:
255
256   $ make emulate
257
258 The system serial output is written to `emulate/serial.out`. Follow the
259 on-screen instructions on how to connect to the QEMU curses console or how to
260 SSH into the NIC Linux guest VM.
261
262 NOTE: As the virtual terminal (VT) over curses is timing sensitive and QEMU/KVM
263 cannot guarantee tick-exact timing depending on the host CPU and system load,
264 this console is just an emergency console. Use SSH to interact with the booted
265 Muen system.
266
267 Hardware
268 ~~~~~~~~
269 The top-level Makefile provides two convenient targets to deploy Muen to real
270 hardware: `iso` and `deploy`. The first creates a bootable ISO image which can
271 be burned on a CD-ROM or dumped on a USB stick, the second uses network boot to
272 shorten round-trips during development.
273
274 USB Stick
275 ^^^^^^^^^
276 To create a bootable USB stick containing the Muen system, enter the following
277 commands in the top-level directory:
278
279   $ make HARDWARE=hardware/lenovo-t440s.xml SYSTEM=xml/demo_system_vtd.xml iso
280
281 Then follow the instructions on the screen.
282
283 Network Boot
284 ^^^^^^^^^^^^
285 For fast deployment of the Muen system image to real hardware, the iPXE
286 <<ipxe>> boot firmware installed on a USB stick in conjunction with Intel Active
287 Management Technology (AMT) is used. Please refer to the amtterm <<amt>>
288 documentation on how to configure AMT on the target hardware.
289
290 To build and install iPXE with the Muen specific boot script issue the
291 following commands:
292
293   $ sudo apt-get install liblzma-dev
294   $ git clone git://git.ipxe.org/ipxe.git
295   $ wget https://muen.sk/muen.ipxe
296   $ cd ipxe/src
297   $ make bin/ipxe.usb EMBED=../../muen.ipxe
298   $ sudo dd if=bin/ipxe.usb of=/dev/sdX
299
300 The `/dev/sdX` device is the USB stick (e.g. `/dev/sdc`, without partition
301 number). *All existing data will be erased*.
302
303 When booting from the created stick the first NIC (net0) is configured as follows:
304
305   IP Address : 192.168.254.2
306   Netmask    : 255.255.255.0
307   Gateway    : 192.168.254.1
308
309 After initialization of the network adapter iPXE tries to download and
310 chainload the iPXE configuration from the following URL:
311
312   http://192.168.254.1:8000/boot.cfg
313
314 The development machine must be connected to the target hardware via an
315 interface with IP address 192.168.254.1. To actually serve the created system
316 image to the bootloader, issue the following command in the top-level Muen
317 directory:
318
319   $ export AMT_PASSWORD=<your AMT password>
320   $ make deploy
321
322 To view the output of the Muen kernel debug console use the command:
323
324   $ amtterm 192.168.254.2
325
326 If your hardware differs from the default configuration, additionally specify
327 the `HARDWARE` variable:
328
329   $ make deploy HARDWARE=hardware/intel-nuc-dc53427hye.xml
330
331 References
332 ----------
333 - [[[lnxcr3]]]          Linux KVM GUEST_CR3 fix, https://patchwork.kernel.org/patch/11165185/
334 - [[[alire]]]           ALIRE: Ada LIbrary REpository, https://alire.ada.dev/
335 - [[[ipxe]]]            iPXE boot firmware, https://ipxe.org/
336 - [[[amt]]]             Intel AMT SoL client + tools, https://www.kraxel.org/cgit/amtterm/
337 - [[[mirageos]]]        MirageOS, https://mirage.io
338 - [[[muenblock]]]       Muenblock Linux kernel module, https://git.codelabs.ch/?p=muen/linux/muenblock.git
339 - [[[muenfs]]]          Muenfs Linux kernel module, https://git.codelabs.ch/?p=muen/linux/muenfs.git
340 - [[[muennet]]]         Muennet Linux kernel module, https://git.codelabs.ch/?p=muen/linux/muennet.git
341 - [[[mugenhwcfg]]]      Muen hardware config generator, https://git.codelabs.ch/?p=muen/mugenhwcfg.git
342 - [[[mugenhwcfg-live]]] Mugenhwcfg Live, https://github.com/codelabs-ch/mugenhwcfg-live/releases
343
344
345 License
346 -------
347 --------------------------------------------------------------------------------
348 Copyright (C) 2013-2024  Reto Buerki <reet@codelabs.ch>
349 Copyright (C) 2013-2024  Adrian-Ken Rueegsegger <ken@codelabs.ch>
350
351 This program is free software: you can redistribute it and/or modify it under
352 the terms of the GNU General Public License as published by the Free Software
353 Foundation, either version 3 of the License, or (at your option) any later
354 version.
355 --------------------------------------------------------------------------------