* kwemu: publish shared code invalidation after stores complete Close the interval between writeHost notifying about an x86 code page and the caller changing its bytes. Another CPU can consume that early epoch, revalidate the old instructions and otherwise keep running the stale decode after the writer has finished its store. Keep a pending completion bit in the private SMC state and publish the shared code epoch again at the instruction boundary. Route reference, decoded and generic JIT exits through finishSmc in both front ends, including fault paths and raw-pointer atomic updates. Preserve pending completion when an instruction also requests local invalidation. The public ABI and the reference instruction semantics are unchanged. Add a deterministic two-CPU regression that lets the reader consume the early notification before the writer performs an aligned atomic store. It fails with the previous clear-only behavior and passes in native, Wasm JIT and no-SIMD configurations with completion publication. Validate the integrated tree on the physical x86-64 host with both normal and atomics builds: 196 x86 guest comparisons per build, 50 x86 Wasm unit tests per SIMD configuration, 77 AArch64 oracle comparisons per build, and 138 AArch64 Wasm unit tests with one expected skip per configuration. The rebuilt kernel matrix passes 76 of 79 cases, including code-write coherence and atomic checks; three SMP scheduling-placement assertions remain unresolved and are not claimed as passing. * x64: check compatibility code limits before compiled indirect branches Validate the masked i386 target against the current CS limit before a compiled indirect jump, call or return can change architectural state. The previous JIT check returned immediately in compatibility mode even though the reference and decoded executors reject an out-of-limit target. Hand the instruction back on a limit violation so the existing executor constructs the precise fault, including call and return stack ordering. Keep valid targets compiled and load the descriptor limit at execution time rather than embedding mutable segment state in a module. Add reference comparisons for register and memory indirect jumps and calls and for returns with a target beyond CS.limit. Validate with the full x86 test suite in normal and atomics builds, including eager Wasm JIT with SIMD enabled and disabled, and the 196 physical-CPU guest comparisons per build. * x64: compile rotations, memory ALU operands and indirect branches Move 32/64-bit register ROL/ROR, memory-source register ALU operations and memory-indirect CALL/JMP out of the generic instruction path. Reuse the decoded operand representation, shared ALU emitter, normal data TLB checks and precise fault handback. Preserve carry and overflow rules, zero-count writes, prior flags on load faults, source-register aliases and call target validation before any stack change. Add differential coverage for rotation counts and flags, memory ALU operations, fault ordering and indirect branch source/stack aliases. Keep the reference executor and all existing guest tests. Add a unit-only x86 build step while retaining those units in the full test-x64 step. Expose x86 generic encoding families and decoded operation counts only in statistics builds, account for compiled retirements and handbacks, and preserve Wasm function names for CPU profiles. Add interleaved, physical-output-checked CPU and same-kernel Box64 benchmark drivers, verified disposable runtime/input preparation, and a measurement report. Retain invalid outputs and timeouts rather than counting them as wins. Five rotated CPU-harness rounds on the physical x86-64 host reduce x64 SHA JIT median time from 561.34 to 31.69 ms and the interpreter workload from 665.49 to 253.73 ms. i386 also improves on those workloads. Record the short fib and i386 FP slowdowns explicitly. CoreMark profiling still finds substantial byte/word ALU and memory-immediate generic execution; scalar FP also remains expensive. The full application comparison is still running and the target of beating Box64 everywhere is not met. Validate normal and atomics x86 suites, AArch64 regression suites, physical VEX and XED dispatch audits, four shadow-stack configurations, kernel patch/bundle checks, amd64 Alpine SSH/Python and the constrained API matrix. Preserve the documented SMP scheduler-placement failures, default-concurrency API timing failures, incomplete application results and physical AArch64/browser verification limits. * x64: validate canonical addresses on shared data TLB hits Keep a translation cached by an AArch64 task from bypassing x86 address validation. The ISA-neutral MMU accepts the low 48-bit address space, including addresses with bit 47 set that are noncanonical in x86 mode. A compiled x86 access previously trusted a warm data TLB entry for such an address and could load, store or branch instead of raising GP or SS. Add an optional ISA hook to the shared JIT TLB check. The x86 hook sends addresses above the low canonical half back to the existing executor, which preserves segment selection, exception priority and precise state. Canonical negative addresses retain the MMU's page-fault behavior through the same handback. AArch64 emits no additional check and the shared MMU address space and public ABI remain unchanged. Add warm-TLB reference comparisons for scalar and vector loads/stores, memory ALU, indirect calls/jumps, push/pop and return, including stack segment addressing. Disabling the hook makes the regression fail in both SIMD and no-SIMD Wasm JIT runs; enabling it passes the integrated 53-test suites in both configurations, including existing fault-priority, segment, debug-state and randomized instruction regressions. * x64: compile byte and word register arithmetic with precise lazy flags Extend the existing ALU and TEST decoded operations to 8/16-bit register, accumulator and immediate forms, including sign-extended group immediates. Preserve unrelated register bits and distinguish AH..BH from the REX byte registers in operand reads, writeback and register-use accounting. Track lazy add, subtract and logic flags at the operand's actual width. Keep parity and auxiliary carry unshifted, derive signed conditions with the correct sign extension, and preserve carry through ADC/SBB chains. Retain the same reference instruction executor and precise stop behavior. Add differential matrices over edge values, operand directions, partial register aliases, immediate encodings and all condition codes. Assert that the tested encodings actually decode into the new execution paths. Keep the existing randomized regressions, which also caught a signed-condition emission error during implementation. Five interleaved rounds against the preceding optimized executor reduce CoreMark 3000 from 7413.53 to 3409.09 ms and i386 SHA from 166.71 to 140.69 ms. This comparison also includes the shared-TLB address correction. Record the x64 memory and longer x64/i386 fib regressions explicitly; address-check and generated-code costs still need investigation, and the Box64 acceptance target remains unmet. Validate full normal and atomics x86 builds with 196 physical guest comparisons each and 53 Wasm JIT units in both SIMD configurations. Re-run both AArch64 builds: 77 oracle comparisons each, 138 passing JIT units with one expected skip per configuration, plus native/fuzz checks. Final rebuilt-kernel and corrected application comparisons remain pending. * test: validate benchmark chroots before comparing Box64 Bind the guest proc, sys and device filesystems into each disposable application root. Check process maps, CPU topology, /dev/null and lscpu before timing. Missing mounts previously prevented Box64 CPU discovery; reject that preliminary application's timings and failures explicitly. Retain guest signals and execution errors alongside exit status and output hashes, and record host JIT counters for every sample. Reject a sample with a signal, execution error or failed JIT compilation. Verify OCI configuration size as well as its digest before accepting an image. Validate CPU discovery in both roots across three boots. Python startup runs correctly under the native front end and both Box64 releases. Node startup runs natively; all four Box64 configurations still abort after calling a null target, with guest SIGABRT retained in the diagnostic report and zero host JIT failures. These failures are compatibility results and cannot be counted as performance wins. Recheck the pinned Python image configuration and the benchmark driver's syntax. * x64: compile scalar SSE arithmetic with exact MXCSR guards Add decoded scalar SSE and AVX register moves and arithmetic, legacy memory arithmetic, and scalar loads and stores. Preserve lane merges, upper YMM zeroing, fault priority and unmasked exceptions through the existing reference executor and exact floating-point helpers. Adapt the initial scalar design and edge-value guest from Gabriel Pérez's upstream PR #113, retaining its copyright notices: https://github.com/pithings/unkernel/pull/113 Compile arithmetic only under default controls, non-denormal inputs and safe result ranges. When PE is clear, prove exactness using TwoSum, significand predicates or exact binary64 products before writing back. Do not manufacture sticky flags or change the reference executor. Cache unchanged MXCSR controls within each member, invalidate after unknown helpers, and keep the cache separate from SIMD scratch locals. Keep vector execution out of the central decoded dispatch frame. V8 profiles exposed larger frames and integer throughput regressions when scalar/vector temporaries were inlined there. Centralize precise generic execution so unmasked scalar operations retain the same stop handling. Add optional FP operation/MXCSR counters without changing the public ABI. Add 393,216 randomized single-operation result and MXCSR comparisons per guest mode, retaining the edge, rounding and merge matrices. Extend JIT differentials for exceptional controls, precise memory faults, warmed noncanonical translations and LDMXCSR helper invalidation. Removing that invalidation makes its regression fail; restoring it passes. Five interleaved rounds reduce x64 FP from 214.47 to 20.09 ms with the JIT and from 237.24 to 43.41 ms decoded before control caching. The cache reduces a longer FP JIT run from 84.26 to 82.09 ms. Record integer JIT and i386 FP timing regressions rather than claiming every path improves; portable i386 FP still uses x87. The Box64 acceptance target remains unmet. Validate both normal and atomics builds: 210 x86 physical comparisons and 56 JIT units per SIMD configuration; 77 AArch64 oracle comparisons and 138 JIT units with one expected skip per configuration. Regenerate 62,914,560 XED probes and recheck 194,147 representatives and 50,688 VEX combinations with zero classification errors. The rebuilt kernel passes 77/79 cases, with two unresolved wakeup-placement assertions retained. Remaining integration reruns and corrected full application measurements are explicitly outstanding in the performance report. * test: retain host JIT failures in application benchmark reports Record host warnings, per-sample starting JIT counters and the existing ending counters. Keep the strict zero-failure boot requirement, output checks and signal handling unchanged. Capture the starting statistics outside the timed interval so diagnosis adds no measured setup work. Add an optional Node diagnostic preload that retains failed synchronous Wasm modules and their original errors. Use a constructor proxy to keep module prototypes and instanceof checks compatible with async compilation, and preserve exact input-view bounds and the original thrown error. Keep its artifacts separate from accepted performance measurements. Retain the interrupted application run where Box64 sort produced correct output but the host JIT failure count increased. Do not count that run as accepted performance evidence. Six diagnostic boots produce 240 correct samples without reproducing the failure; CPU validation ran concurrently, so their timings are excluded and the rare failure remains unresolved. Update the report with the complete rotated scalar CPU measurements and completed API, Alpine, patch and stack checks. Preserve both the earlier timing regressions and the later observations, the kernel's two failed wakeup-placement assertions, and the SMP JIT stack audit's early stop. Check benchmark syntax remotely. Verify failure capture with an invalid Wasm view, exact saved bytes and the original CompileError, and verify successful synchronous and asynchronous module construction and imports. * x64: compile memory arithmetic with precise write fault reporting Add unlocked memory-destination ALU and TEST operations at every integer width, with register and immediate sources. Extend memory-source register arithmetic to bytes and words, including high-byte and REX aliases. Keep one 16-byte operation per instruction by packing raw displacement and immediate fields and reconstructing relative addresses when needed. Reuse the existing ALU flag emitter with a temporary value destination. Complete read and write checks before updating architectural state, retain read-only CMP/TEST behavior, and keep operands outside segment-check scratch locals. Preserve the MMU, canonical checks, partial registers, completed code-store publication and existing locked execution paths. Correct an existing reference fault-classification error exposed by the new tests. A read phase of ALU read-modify-write must report a write page fault. Retain its original address, validation order, register state and retirement behavior while correcting the access metadata in the reference and decoded executors, including split-page locked ALU fallback reads. The physical CPU reports error code 6 where the old kernel reported 4. Add differential matrices for every width, carry, partial alias, immediate form, relative address and memory fault, and regressions for current-block code writes and cached targets. Extend physical integer and kernel fault guests without removing existing cases. Keep raw coincident PF/AC results on stderr and check architecture-defined invariants across processors; separate tier/JIT tests require the reference's exact exception choice. The new write-access assertion fails before the fault correction in both SIMD configurations. Afterward both normal and atomics builds pass 210 physical comparisons and 61 JIT units per SIMD configuration. Both A64 builds pass 77 guest comparisons and 138 JIT units with one expected skip per configuration. Rebuilt kernels pass all 79 matrix cases, stronger physical fault comparisons, and all four complete shadow-stack audits. Retain the preceding matrices' intermittent placement failures in the report; this passing run does not establish their cause. A CoreMark statistics/profile run reduces generic executions from 36,095,145 to 9,466,328, with 6,131,951 remaining byte SHR operations. Keep those counts separate from timings: application diagnostics ran concurrently, so an isolated speed comparison remains outstanding and the Box64 acceptance target is not yet met. * kwemu: retain ISA identity when joining and rebuilding JIT regions Tag each region with its front end in unused page metadata bits. Require that identity when joining a page region or growing along compiled exits. A64 and x86 tasks can share a virtual code page, and their blocks can occupy any cache set at different PCs even though same-PC keys differ. Reject a reused guest block slot belonging to the other front end before reading its decoded ops. An evicted guest's copy can remain in a region whose live home members still keep it installed. A later rebuild must not interpret the replacement's fields through the original ISA's op layout. Keep cache sizes, the public ABI and execution-time op checks unchanged. Add shared-core differentials for both ISA orders on one page and for an A64 region guest replaced by x86 code before rebuilding. The first fails without region tagging. Keeping tags but removing the reused-slot check makes the second fail in both SIMD configurations with a mixed region. Restoring both passes 140 A64 Wasm units and one expected skip per SIMD configuration, including atomics, with no host failures or module leaks. Expose the existing A64 unit checks as a separate build step without removing any checks from the full test target. A 660-sample application diagnostic captures eight malformed-module host warnings across five of six boots, including impossible local counts and integer instructions reading SIMD locals. Document the incompatible A64 maddl and x86 vec_op handler layouts behind these failures. Retain the failed modules and exclude every diagnostic timing from acceptance. Both normal and atomics builds pass 77 A64 oracle comparisons and 210 x86 physical comparisons each. Rebuilt UP and SMP kernels pass all 79 matrix cases. Regenerated XED representatives and physical VEX encodings have zero classification mismatches. A fresh application comparison remains outstanding; this correction does not establish the Box64 speed target. * kernel: retain function names while stripping DWARF during lowering Discard DWARF before Binaryen lowers memory64 and table64, while keeping the name section for traps and CPU profiles. The statistics library from Zig 0.16 contains DW_LNE_define_file line programs that Binaryen 133 cannot parse when preserving DWARF. Keep the original memory64 kernel and its debugging information unchanged. The statistics kernel reproduces the parser failure before this change and builds and bundles successfully afterward. Compare the normal UP and SMP lowered kernels with the new option: both remain byte-identical. Check the build script's shell syntax and document which debugging information each output retains. * test: capture per-process CPU profiles and reject diagnostic timings Allow an application specification to select a CPU-profile directory. Start and stop Node's inspector around each guest execution, retain the profile path and copy available kwemu counters before and after it. Keep the existing output, signal, panic and cumulative JIT checks intact. Mark profiled reports and reports with observed kwemu instrumentation as ineligible for timing comparisons. Print DIAGNOSTIC instead of medians while preserving raw execution data and correctness results. Disconnect the inspector and retain the report on failure as well as completion. Document profiling separately from acceptance measurements. Check syntax and exercise three boots with first and later executions: six profiled samples retain readable CPU profiles and valid output while rejecting timing acceptance; six unprofiled control samples remain eligible. A statistics kernel without an inspector also rejects all six timings and retains its counters. Verify that counters become available only after the first JIT compile in each boot, as the SDK specifies. A separate Python mixed-workload diagnostic passes all six samples with zero host JIT failures. Its first execution exposes 403,535,341 generic operations among 6,954,958,351 retired instructions, with major families in byte/word MOV, memory-immediate stores, SIMD unpack and MOVQ. Preserve those profiles and counts for the next investigation; their timings are not performance acceptance results. * x64: compile byte and word register shifts with precise flags Extend SHL/SAL, SHR, SAR, ROL and ROR register decoding and compilation to bytes and words, with immediate, count-one and CL forms. Preserve partial registers, legacy high bytes, REX aliases, zero masked counts and nonzero counts whose effective rotation is a full width. Latch CL before writing an aliased destination and retain the reference's undefined-flag choices. Defer SZAP for constant narrow shifts while retaining exact CF and OF. Keep variable counts and rotates precise, including carry consumers and all branch conditions. Keep the original specialized wide rotations in the central decoded dispatcher and move narrow alias and oversized-count handling to a separate helper, avoiding a general modulo operation in the existing 32/64-bit paths. Add strict differential matrices across widths, aliases, edge counts, all conditions and ADC/SBB chains after lazy flag producers. Extend the physical integer guest with every CL count for low and high bytes while retaining its previous cases and architecture-defined flag masks. Five interleaved rounds reduce CoreMark from 1851.27 to 1572.50 ms after memory arithmetic. Profiles and identical instruction/cache counts expose a decoded SHA regression when every width shares the generalized path; separating the helper recovers most of it. Record the complete broad comparison and remaining smaller regressions rather than claiming all workloads improve. The Box64 acceptance target remains unmet. Normal and atomics x86 builds pass 210 physical comparisons and 63 JIT units per SIMD configuration; A64 builds pass 77 oracle comparisons and 140 JIT units with one expected skip per configuration. The kernel matrix is 76/79: two wakeup-placement assertions and one unobserved-preemption assertion fail without an incorrect value or register-content report. An isolated serial control passes 15/15 on the original kernel and 13/15 on the modified one, with two SMP2 wakeup-placement failures. Retain this unresolved difference and the original test requirements for continued investigation before final correctness acceptance. * x64: compile narrow MOV and memory-immediate stores Extend general register moves, immediate register moves and scalar loads and stores to byte and word operands. Preserve high-byte and REX aliases, partial-register writes and qword immediate sign extension. Keep existing wide move emission unchanged where its operands already fit that path. Add a memory-immediate store operation without enlarging decoded slots. Pack raw displacement and immediate fields, share relative-address reconstruction with immediate memory arithmetic, and retain the MMU, canonical, segment, alignment and code-store completion checks. Preserve flags and retirement on every fault, and leave the reference executor unchanged, including unsupported address forms and segment overrides. Add complete register-alias and immediate matrices, directed memory checks, relative/indexed/segmented addresses, cold and warm fault cases after a lazy flag producer, and current-block and cached-target code writes. Extend invalid-LOCK checks and the physical integer guest's MOV matrices while retaining all previous tests and flag masks. Normal and atomics builds each pass 210 physical comparisons and 69 JIT units per SIMD configuration with zero host JIT failures. A six-sample Python mixed-workload diagnostic remains correct and reduces the representative generic count from 403,535,341 to 206,826,747. Preserve its profiles and the still-unclassified overflow counts; instrumented timings are ineligible for acceptance. Isolated broad timing and final combined kernel validation remain outstanding, and the Box64 target is not met. * kernel: retain synchronous wakeup placement through movable returns Carry WF_SYNC with a held task's placement hint. At its movable user return, accept a target that is idle or still runs only the synchronous waker, matching wake_affine_idle's expectation that the waker will sleep. Recheck active CPUs and affinity, retain the source-work requirement, and keep ordinary hints restricted to idle targets. Clear the synchronous state when consuming a hint, cloning or requesting mandatory movement. Export the autosquashed scheduler and wasm architecture patches. Add eight handshakes that keep the waker runnable through the reader's return from read and getcpu. Require every reader to leave the busy CPU with intact messages and require an actual hinted move. Identical guests fail all three old-kernel controls with zero hints followed; the fix passes three boots each for A64/x86 on two/four CPUs, with 96/96 hinted handoffs and every original SMP assertion intact. Exclude the retry-only experiment that still failed the original A64 placement checks. Strengthen the A64 state-preemption fixture after a diagnostic reproduces two failures in 30 runs: the second child can finish its fixed spin after the first competitor exits without itself being preempted. Preserve all state comparisons and the original six million iterations per child. Keep both competitors runnable until each records an involuntary switch while its state is live, and fail after ten seconds. Thirty JIT and three no-JIT executions pass; withholding acknowledgment fails at the bound, and injected V0 corruption fails the state comparison. The combined CPU and kernel candidate passes the complete 79-case kernel matrix, including all repeated SMP placement checks. Record the controls, rejected design and verification limits. This resolves the scheduling validation failures; full application performance acceptance, remaining ISA verification and the Box64 target are still outstanding. * x64: compile SIMD interleaves and scalar vector transfers Compile the complete low/high register unpack family for byte, word, dword and qword elements in legacy SSE2, VEX.128 and AVX2.256 forms. Apply the shuffle independently to each 128-bit lane, preserve aliased sources and legacy upper lanes, and clear VEX.128 upper lanes. Keep memory unpack operands on the existing reference path. Compile register MOVQ and route scalar MOVD/MOVQ memory operands through the existing four/eight-byte vector memory paths. Preserve exact access widths, compatibility-mode VEX.W behavior, MXCSR, flags, exception state, retirement and completed code-store publication. Leave the reference executor and the shared CPU layout unchanged. Add differential matrices for aliases, extended registers, randomized lane canaries, both guest modes, all unpack widths and VEX.W forms. Cover feature and reserved-field faults before operand access, cold/warm memory faults after a lazy ADD, and stores into current/cached code. Append twelve qword-unpack physical forms without renumbering existing forms; retain every previous case and flag mask. Normalize diagnostic encoding keys to combine operand register numbers while retaining opcode-extension selectors and register/memory forms. Keep the statistics layout and overflow accounting unchanged. Six valid Python mixed-workload samples have no host warnings or JIT failures; a representative generic count falls from 206,826,747 to 58,263,020. Only 324 executions remain unclassified after normalization. Preserve these as exact diagnostic counts; concurrent correctness fuzzing makes their timings ineligible for performance claims. Normal and atomics builds pass 210 physical comparisons and 75 JIT units per host SIMD configuration, including the additional code-store unit. The combined kernel matrix passes 79/79. A fresh 62,914,560-pattern XED sweep retains 194,147 representatives with no decode, length or illegal classification errors and 86 explicit unprobed templates; all 50,688 VEX oracle combinations match. Extended A64 fuzzing and isolated timing remain in progress. The Box64 performance target is not yet met. * x64: check PALIGNR features before accessing operands Require SSSE3 for legacy XMM PALIGNR and AVX2 for its VEX.256 form in the reference executor. Match Intel's CPUID feature assignments and the retained independent XED templates. Reject unavailable instructions before register mutation, memory access or retirement, including large immediates that would otherwise produce zero. Add fourteen feature-disabled differential cases across both guest modes, register and unmapped-memory operands, and immediate boundaries, with packed-shuffle feature controls. Preserve every existing audit case. The original code reaches INT3 with SSSE3 disabled; adding only that guard then exposes the same failure with AVX2 disabled. Both guards pass the native differential with exact state and retirement checks. Retain these actual red/green controls and distinguish an earlier invalid test fixture that omitted its start PC. Full combined-path validation remains pending. * test: reject statistics-instrumented CPU harness timings Detect the harness's kwemu statistics output and mark the whole timing report ineligible. Print DIAGNOSTIC instead of a median when counters are present, while retaining the raw times, output checks and instrumentation metadata. Track per-sample eligibility for both counters and the additional inspector round; keep uninstrumented measured rounds eligible. Check syntax and execute four normal and four statistics-enabled smoke samples, all with valid physical output and no host JIT failures. The normal report remains eligible and the statistics report rejects its timings. Four correct instrumented CoreMark samples also reject timing acceptance while retaining their operation counts. These runs overlap correctness tests and provide no performance comparison. * x64: compile word shuffles and track AVX state across calls Compile register PSHUFLW, PSHUFHW and PALIGNR for legacy, VEX.128 and VEX.256 encodings. Preserve independent 128-bit lanes, source aliases, ignored W bits, legacy upper lanes, VEX clearing, flags and MXCSR. Emit constant byte-shuffle masks, a zero source for byte offsets 16 through 31, and zero for every larger unsigned immediate. Keep memory operands on the reference path and retain the previous PSHUFD implementation. Qualify cached SIMD VEX specializations by XCR0 XMM/YMM availability. A warm decoded block otherwise reaches INT3 after two retired instructions when the reference raises UD before retirement. Track availability at the user execution-window boundary and release cached specializations when it changes. Mask AVX only for specialization, preserving hardware CPUID and compiled integer BMI VEX instructions. XSETBV is privileged, so the state is stable inside the window. Consume a private reserved byte and assert the existing offsets and size without changing the public CPU ABI. Add the complete immediate, alias, width, mode and W cross-product with randomized full-state canaries and cold/warm runs. Warm and toggle XCR0 across thirteen vector register/load/store families, including unavailable memory operands, exact exception metadata and retirement. Check that CPUID, ANDN, RORX and SHLX remain correct and compiled with AVX state off. The original code and separate copies omitting either invalidation or the specialization mask all fail the directed control; the correction passes. Append word-shuffle controls and missing alignment boundaries without renumbering existing physical audit forms. Both modes now cover 3,175 forms and 76,200 operand cases. Normal and atomics x86 builds each pass 210 physical comparisons and 79 JIT units per host SIMD configuration. A64 builds each pass 77 oracle comparisons and 140 JIT units with one expected skip per configuration. The combined kernel matrix passes 79/79 and all four UP/SMP stack guards pass; API and userland checks continue. Six valid statistics-only Python mixed-workload samples reduce the representative generic count from 58,263,020 to 11,915,168, with zero host warnings or JIT failures. Retain unclassified counts and exclude instrumented timings. Record the isolated five-round CPU comparison: integer MOV reduces i386 memory/sha costs, while interleave/MOVQ takes CoreMark from 1576.35 to 1381.77 ms; word shuffle/align is 1382.69 ms. Keep the broad regressions as well. Those installations predate the XCR0 tracking guard; its timing and full application acceptance remain pending. The fastest-valid Box64 target is not yet met. * test: record controlled application and AVX-state comparisons Record all 330 application samples from three boots without statistics, profiling or concurrent validation, pinned to the physical host's eight performance cores. Select the lowest median among valid Box64 0.3.4 and 0.4.3 default/callret settings separately for first and later execution. All 66 native samples pass; every boot has zero host warnings and JIT failures. Retain twelve incorrect 0.3.4 Python mix results and seventy-two incompatible Node 24 results instead of treating failures as speed wins. Native execution leads SHA, sort, Python loop and process startup, but CoreMark still loses to 0.3.4 callret, gzip is near parity and later Python mix slightly loses to 0.4.3 callret. Explicitly retain these unmet targets and the limitation that the maintainer's original input recipes are not available. The original-kernel comparison remains in progress. Record the separate five-round availability-guard comparison, including small regressions and CoreMark's 1385.60 to 1389.78 ms change. Update the normal/atomics x86 and A64 evidence, 20,000-seed fuzz and independent native fuzz executions, 79-case kernel matrix, all four stack guards, five kernel patch checks, 156 passing API tests with three optional skips, and all four disposable Alpine SSH/Python configurations. No performance target is claimed complete and no existing verification is removed or relaxed. * x64: cache crossing decodes after checking current executable bytes Keep a full decoded instruction in private nursery slots after each cross-page wrapper's op and first-page raw fragment. Reuse it only after checking every instruction byte through current executable mappings. Check the first fragment before translating the second page so shorter and illegal replacements preserve fetch-fault priority. Retain fresh CPU reader decoding on misses and call the unchanged reference instruction semantics with live task state. Keep the reference executor fresh, the one-page block invariant, one active op per guest instruction, shared cache capacity, public CPU size and ABI. Count crossing dispatch attempts separately from budget tails in statistics builds and retain mode/PC keys in the existing bounded dictionary. Four correct diagnostic CoreMark samples identify 4,704,003 crossing dispatches, mostly CMP and MOV, among 4,709,927 single steps. Reject diagnostic timings and retain overflow rather than attributing those steps to unsupported ISA families without measurement. Add nine differential groups covering every split of representative integer, memory, SIMD, x87, branch and trap forms; cold/hit reuse, precise faults and retirement, live MXCSR and XM, both fragments' code stores, permission changes, remapping, shared-first-page address spaces, prefix priority, compat PC wrapping, partial REP, SS shadow and TF, following-code publication and nursery churn. A separate control omitting the second-page byte comparisons returns stale EAX and fails the directed test. Correct an initial REPNE fixture's equal input to exercise the intended partial fault without removing its assertions, and retain that failure separately. Pass 210 physical comparisons per normal/atomics x86 build and 88 JIT units per SIMD setting without compile failures or leaks. Pass both 20,000-seed A64 configurations, 77 oracle comparisons each and 140 JIT units with one expected skip per setting; independently verify the identical native test image reports 197 passed, eight skips and zero failures. Pass the 79-case kernel matrix, four complete stack guards, five kernel patch checks, 156 API tests with three optional skips and four Alpine SSH/Python regressions. Record five-round isolated CPU timing and three-boot application results. CoreMark harness JIT changes from 1381.16 to 1291.20 ms; all 132 application samples pass with zero warnings or JIT failures. Retain the Python loop, startup and i386 FP regressions instead of claiming uniform improvement. Layout-controlled counter diagnostics explain variation in page walks but not every timing difference. Keep the original default-ASLR results and record the large driver expansion during Binaryen lowering for independent build-policy investigation. The fastest-valid Box64 target remains unmet. Also retain the separate 132-sample comparison to the original audited kernel, including startup improvements and all reconstructed workloads. All accepted measurements are statistics-free and isolated from validation; long correctness jobs resume after the recorded measurement interval. * x64: compile packed widening multiplies and reject invalid VEX prefixes Specialize register PMULUDQ and PMADDWD in the decoded and Wasm SIMD executors for legacy XMM, VEX.128 and AVX2 VEX.256 forms. Select unsigned even-dword widening products or wrapping signed-word pair sums through one vector kind's auxiliary field. Preserve aliases, independent YMM halves, legacy upper lanes, VEX clearing, flags and MXCSR. Keep MMX and memory operands on the reference path, retain the 16-byte op and assert that all vector selectors fit their six-bit encoding. Add full-state differentials for both modes, widths, aliases, ignored W bits, edge-value cross-products, cold/warm execution, unavailable features and precise memory faults. Extend warm XCR0 availability checks to both families. Retain a scalar FP loop fault regression: the suspected deferred flag defect does not reproduce because the existing unmasked MXCSR guard hands back before arithmetic, so leave the FP implementation unchanged. Correct the shared encoding validator after a new test exposes invalid packed-multiply VEX prefixes executing or reading memory before UD. The physical CPU confirms 1,536 unmapped-operand combinations must raise UD. Append eight oracle forms without renumbering existing ones: 54,784 combinations across 107 forms, including 45,864 UD results, with no dispatcher mismatches. The unchanged-check control fails both the new directed differential and native-mask test. Keep reference decoding fresh and its arithmetic semantics intact. All 194,147 XED representatives retain zero decode, length or unclassified-UD mismatches. Pass 210 physical comparisons per normal/atomics x86 build and 92 Wasm JIT units per SIMD setting, without compilation failures or module leaks. Pass both AArch64 configurations with 77 oracle comparisons, 140 Wasm units and one expected skip per setting, and 300-seed fuzz; independently verify the shared native image reports 197 passed, eight skips and zero failures. Pass the 79-case kernel matrix and four complete stack guards. The full API suite passes 156 tests with three optional skips at its documented concurrency of four. Retain the initial host-sized-concurrency failures and missing-image skips instead of removing assertions. Final extended fuzz and the common-kernel Box64 acceptance remain outstanding. Record eighteen correct statistics-only application samples with zero warnings or JIT failures. CoreMark generic execution drops from the prior 648,312 to 1,011-1,126 operations. Reject those timings because statistics and concurrent validation are enabled; isolated speed measurements remain pending. Also record the 120-sample Binaryen inline-limit control: smaller drivers do not improve every workload, so preserve the existing lowering policy and retain all regressions. The overall performance goal is unmet. * test: record isolated widening multiply performance and regressions Retain the five-round CPU comparison with all 264 harness samples and twelve CoreMark samples correct, statistics-free and isolated from builds, validation and profiling. CoreMark JIT changes from 1289.03 to 1254.41 ms; the generic-count reduction does not imply a comparable speedup. Record every decoded/JIT result, including interpreter and i386 FP regressions. Record all 132 correct application samples from three rotated boots per kernel, with default guest ASLR and zero host warnings or JIT failures. Retain cold CoreMark, gzip, sort, Python mix and Node startup regressions alongside the later CoreMark and Node crypto improvements. Also record the five passing patch/bundle checks and all four Alpine SSH/Python configurations. The fastest-valid Box64 comparison on the eventual common kernel remains pending, and the overall performance goal remains unmet. * x64: compile saturating packed arithmetic and retain precise decode faults Compile all eight signed/unsigned byte/word saturating add and subtract families for legacy XMM, VEX.128 and AVX2 VEX.256 register forms. Reuse the existing byte/word add/subtract kinds with auxiliary saturation modes and preserve their wrapping forms, 16-byte ops, CPU size and ABI. Emit standard Wasm SIMD saturation operations; retain source aliases, independent lanes, legacy upper halves, VEX clearing, flags and MXCSR. Keep MMX and memory forms on the reference path. Select the SIMD opcode during code generation without adding a guest runtime mode branch. Add full-state differentials for new and wrapping forms, both modes, widths, ignored W bits, aliases, high registers, edge-value pairs and cold/warm execution. Check every active lane against an independent widened integer oracle. Exercise unavailable AVX/AVX2, invalid LOCK, memory faults and warm XCR0 changes across every new family. Correct an initial fixture to require the existing trap_ill handler for LOCK before VEX while retaining all event and retirement assertions. Reject invalid VEX prefixes before operand access through the shared encoding validator. The physical oracle now covers 139 forms and 71,168 combinations, with 58,152 UD results plus 6,144 unmapped saturation-prefix checks and the prior 1,536 multiply checks. Append native masks without renumbering existing forms. The old validator misclassifies 12,288 new combinations; the repair has zero dispatcher mismatches. Keep fresh reference decoding and its independent arithmetic implementation. Match cached failed-decode metadata to the fresh reference's zero value instead of returning the first prefix byte. Keep every consumed raw byte and invalidation dependency. Strengthen the common x86 machine comparison to check ev.insn for all existing and new differentials, and add cold and repeated invalid-prefix/map cases. Retain the pre-fix zero-versus-F0 failure. No existing test or reference path is removed or weakened. Pass 210 physical comparisons per normal/atomics x86 build and 95 Wasm JIT units per SIMD setting without compilation failures or module leaks. Pass both A64 configurations with 77 oracle comparisons, 140 Wasm units and one expected skip per setting, and 300-seed fuzz. Independently verify the native image reports 197 passed, eight skips and zero failures. Pass the final 79-case kernel matrix, all four complete stack guards, five patch/bundle checks and four Alpine SSH/Python configurations. The unchanged final bundle passes 156 API tests with three optional skips on an isolated rerun; retain both earlier snapshot failures as unresolved verification limits. Final extended fuzz and common-kernel Box64 acceptance remain open. Record eighteen valid statistics-only samples: gzip generic execution drops from 2,095,196 to 6,307 at the same retirement count. Reject those timings. Record all isolated five-round CPU results and 132 correct application samples from three rotated boots per kernel, with zero warnings or JIT failures. Gzip changes from 834.39/937.67 to 800.65/797.12 ms first/later; retain later Python mix, spawn and crypto regressions and first Node startup regression. CoreMark CPU timing is unchanged. Do not attribute every net kernel improvement to saturating instructions or claim the overall goal met. Publish the generated-module naming preload and explicit diagnostic timing exclusion in both benchmark drivers. Preserve original module bytes and hashes, add only custom names, reject a nonempty capture directory and keep all correctness checks. Five correct normal-code diagnostic samples have all timings ineligible and retain 43 verified original modules for profiling. * x64: retain exact flag state after unconditional branch synchronization Materialize full architectural state once at unconditional branch synchronization points and retain that knowledge through region routing. Add syncExact without changing sync, whose conditional fault and side-exit arms must preserve lazy state on their untaken paths. Use the new operation for non-self terminators, returns and direct or indirect transfers. Keep self-loop handling, checked entries, instruction charges, reference execution, CPU layout and the ISA-neutral core unchanged. Add two full-state differential groups covering every lazy flag kind and width, incoming carry, partial writes, all conditions and changed branch forms, synthetic fallthrough, cold/warm execution and exact budget edges. Require actual shared-region membership. Exercise untaken warmed-load hand-backs followed by stack, operand, noncanonical-target and fetch faults, including event metadata and exact retirement. Separate controls that mark conditional state exact or omit actual flag computation fail the directed fault test in both SIMD settings. Keep all production tests unfiltered. Pass 210 physical comparisons per normal/atomics x86 build and 97 Wasm JIT units per SIMD setting without compile failures or leaks. Pass both A64 configurations with 77 oracle comparisons, 140 Wasm units and one expected skip per setting, and 300-seed fuzz. Independently run the rebuilt native image with 197 passes, eight skips and zero failures. Pass the 79-case kernel matrix, four complete stack guards, five patch checks, 156 isolated API tests with three optional skips, and four Alpine SSH/Python regressions. Retain earlier intermittent snapshot failures and final extended audit limits. Capture 43 diagnostic modules with matching ordered checked-entry PC sets. Their total original size falls from 417419 to 388851 bytes; one matching sixteen-member module shrinks from 22453 to 17249 bytes and from 157 to 91 flag-local writes. Exclude every diagnostic timing. Record all 408 correct, isolated and statistics-free CPU/application samples with zero warnings or JIT failures. CoreMark application first/later medians change from 1308.33/1225.53 to 1221.83/1146.70 ms; later Python mix changes from 9656.55 to 9086.78 ms. Retain i386 memory, later spawn, first Node crypto and both Node startup regressions, along with substantial boot variation. The final common-kernel Box64 comparison remains open and the overall goal is unmet. * test: scope JIT profiling names to generated entry modules Identify generated modules by their sole function export f before adding names. The SDK's TypeScript loading also constructs Wasm synchronously; renaming that compiler module previously triggered the generated-code function-import check before an application profile could start. Preserve ordinary module construction and retain the strict no-function-import check for selected JIT modules. Keep original captured bytes and hashes. Add a child-process regression that initializes the real TypeScript loader after installing the preload, instantiates an unrelated module with a host function import, executes a named entry module and compares its captured bytes and SHA256. Require the generated-entry import violation to keep throwing, and require exactly one original module in the manifest. Pass the regression and the preload syntax check on the physical test host. Retain the failed diagnostic startup log and its empty manifest; no guest sample or accepted timing was produced by that attempt. * emu: route forward region transfers directly through checked entries Branch from a member to a later member's existing enclosing checked-entry label instead of setting an index and returning through the dispatcher. Keep the same state synchronization, interrupt and generation polls, decoded-op checks and instruction charges. Preserve earlier-member and self-loop routes and apply the change through the ISA-neutral core. Add x86-64/i386 and A64 component differentials for all fifteen forward target positions in sixteen-member regions. Enter real compiled code so the caller cannot repair a failed check before inspection. Compare full registers and memory with fresh reference execution, and check returned budget, stop code and last member for budget, IRQ, stale-op and generation rejections and a positively charged target. First pass both new tests with the original dispatcher route. A separate unchecked-body control fails on both ISAs with and without SIMD, with no module compile failures or leaks. Pass 210 physical comparisons per normal/atomics x86 build and 98 Wasm units per SIMD setting. Pass both A64 builds with 77 oracle comparisons and 141 Wasm units plus one expected skip per setting, including all four 20000-seed fuzz runs. Independently run the corresponding extended native image with 197 passes, nine skips and zero failures; retain the listener's misleading zero-exit failed-command output. Regenerate identical XED forms and pass all 194147 dispatch checks and 71168 physical VEX combinations, including the 1536 and 6144 unmapped-prefix checks. Pass the 79-case kernel matrix, all four complete stack guards, five patch checks and four Alpine SSH/Python regressions. Pass 156 isolated API tests with three optional skips on the complete bundle. Retain the initial bare SMP invocation's missing-boot-metadata failures and correct the invocation without changing assertions or timeouts. Record all 570 correct isolated CPU, application and nine-boot startup samples, with zero warnings or JIT failures. CoreMark harness changes from 1238.39 to 1217.13 ms; later application CoreMark changes from 1150.00 to 1123.60 ms. Retain every regression, including cold CoreMark, SHA, Node CPU, Python startup in the full sequence and several i386 loops. Keep the large correct CoreMark outlier and the startup experiment's different process history and mixed winners. Retain ninety focused common-kernel Box64 samples, of which twelve 0.3.4 Python mix outputs are invalid despite exit zero. Native medians lead the three focused workloads, but later Python mix leads by only 2.2 percent and still loses to Box64's fastest single valid sample. The complete final comparison and uniform substantial improvements remain unachieved. Record 36 correct normal-code profile samples and verified original module hashes with all timings excluded. A separate 18-sample statistics observer finds substantial flag materialization and potential transfers to dead flag heads. Retain its emission and failed-check counting limits; do not claim the observed opportunities are speedups or weaken precise state. * x64: preserve deferred arithmetic state across checked region transfers Carry arithmetic kind, operands and actual result in four private Wasm locals across region members and preserving loop heads. Recover complete flags at consumers, faults, hand-backs, rejected checks and module exits with the existing factored formulas. Keep ADC/SBB carry, partial producers, narrow shifts, instruction charges and all existing entry guards exact. Leave the reference executor, CPU layout, 16-byte ops and ABI unchanged. Give the shared core optional transfer, helper-signature and warmup hooks whose defaults preserve A64 execution. Warm the x86 recovery helper's memory-free zero-mode path inside the host compilation window. Emit only used kinds and omit unnecessary helpers for plain prefixes, nonloops and proven dead-head loops; preserve saved flags before any faulting head. Add full-state differentials for all lazy kinds and widths, carry inputs, all conditions, partial writes, preserving loads and FP operations, exact budget boundaries, memory/stack/FP faults and IRQ rejection. Exercise mode zero and all fourteen pending kinds in one actual compiled region. Separate wrong-result and prematurely-exact controls fail in both SIMD settings without compilation failures. Retain inadequate fixtures and controls. Fix a real precision gap in the preceding loop-head analysis: a vector operation before a complete overwrite can fault on a later pass after a generic MXCSR update. Add a case that starts with exact division, changes MXCSR and the divisor, and requires the next pass's precise fault, complete flags, eight retirements and exactly one compiled entry. The old executor and a blind head-skip control fail with SIMD. Independently check both overflow directions against physical signal frames without weakening any existing assertion or reference semantics. Pass 210 physical comparisons in each normal/atomics x86 build and 102 Wasm units in each SIMD setting, without compilation failures or leaks. Pass both extended A64 builds with 77 oracle comparisons and 141 Wasm units plus one skip per setting, including all native, SIMD and no-SIMD 20000-seed fuzz runs. Independently run the matching native image with 197 passes, nine skips and zero failures; retain the listener's misleading failed-command line despite its successful exit. Pass the matching 79-case kernel matrix, four complete stack guards, five patch checks and all four Alpine SSH/Python configurations. Regenerate identical XED representatives and pass 194147 dispatch checks and 71168 physical VEX combinations, including the existing unmapped-prefix checks. Pass 156 isolated API tests with three optional skips on the complete two-CPU bundle with the Alpine image. Record all 852 correct isolated CPU, application and startup samples with zero warnings or JIT failures. Initial deferral reduces x64 fib and interpreter harness time by 14.10 and 17.11 percent, but application and startup results remain mixed. Compare safe heads and helper pruning in a separate 432-sample control. Retain every i386, cold Python, gzip, spawning and cold Node regression, broad boot ranges and correct outliers. Select the smaller pruned implementation without claiming a universal speedup. Retain diagnostic profiles and original module hashes with every timing excluded. Identity-only helpers motivate pruning; their module bytes are not helper size or a measured runtime cost. The final complete common-kernel Box64 comparison and uniform substantial improvements remain unachieved. * x64: dispatch indirect region targets through a balanced PC search Sort member indexes by their full unsigned PC during emission. Select one candidate through balanced comparisons and route it through the existing equality check and checked entry. Keep compatibility tags, original member indexes, self branches and exact state on unmatched exits. Leave direct branches and shared core routing unchanged. Exercise five indirect forms at six region sizes in both x86 modes. Enter compiled modules directly and check every target, nonmember aliases, exact retirement, register and memory state, and budget, IRQ, stale-op, generation and code-epoch rejection against the fresh reference. Account for the entry's code epoch in the fixture. Deliberately remove the final equality check and separately introduce a false rejection in the prefilter control. Both changes fail the new comparison with and without SIMD and produce no host compile failures or leaks. Compare linear search, a common-bit prefilter and a balanced search in 432 isolated samples. Balanced search reduces i386 fib, cold Python mix and later CoreMark medians by 8.5, 3.9 and 3.9 percent. Retain all startup and other regressions, the prefilter's 7.3 percent i386 fib regression, and correct outliers. Record the statistics-only observations separately and account for their effect on emitted module size and region membership. Validate 330 samples from the balanced kernel shared by native execution and both Box64 releases with default and CALLRET settings. All 66 native samples pass. Exclude 12 incorrect Python mix outputs and 72 failed Node 24 executions. Native medians lead the best Box64 configuration medians in all comparable phases. Against the fastest individual correct Box64 sample, later Python mix still loses about 3 percent and early CoreMark and Python mix have small leads. All 132 native before/after samples pass and every workload's median improves relative to the original audit kernel. Retain the requirement for a substantial lead across workloads. Support one-kernel workload generation and summarize complete comparison reports with both the best valid configuration median and fastest valid individual result. Check the analysis against a prior complete report and controls for missing, duplicate, diagnostic, wrong-output and host-failure samples. Match 11270 non-kernel input hashes and all checked references. Pass 210 physical comparisons in the normal and atomics builds, with 103 Wasm tests per SIMD setting and no module errors or leaks. Rebuild UP and SMP, pass the 79-case kernel matrix and five patch checks, and verify that the timed UP image and rebuilt UP image differ only in four build-stamp strings. * test: check pending flags through faulting memory arithmetic Enter compiled regions with live incoming flags and exercise ADC and SBB with a memory source or destination. Compare complete state with the fresh reference across successful execution and misaligned, read-only, unmapped and straddling accesses in both x86 modes. An independent control overwrites the saved result before a page crossing. Both SIMD configurations detect the incorrect fault flags with no module compile errors. The full baseline and operand-reuse suites pass 210 physical comparisons and 104 Wasm tests per SIMD setting. Record the 384 eligible samples and retain the existing operand locals. Reusing ALU locals improves several medians but slows i386 fib, both CoreMark application phases, first Python mix and several startup results. Retain the measured ranges and correct outliers in the raw reports. Record eighteen valid source-region diagnostics. Member capacity dominates CoreMark cross-region transitions. Emission size dominates Python mix. Keep the instrumentation outside accepted timings. * test: compare native AArch64 and x86 application workloads Select architecture-specific chroots through an optional engine root map while retaining workload arguments, physical output checks and one common kernel. Record setup output so runtime version checks remain reviewable. Leave existing native and Box64 specifications on their original paths. Require matching pinned Python and Node image indexes, expected ELF machine types and equal distribution package versions. Build both CoreMark guests from the same clean pinned source with Zig -O2 and baseline target CPUs. Preserve each AArch64 root's libraries and compare actual Python, zlib and Node component versions before timing. Keep all staging in disposable RAM. Pass all 132 application executions across three rotated boots against eleven physical references, with 21457 recorded input hashes, no host warnings and no JIT failures. AArch64 leads every first and repeated median in this set. Repeated x86 time is 1.19 to 4.60 times AArch64 time, with the largest gap in Node crypto. Retain every sample and range and distinguish complete software stacks from individual instruction costs or host CPUs. Reject incomplete and duplicate matrices, incorrect output or status, instrumented timings, host failures, incomplete setup and troubled boot consoles. Pass fifteen independent corrupted-report rejection controls and reject a wrong-architecture root before building or creating output. Document the paired software versions, results and reproduction commands. * docs: remove personal environment details from the x86 audit Describe the validation host by its hardware and toolchain rather than a personal SSH alias. Remove absolute checkout paths and machine-specific transfer procedures from the shared audit document. Retain the measurement date, hardware, tool versions, reproduction commands and verification limits. Keep the audit results unchanged and refer to the validation checkouts' audit-logs directories without prescribing a personal workspace layout.
A real Linux kernel, compiled to WebAssembly. It boots to a shell in less than a second.
Try it · Performance · Features · CLI · How it works · Benchmarks · JavaScript SDK
unkernel is Linux 7.x built as a single wasm module with a real MMU. The kernel (syscalls, scheduler, memory management, ext4, TCP/IP) is compiled code, not emulated, so programs get Linux's own behavior down to the edge cases. Only user programs are emulated: unmodified aarch64 (arm64) Linux binaries, so Alpine and Debian packages run as they are.
Open a page and you have a Linux machine with a shell, a package manager, a persistent disk, internet access, and a screen with sound. It runs entirely on your device, with nothing to install and no server, and every layer is open source. How it works explains the design.
⚡ Performance
Much of what makes a system feel slow lives in the kernel: starting processes, syscalls, page faults, file and network I/O. In unkernel that path runs at wasm speed.
- Boot: the kernel reaches
/initabout 70 ms after it starts, and the Alpine prompt appears 0.3 s afternodelaunches. The page downloads about 10 MB, and Alpine boots in 48 MiB of guest memory. - Syscalls at close to native cost:
getppidtakes about 170 ns (110 native, 1.7 µs under qemu-system), a 64-bytereadabout 170 ns (160 native). - fork at native speed: fork + exit + wait takes about 60 µs, against about 70 µs natively and 1.2 ms under qemu-system.
- A JIT for user code: hot aarch64 code, including the AES, PMULL and
SHA instructions OpenSSL uses, is compiled to wasm while it runs. With
it a shell loop runs 1.6 times and
sort2.3 times as fast as on the interpreter alone, and OpenSSL in the guest does AES-128-GCM at about 100 MB/s and SHA-256 at about 160 MB/s.
The syscall and fork numbers were measured on 2026-11-14 (with the
riscv64 user space the project started with; the path through the kernel
is the same), the JIT numbers on 2026-11-18. CPU-heavy programs are well
behind native: apk search over the main index takes about 0.8 s, apk add python3 about 3.4 s. Benchmarks has the full numbers.
🐧 A real kernel
Anything a program relies on, from /proc and epoll to cgroups and
overlayfs, behaves as it does on a server, because it runs the same code.
- A real MMU (
arch/wasmwith Sv48 page tables):fork,mmap, copy-on-write, shared memory, threads and signals behave as they do on hardware. This is not a NOMMU port where programs are limited tovfork. - Linux's own file systems: ext4, overlayfs, tmpfs, loop devices, FUSE, and 9p, which mounts file systems your program serves from the host. The root file system is an overlay: a read-only distro image under your changes, which go to a persistent ext4 disk, so everything you change survives a reload, and a safe mode recovers a system you broke.
- Linux's own TCP/IP stack, with DHCP and DNS, reaching the internet through your host's sockets or a Wisp proxy (Add a network).
- cgroups, namespaces, userfaultfd, fanotify and TUN: enough for
systemd to boot Ubuntu 26.10 to
multi-user.target. - Devices: a framebuffer (
/dev/fb0), evdev keyboard, mouse and touch, sound through ALSA and/dev/dsp, AF_VSOCK, and shared memory with the host. - aarch64 user space: ARMv8.0-A with FP and AdvSIMD plus the AES, PMULL, SHA1, SHA2, SHA512, SHA3, CRC32 and LSE atomics extensions, so distribution binaries and OpenSSL's hardware AES, GHASH and SHA paths run unchanged. aarch64 is a first-class port of every distribution, so their full, current package archives are available.
Known limits lists what is still missing.
🧰 What you can do with it
- Carry a Linux shell anywhere. Alpine Linux
3.24 runs in Chrome, Edge, Firefox and Safari, including on phones. Install
anything with
apk addfrom Alpine's regular mirrors. Type a command that isn't installed, such ashtop, and its package is installed for you. apk starts with only themainrepository, because it is about 4x faster that way;communityis added the first time a command needs it. - Run real runtimes and tools: Node and npm, Python, OpenSSL, curl and
wget, straight from the distribution. Debian 13 boots the same way as Alpine (--distro debian), with apt. - Write graphics and sound programs against
/dev/fb0, evdev and ALSA. Tryglimmer, a tiny game with sound. - Embed Linux in your app with a
zero-dependency TypeScript SDK, published as
unkernel. The same kernel file runs in Node and in every supported browser, optionally in a worker. Disks can be local ext4 images, http(s) images fetched by range, or a persistent disk in IndexedDB. The SDK is MIT-licensed, and there is no closed engine or license key behind it, so you can ship it in your product and host it wherever you like. - Talk to the guest through terminal sessions, each with its own pty and shell, host directories and in-memory file systems mounted in the guest, vsock byte streams and zero-copy shared memory, with no network in between.
- Script and test: the CLI types input on a schedule, stops on a timeout, and reports how the guest ended in its exit code.
🌐 Try it in the browser
Open unkernel.dev. A desktop appears after a
download of about 10 MB, with a shell in its Terminal window. Your changes
are saved in the browser. The Dock opens the apps (so do ⌘K on a Mac and
Ctrl-Shift-O elsewhere); Settings has the options and export or reset for
your disk, System the diagnostics. Ctrl-A n (⌘J n on a Mac) or + on
a Terminal window's tabs opens another terminal with its own shell, up to
9; Ctrl-A (⌘J) and a digit switches, and Ctrl-A ? lists every shortcut. The
wallpaper is a random photo from Lorem Picsum
by default, so the page fetches one from picsum.photos on every load;
the built-in wallpaper or a preset (Settings > Desktop) stops that.
The page takes a few URL parameters:
| Parameter | Does |
|---|---|
?mem=512 |
Guest memory in MiB |
?append=... |
Extra kernel command line |
?net=0 |
Boot without a network |
?wisp=wss://... |
Use your own Wisp proxy |
?jit=0 |
Interpreter only |
?data=0 |
No persistent disk, a fresh system every time |
?worker=0 |
Run the kernel on the page's thread (default: in a Web Worker where the page is cross-origin isolated) |
?cpus=2 |
Boot on that many CPUs, each in a Web Worker (default: half the device's threads, up to 4 on desktops and 2 in Firefox and on phones, where the page has the SMP kernel and is cross-origin isolated; ?cpus=1: one CPU) |
?gl=0 |
No guest GL (on by default on Debian: the guest's Mesa renders through your browser's WebGL2, see below) |
On Debian the guest gets a GPU (/dev/dri, Settings, Guest GL): Mesa's
virgl driver draws through your browser's WebGL2. The renderer behind it
is downloaded only when a guest program first uses GL; the Guest GL row
in System > Environment then names the GPU (a software renderer such as SwiftShader
is flagged). Mesa is installed in the guest, not shipped:
sudo apt-get install -y mesa-utils libegl-mesa0 libgles2 kmscube
eglinfo -B -p gbm # OpenGL ES renderer: virgl (<your GPU>)
kmscube # on the display (Enter ends it)
sudo apt-get install -y xvfb xauth glmark2-es2-x11
xvfb-run -a -s "-screen 0 640x480x24" glmark2-es2 # frame rates
Wayland apps show as windows on the page: wland foot (or the
launcher's foot tile) starts wland's relay in the guest and runs the app
against it; wland's compositor runs in
the page and reads the app's pixels straight from guest memory. Each app
window is a window of the page's desktop; Ctrl-A w (⌘J w on a Mac) switches between them
and the other windows.
sudo apt-get install -y foot fonts-dejavu-core
wland foot
Browsers can't open raw TCP sockets, so the page reaches the internet
through a Wisp proxy, unless ?wisp= names
another. A guest's TCP connections go through it, and the proxy sees their
addresses and the bytes on the wire (an HTTPS stream is opaque to it, a plain
one is not). The default one accepts only known origins, so if you host the
page somewhere else, build it with KW_WISP=wss://your-proxy/ (several,
comma-separated; a path such as /wisp/ is on the page's own origin) or
point ?wisp= at your own proxy.
| Browser | Status |
|---|---|
| Chrome / Edge 137+ (desktop and Android) | ✅ works |
| Firefox 153+ | ✅ works |
| Safari 27+ on macOS, any browser on iOS/iPadOS 27 | ✅ works |
| Anything without JSPI | the page tells you what's missing |
💻 Run it from the terminal
npx unkernel
This boots Alpine, with networking over your host's sockets. Press
Ctrl-] to quit. The package holds the kernel and a small base system;
the first run downloads the Alpine image (about 4 MB) from the GitHub
release of your version and keeps it in ~/.cache/unkernel.
npx unkernel --distro debian # Debian 13 instead (about 57 MB, downloaded once)
npx unkernel --distro none # no distro: the base shell (busybox)
npx unkernel --data my-data.img # changes persist on a /data disk, created on first use
npx unkernel --display --sound # a framebuffer and a sound card
npx unkernel --mem 1024 --no-net # more memory, no network
npx unkernel --mount .:/work # this directory at /work in the guest (:ro for read-only)
npx unkernel --forward 8000:80 # host 127.0.0.1:8000 to port 80 in the guest
npx unkernel --timeout 60 --input '{8}uname -a\n{2}poweroff\n' # scripted: wait, type, wait, type
npx unkernel --help # everything else
Without --data, changes to the root file system are kept in memory and
gone at exit; with it, each distro keeps its own in /data/distros/<name>/.
--distro also takes an image file or an http(s) URL, and
UNKERNEL_CACHE_DIR moves the download cache.
Exit codes: 0 power off, 1 halt or boot failure, 2 restart, 124 timeout, 253
kernel panic, 254 wasm trap, 255 fatal error. The CLI is built on the
JavaScript SDK: --mount uses its host
mounts and --forward its
vm.connect().
🔍 How it works
Most "Linux in the browser" projects take one of three approaches:
- Emulate a whole PC, kernel included. This is faithful but slow, because every syscall and page fault goes through emulated hardware.
- Emulate the CPU and reimplement the syscalls. Programs run on an emulated CPU, often with a JIT, and a runtime answers their syscalls, with no Linux kernel at all. This is fast, but it covers only as much of Linux as the runtime implements.
- Compile programs to wasm, and run them on a kernel without an MMU or
on a runtime that provides POSIX calls. This is fast, but native programs
have to be rebuilt, and
forkand anything else that needs an MMU breaks or is approximated.
unkernel keeps the best of each: the real Linux kernel, running at native wasm speed, under unmodified binaries with a real MMU.
| Approach | Kernel | User space | MMU |
|---|---|---|---|
| Whole-machine emulators (v86, JSLinux, container2wasm, QEMU's wasm build) | Linux, emulated | unmodified, emulated | emulated |
| Syscall emulators | none: a runtime reimplements the syscalls | unmodified, emulated | the runtime's own |
| POSIX runtimes for wasm (Wasmer WASIX, WebContainers, BrowserPod) | none: a runtime provides the syscalls | rebuilt for wasm, or JavaScript | none |
| Linux without an MMU (linux-wasm, tombl/linux, WasmLinux (LKL)) | Linux, native wasm | rebuilt for wasm | none |
| unkernel | Linux, native wasm | unmodified aarch64, emulated | real page tables |
The kernel is compiled straight to WebAssembly. User programs run on kwemu, an aarch64 CPU written in Zig and linked into the kernel. kwemu walks the kernel's own page tables, so memory management is done by the real Linux code.
When a program makes a syscall, kwemu returns to the kernel, which handles
it as native wasm. There is no emulated trap and no emulated kernel mode in
between. Task switches use JSPI (WebAssembly.Suspending), so the kernel
gets real stacks that it can suspend and resume.
kwemu runs blocks of guest code decoded once into compact ops (what has no op runs through a reference interpreter), and hot user code goes through a second tier: a JIT that compiles those blocks to wasm modules at run time, with output that matches the interpreter bit for bit. Benchmarks shows what each tier costs.
Devices are small paravirtual drivers that talk to the JavaScript host: block (kwblk), network (kwnet, with a user-mode TCP/IP stack in JS), display, input and sound (kwfb, kwinput, kwsnd), a camera (kwcam, V4L2), vsock (kwvsock), shared memory (kwshm), serial ports (kwserial), Bluetooth (kwbt, an HCI transport) and a USB host controller (kwusb).
📊 Benchmarks
The design helps most with syscalls. These were measured under Node:
In this test (2026-11-14) fork is faster than native. Pure computation is
slower. kwemu's decoded-op interpreter runs integer code at about 250-300
million guest instructions per second under Node (2026-11-17), and the
JIT makes real Alpine work 1.6 to 2.3 times as fast as that (2026-11-18:
an ash loop 2.5 s against 4.0 s, seq 100000 | sort -r 3.1 s against
7.1 s, seq 250000 | gzip | gunzip 3.5 s against 6.5 s), which is still
well behind native.
🚧 Known limits
- The SDK and CLI boot one CPU by default; the page boots several where
it can (
?cpus=). A snapshot of several CPUs (SMP), and so a session suspended on the page, resumes only on as many. - No IPv6, no ICMP beyond the gateway, no UDP on the page beyond DHCP and
DNS (its Wisp server carries none), no inbound network connections
(
vm.connect(),vm.fetch()and--forwardreach guest servers over vsock instead), except with tailnet peers when the network spec hastailscale(--tailscale-authkey), and through its exit node when one is chosen (exitNode,--tailscale-exit-node). - Over
wispBackend(), a guest's half-close (shutdown(SHUT_WR)) does not reach the server, so a client that waits for the server to see end of file before it answers hangs (echo hi | nc HOST PORTagainst such a server, an HTTP/1.0 body without Content-Length). Names resolve to placeholder addresses in 198.18.0.0/15: every name resolves, a bad one fails at connect time, and one address stands for each name. Passlookupfor real answers, or use a backend of your own (Add a network). - No hardware breakpoints or watchpoints:
gdb's watchpoints are software ones, which single-step the program. - Code that runs only a few times (a large program's startup, such as
npm's) stays on the interpreter, and FP and AdvSIMD floating point run through it even inside compiled code. Without wasm SIMD in the host engine, OpenSSL's AES and SHA paths run on the interpreter too. - A wasm trap in the kernel ends the session.
🧩 Use it from JavaScript
npm install unkernel
import { createKernel, fetchDistro } from "unkernel";
const vm = await createKernel({ distro: await fetchDistro("alpine") }); // Alpine, no network
vm.onOutput((bytes) => process.stdout.write(bytes));
vm.write("uname -a; poweroff\n");
const { code, kind } = await vm.exited; // 0, "halt"
Importing unkernel picks the Node or browser entry automatically, and
unkernel/node or unkernel/web selects one explicitly. The kernel ships
in the package (unkernel/unkernel.wasm) and loads from next to the entry,
streamed and compiled while it downloads. It carries a small base system
that mounts a distro image read-only under an overlay root and runs its
init; createKernel() without distro boots the base shell
(busybox and unkernel's tools), which needs no download.
The distro images are not in the package. On Node, fetchDistro("alpine")
(or "debian") downloads one once from the GitHub release of the
package's version, checks it against the release's distros.json (size and
SHA-256), keeps it in ~/.cache/unkernel (UNKERNEL_CACHE_DIR) and
returns its path; nothing else in the SDK downloads anything. In the
browser, host the image yourself (it is read lazily with range requests)
and pass its URL:
const vm = await createKernel({ distro: "/distros/alpine.erofs" });
Changes to the root file system stay in memory, unless a persistent data
disk (labelled kwdata) is attached: then each distro keeps them in
/data/distros/<name>/ on it.
Add a network
import { createKernel, directBackend, wispBackend } from "unkernel";
await createKernel({ net: directBackend() }); // Node: host sockets
await createKernel({ net: wispBackend("wss://wisp.example/") }); // anywhere: your Wisp proxy
Networking is off unless you pass net. Any object with connect and
lookup methods can carry the guest's TCP and DNS (and with a udp
method its UDP), so you can write your own backend. Wisp carries no DNS and
no half-close (Known limits); wispBackend(servers, { lookup }) takes a resolver of your own, such as DNS over HTTPS, for real
addresses.
Join a tailnet
let state = load(); // the node's keys from an earlier run, if any
const vm = await createKernel({
net: {
kind: "net",
backend: { kind: "direct" }, // or { kind: "wisp", servers: "wss://wisp.example/" }
tailscale: { authKey: "tskey-auth-...", state, hostname: "box", exitNode: "my-server" },
},
onTailscale(e) {
if (e.type === "state") save(e.state); // keep it secret: it is the node's identity
if (e.type === "authurl") console.log("log in at", e.url); // no auth key: interactive login
if (e.type === "status") console.log(e.status.state, e.status.addresses);
},
});
vm.tailscale.setExitNode(null); // back to the backend; a name picks another
With tailscale in the network spec the guest joins your
Tailscale network (or a
headscale one: controlURL) from
Node or a browser. The client is JavaScript inside the SDK, loaded only
when the option is used: it speaks to the coordination server over a
WebSocket and carries WireGuard over Tailscale's DERP relays, so it needs
no UDP and no helper on the host, and every packet is relayed. The guest
gets its 100.x address on a tailscale0 interface, reaches the tailnet's
devices by address or MagicDNS name, and they reach servers in the guest.
Everything else keeps going through backend.
exitNode (a device's name or 100.x address) sends all the guest's other
IPv4 traffic and its DNS through that device instead of the backend. The
device has to advertise itself as an exit node, be approved, and the
tailnet's policy has to let this node use it; status.exitNodes lists
the devices that qualify and status.exitNode says whether the chosen
one is usable. While it is not (offline, not found, not approved) that
traffic is refused, never sent through the backend. acceptRoutes adds
the peers' subnet routes. There is no IPv6 and the tunnel's MTU is 1280.
From the terminal, npx unkernel --tailscale-authkey KEY --tailscale-state ts.json --tailscale-exit-node my-server does the same
(--help lists the --tailscale-* options); on the page it is in
Settings, Network, Tailscale.
Add disks
import { createImageFromKwsparse, createKernel, bundledBoot, openDisk } from "unkernel/node";
const vm = await createKernel({
distro,
disks: [await openDisk("data.img")], // the data disk, or any ext4 image or https:// URL
});
createImageFromKwsparse(file, template) makes a new data disk from the
template the kernel carries (bundledBoot(module).datadisk). In the
browser, openHttpDisk(url) keeps your writes in IndexedDB and
openDataDisk() gives you the persistent data disk that
the page uses. Anything that implements
BlockDevice works too, and a disk of your own can be the root:
cmdline: "console=hvc0 root=/dev/wda rw" with initrd: null.
Console and lifecycle
// vm.output: a ReadableStream, everything since boot and then live
vm.output.pipeTo(new WritableStream({ write: (b) => process.stdout.write(b) }));
vm.write("ls /\n"); // or write to vm.input, a WritableStream
vm.resize(120, 40); // the foreground program gets SIGWINCH
await vm.sync(); // flush the guest's disks
console.log(vm.stats()); // memory, disk, network and JIT counters
const { code, reason, kind } = await vm.exited; // stop() parks it at once
Run programs
const { stdout, exitCode } = await vm.exec("uname", ["-a"]);
const { stdout: sum } = await vm.exec("sha256sum", [], { input: "hello" });
exec() runs a program on pipes and resolves with { stdout, stderr, exitCode, signal }, also for a non-zero exit. Pass encoding: "buffer"
for bytes, and cwd or env as you would to child_process. On the
distro images programs run as the user user (uid 1000, in
/home/user), who has sudo without a password; pass user: "root" (or
another name or uid) to run as someone else. The base shell is root's.
const sh = await vm.spawn(); // a login shell on its own pty
sh.output.pipeTo(new WritableStream({ write: (b) => process.stdout.write(b) }));
await sh.write("cat /etc/alpine-release; exit\n");
console.log(await sh.ended); // { type: "exit", code: 0 }
spawn(file, args, { cols, rows }) runs a program on a pty, in the
zigpty / node-pty shape, with resize(), kill(signal) and close() (a
hangup). Run as many as you like. Keep reading output: the guest program
waits while nobody does.
const gz = await vm.spawn("gzip", ["-c"], { pty: false });
gz.stderr.cancel(); // read both outputs, or cancel one
const zipped = new Response(gz.stdout).bytes();
await new Response("hello\n").body.pipeTo(gz.stdin); // then EOF
console.log((await zipped).length);
With pty: false the program gets pipes: stdin, stdout and stderr
web streams, byte for byte.
Mount host files
import { createKernel, MemoryFs, nodeFs } from "unkernel";
const mem = new MemoryFs();
mem.onChange((c) => console.log(c.type, c.path)); // what the guest changed
const vm = await createKernel({
mounts: {
"/mnt/host": { "hello.txt": "hi", dir: { "a.bin": bytes }, "now.txt": () => Date() },
"/mnt/mem": mem,
},
});
await vm.exec("cp", ["/etc/os-release", "/mnt/mem/"]);
console.log(mem.readText("/os-release"));
const work = await vm.mount("/work", nodeFs("."), { readOnly: true }); // Node only
await work.unmount();
A file system is a plain object tree (a function is a computed file,
evaluated once per open), a MemoryFs you read and write from the host,
nodeFs(dir), or your own Fs: getattr, readdir and open by path,
sync or async, plus whichever change methods you want. Mounts are served
over 9p on vsock. Each guest write reaches the host as it happens, and a
host change shows in the guest within a second.
Talk over vsock
const listener = vm.vsock.listen(5000); // guest programs connect to CID 2, port 5000
vm.write("echo hello | kwbox vsock connect 5000\n");
const conn = await listener.accept();
console.log(await new Response(conn.readable).text()); // "hello\n"
conn.close();
const c = await vm.vsock.connect(6000); // a guest program listening on port 6000
await c.writable.getWriter().write("ping");
These are byte streams with real flow control and no network in between.
vsock is on unless you pass vsock: false.
const sock = await vm.connect(8000); // TCP to the guest's 127.0.0.1:8000
await new Response("hello\n").body.pipeTo(sock.writable); // then EOF (a half-close)
console.log(await new Response(sock.readable).text());
vm.connect(port) reaches a TCP server on the guest's loopback through
the guest's kwtty, over vsock, so it needs no network. It resolves once
the guest has connected (PtyError ECONNREFUSED if nothing listens) with
readable and writable byte streams, half-close included, close() and
closed. The CLI's --forward HOSTPORT:GUESTPORT uses it.
vm.fetch(url, init) sends an HTTP/1.1 request to a server in the guest
and returns a Response whose body streams. It always connects to the
guest's 127.0.0.1 at the URL's port; the host name only goes into the
Host header, so vm.fetch("http://localhost:8000/") reaches a dev server
listening on port 8000. fetchOver(connect, url, init) is the same client
over any byte stream.
Share memory
const vm = await createKernel({ shm: true });
await vm.exec("sh", ["-c", "printf result > /dev/shm/output"]);
const output = await vm.shm.open("output"); // a file a guest program made
const data = await output.read();
const views = output.views(); // zero-copy, until the kernel runs again
const input = await vm.shm.create("input", 1 << 20); // /dev/shm/input in the guest
await input.write(0, bytes);
/dev/shm exists once the guest's init has mounted it, so wait for the
guest before create() (an exec() waits for it). openId(id) opens a
memfd that a guest program exported through /dev/kwshm. views() and
readSync() work where vm.shm.inPlace is true: inline, and in worker mode
with several CPUs and shared memory (cross-origin isolated pages, Node);
elsewhere read() crosses to the kernel's worker.
Serial ports
const vm = await createKernel({ serial: true }); // /dev/ttyACM0..3
const port = await navigator.serial.requestPort(); // Web Serial, in a click handler
vm.serial.attach(webSerialBackend(port)); // the first free port: /dev/ttyACM0
// in the guest: picocom -b 115200 /dev/ttyACM0, esptool, arduino-cli
The guest's tty settings, DTR, RTS and break go to the real port, in order
with its writes; a speed change while it is open reopens it (Web Serial
cannot change an open port). Unplugging or vm.serial.detach(slot) hangs
up the program using it. Web Serial is in Chromium-based desktop browsers;
FakeSerialBackend is a loopback for tests (the CLI's --serial). The page
has Connect… in Settings > Serial ports, and a Thonny app (Tools) for
MicroPython boards (ESP32, Raspberry Pi Pico) on those ports.
Bluetooth
import { createKernel, VirtualLeController, WebBluetoothCentral } from "unkernel";
const vm = await createKernel({ bluetooth: true }); // kwbt: hci0 while a controller is attached
const central = new WebBluetoothCentral();
await vm.bluetooth.attach(new VirtualLeController({ central })); // an emulated LE controller
button.onclick = () => central.requestDevice(); // Web Bluetooth's chooser, from a click
// in the guest: apt install bluez; bluetoothctl, then scan on, connect, menu gatt
The guest gets a real Linux Bluetooth adapter, so unmodified BlueZ
(bluetoothctl, btmgmt, D-Bus GATT clients such as bleak) scans for,
connects to and talks GATT with the BLE devices the page was allowed to use.
Web Bluetooth has no HCI, so VirtualLeController emulates an LE controller
and proxies each device's GATT database; pairing is left to the host's OS,
and there is no BR/EDR, advertising or L2CAP channel beyond ATT. The kernel
side is a plain HCI transport: H4StreamController passes a real
controller's H4 through instead, and attaching another controller replaces
hci0, as replugging a dongle does. Web Bluetooth is in Chromium-based
browsers; FakeGattCentral is a scriptable central for tests (the CLI's
--bluetooth). The page has Bluetooth in Settings, and a Bluetooth app (Tools) that walks a device with bluetoothctl.
USB devices
const vm = await createKernel({ usb: true }); // a USB root hub with 4 ports
const device = await navigator.usb.requestDevice({ filters: [] }); // WebUSB, in a click handler
await vm.usb.attach(webUsbBackend(device)); // the guest enumerates it
// in the guest: lsusb, adb, fastboot, dfu-util, openocd, /dev/ttyUSB0 (FTDI, CP210x, CH34x, PL2303)
The guest's kernel enumerates and configures the device itself; each URB
goes to WebUSB whole (control, bulk, interrupt and isochronous transfers),
so libusb programs work through usbfs. Interfaces WebUSB keeps from pages
(HID, mass storage, audio, video, smart cards) are hidden from the guest.
Unplugging or vm.usb.detach(slot) disconnects it. In worker mode the
kernel's worker opens the device itself where WebUSB works in workers, so
transfers stay off your thread.
FakeUsbBackend is a test device (the CLI's --usb). The page has no USB
controls yet.
Display, input and sound
import { createKernel, domCodeToLinux, pcmToFloat32 } from "unkernel";
const vm = await createKernel({
display: { width: 800, height: 600 }, // the guest gets /dev/fb0
onDisplay: (mode) => console.log(mode), // a program opened it (its mode) or closed it (null)
sound: { onChunk: ({ data, format }) => play(pcmToFloat32(data, format)) },
});
const frame = vm.frame(); // RGBA, or null while nothing draws
if (frame) ctx.putImageData(new ImageData(frame.data, frame.width, frame.height), 0, 0);
addEventListener("keydown", (e) => {
const key = domCodeToLinux(e.code);
if (key && vm.evdev.keyboardOpen) vm.evdev.key(key, true);
});
evdev also has button(), move(), moveTo() and wheel() for a
mouse or tablet. onInput tells you when a program opens the keyboard
and mouse; until then, send keys to the console. readFrame() waits for
a fresh frame.
In browsers, createAudioOut() plays the guest's sound with Web Audio:
import { createAudioOut, createKernel } from "unkernel/web";
button.hidden = true;
const audio = createAudioOut({
onChange: (state) => { button.hidden = state !== "waiting"; }, // "click to play"
});
const vm = await createKernel({ sound: audio });
button.onclick = () => audio.resume(); // or any other click or key press on the page
Browsers start sound only after a click, tap or key press on the page.
Until then the latest holdSeconds (10) of what the guest plays are held:
a clip that has ended by then plays whole, a stream joins live.
audio.muted = true silences it. One sink serves one kernel at a time, and
outlives it: pass it to the next kernel, or close() it.
soundIn gives the card a capture substream (what arecord or a read of
/dev/dsp records): createAudioIn() from unkernel/web is the user's
microphone, asked for only when a guest program starts recording and let
go when it closes the device (silence until then); anywhere else, a
source's read(out, rate) fills out with mono samples in [-1, 1]:
const vm = await createKernel({ sound: audio, soundIn: createAudioIn() });
camera gives the guest /dev/video0 (V4L2: I420, NV12 and YUYV up to 1280x720
at 30 frames a second, for v4l2-ctl, ffmpeg, GStreamer or a browser in
the guest): createCamera() from unkernel/web is the user's camera,
asked for only when a guest program starts streaming and let go when it
stops (black frames until then); anywhere else, a source's read(out, format) writes the current frame in the stream's format, and true gives
black frames. Where the browser's VideoEncoder makes H.264, the camera
offers it too, encoded on the host, so the guest copies the stream instead
of encoding it (ffmpeg -f v4l2 -input_format h264 -i /dev/video0 -c:v copy out.mkv), as with a webcam that encodes. The CLI's --camera shows
a test pattern, --camera=h264 also as H.264.
const vm = await createKernel({ camera: createCamera() });
GL in the guest (browsers)
const vm = await createKernel({ distro: "/distros/debian.erofs", gl: true });
await vm.gl.ready; // the guest is linked; the renderer loads on its first GL use
await vm.exec("sudo", ["apt-get", "install", "-y", "mesa-utils", "libegl-mesa0", "libgles2"]);
const r = await vm.exec("sh", ["-c", "GALLIUM_DRIVER=virpipe LIBGL_ALWAYS_SOFTWARE=1 eglinfo -B -p surfaceless"]);
The guest's Mesa (Debian; its virpipe driver) renders through
virglrenderer compiled to wasm (virgl.wasm, fetched only with gl, and
only on the guest's first GL use; vm.gl.status tells, vm.gl.load()
starts it, and gl: { eager: true } loads it before the boot so that a
failure shows up front) on one WebGL2 context of the page, and gets its
frames back by readback: GL 2.1 and GLES 3.0, surfaceless or under Xvfb.
Node has no WebGL, so there gl is ignored with a log line.
With gpu: true as well (and a kernel with kwvirtio), the guest gets a
virtio-gpu device with 3D on the same renderer: stock Mesa finds
/dev/dri/renderD128 and card0 (driver virtio_gpu) and renders through
it with no variables set, and a KMS client's frames (kmscube,
glmark2-es2-drm, a Wayland compositor) come from the renderer's texture:
const vm = await createKernel({ distro, gl: true, gpu: true, display: { width: 1280, height: 720 } });
// per animation frame: the scanout's latest frame, no readback (null: no GL client on it)
if (vm.gl.gpu.drawFrame(ctx) === null) { /* show vm.frame() as above */ }
// the window resized: a hotplug with a new preferred mode, which KMS clients may take
vm.updateDisplaySize({ width: 1600, height: 900 });
Vulkan in the guest (browsers with WebGPU)
const vm = await createKernel({ distro: "/distros/debian.erofs", vk: true });
await vm.exec("sudo", ["apt-get", "install", "-y", "libvulkan1", "vulkan-tools"]);
const r = await vm.exec("vulkaninfo", ["--summary"]); // deviceName = kwvk (WebGPU)
The base carries a Vulkan driver (an ICD the Vulkan loader finds by
itself) that sends the guest's Vulkan calls to a renderer on the page's
WebGPU device; SPIR-V shaders become WGSL through kwvk-naga.wasm.
Nothing loads before the guest's first Vulkan program (vm.vk.status).
Vulkan 1.2 with Wayland, X11 and headless presentation (frames come back
by readback); vkcube, vkmark, SDL's GPU API and GTK 4's Vulkan renderer run
on it. Node has no WebGPU, so there vk is ignored with a log line.
vk/PROTOCOL.md has the design.
Run it in a worker
const vm = await createKernel({
worker: true,
distro, // a path or URL
net: { kind: "net", backend: { kind: "direct" } },
disks: [{ kind: "file", path: "data.img" }],
});
The kernel runs in a worker thread or Web Worker, with the same API. Disks
and the network are given as specs, which the worker builds: { kind: "file", path } on Node, { kind: "http", url } and { kind: "data", template: "bundled" } in browsers. Input and frames go through shared
memory when it is available (vm.transport says). This mode is
experimental.
An SMP kernel (a bundle with the SMP patch) boots on several CPUs with
cpus: 4, each CPU in a thread of its own on one shared memory. In
browsers that needs a cross-origin isolated page and worker: true,
because a CPU blocks while it waits for another, which a page's main
thread may not; webCpuBlocker() says why it cannot, and
vm.stats().cpus how many CPUs the kernel got.
On a server, worker: true keeps the event loop free at no cost in speed,
and cpus: 4 gets most of what more CPUs give (about 3x on parallel work;
8 or 16 add little, and each CPU adds to boot time and takes 9 MiB of
guest memory). node test/profile.ts measures your host, and the page's
/profile.html a browser.
Boot options and helpers
import { checkSupport, ConsoleRouter, createKernel } from "unkernel";
const support = await checkSupport(); // JSPI and the rest, before you boot
if (!support.ok) throw new Error(support.problems.join("\n"));
const vm = await createKernel({
kernel: "./my-kernel.wasm", // a URL, bytes, a Response or a WebAssembly.Module
initrd: "./initramfs.cpio.gz", // null: none
cmdline: "console=hvc0 rdinit=/init",
memoryMiB: 1024,
jit: false, // interpreter only
onProgress: (p) => console.log(p.stage),
});
const router = new ConsoleRouter({ // kernel log lines apart from program output
onKernelLine: (line, { important }) => important && console.warn(line),
onUserOutput: (text) => process.stdout.write(text),
});
vm.onOutput((bytes) => router.write(bytes));
The SDK has some limits, on top of the kernel's known
limits. There is no guest agent beyond terminal sessions, so
you drive the guest through a terminal or its console, or over vsock with your
own program. stop() doesn't shut the guest down cleanly, so prefer
poweroff. Only one kernel can run per thread. Types ship as .d.mts and use
the DOM's WebAssembly types, so a Node-only TypeScript project needs "lib": ["dom"] or skipLibCheck.
🛠️ Building from source
You need Linux (x86-64 or arm64), Zig 0.16, Node 24, clang 21+ with the
wasm target, and the usual build tools. ./setup.sh --check lists what's
missing. The first build takes about 12 minutes, most of it spent on a
patched wasm-ld, and uses 5 GiB of disk.
./setup.sh # check, then build everything
node js/cli.ts # boot your build (Alpine from vendor/build/distro/)
pnpm install && pnpm dev # the web page at http://localhost:8080
zig build test # emulator tests
The build makes the kernel bundle vendor/build/bundle/unkernel.wasm and
the distro images vendor/build/distro/{alpine,debian}.erofs with their
index distros.json; a source checkout uses those and never downloads
them. guest/README.md describes the base system and how
to add a distro.
kernel/README.md maps the kernel directory and its build steps. AGENTS.md and .agents/ hold the contributor notes: the kernel, its devices and the guest image, invariants, workflows, which tests to run, and the roadmap.
🙏 Credits
Made with ♥ by Pooya Parsa (pi0), sponsored by ▲ Vercel.
Thanks to:
- Kernarium, for the idea: a native kernel with emulated user space behind a software MMU.
- linux-wasm by Joel Severin,
for the
arch/wasmport this kernel grew from, the wasm-ld linker-script patches and the Kbuild toolchain wrapper. - iSH and v86, for showing how to build a fast user-mode emulator and a wasm JIT.
- virglrenderer and Mesa, for guest GL: Mesa's virgl driver in the guest, and virglrenderer compiled to wasm with Emscripten, rendering on WebGL2 in the page.
- Alpine Linux and Debian, the distributions it boots, packed with erofs-utils, LZ4 and Zstandard.
- wland, the Wayland compositor that brings the guest's windows to the page, and wterm, the page's terminals.
- Zig, LLVM and Binaryen, which build it; React, Tailwind CSS, Vite, Nitro and the Geist fonts, which make the page.
- Wisp, the protocol behind the guest's network in the browser.
📄 License
Everything is open source: the kernel patches, the emulator and its JIT,
the patched linker, the SDK and the page. ./setup.sh rebuilds the kernel
file from source.
The project is GPL-2.0-or-later (LICENSE) unless a file says
otherwise. The JavaScript SDK and page (js/, web/, SDK tests) are MIT
(LICENSE-MIT), so you can embed them anywhere.
The npm package ships a Linux kernel (GPL-2.0) with a small base system
(Alpine's static busybox, GPL-2.0, and unkernel's own tools), so it is MIT AND GPL-2.0-only. It also ships the guest GL renderer (virgl.wasm:
virglrenderer and Emscripten's runtime, MIT, with unkernel's glue,
GPL-2.0-or-later) and the guest Vulkan translator (kwvk-naga.wasm: naga
and its Rust dependencies, MIT or Apache-2.0, with unkernel's glue,
GPL-2.0-or-later). THIRD-PARTY.md, in the package and on
the page at /licenses.md, lists what is not unkernel's, with the notices
its licenses ask for. The distro images it downloads hold the distributions'
packages, which keep their own licenses. The
kernel's source is Linux 7.3.4 plus
kernel/patches/linux (arch/wasm is based on
linux-wasm's). Those patches and
kernel/tools/fake-llvm are GPL-2.0-only, and the patches in
kernel/patches/llvm follow LLVM's license (Apache-2.0 WITH
LLVM-exception).