<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dylan Wong on Medium]]></title>
        <description><![CDATA[Stories by Dylan Wong on Medium]]></description>
        <link>https://medium.com/@dylanwong007?source=rss-ab981653959------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lk6D1Y5Sg12o3CgupaEYrw.jpeg</url>
            <title>Stories by Dylan Wong on Medium</title>
            <link>https://medium.com/@dylanwong007?source=rss-ab981653959------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:08:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dylanwong007/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Run untrusted Linux programs and containers safely, with no Virtualization, on Linux, macOS, and…]]></title>
            <link>https://medium.com/@dylanwong007/run-untrusted-linux-programs-and-containers-safely-with-no-virtualization-on-linux-macos-and-f72fcc4a43e7?source=rss-ab981653959------2</link>
            <guid isPermaLink="false">https://medium.com/p/f72fcc4a43e7</guid>
            <dc:creator><![CDATA[Dylan Wong]]></dc:creator>
            <pubDate>Thu, 26 Nov 2026 23:37:07 GMT</pubDate>
            <atom:updated>2026-11-26T23:37:33.938Z</atom:updated>
            <content:encoded><![CDATA[<h3>Run untrusted Linux programs and containers safely, with no Virtualization, on Linux, macOS, and Windows.</h3><p>I present you a project called <a href="https://github.com/samyfodil/laboon.git">Laboon</a>.</p><p>Laboon is a giant majestic whale in the One Piece series. It is a word play on Docker’s Moby (Their mascot a big blue whale)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kMeaCblFvEbibNbXpcGdVA.png" /></figure><p>Laboon is a fundamentally different approach compared to traditional containerization as-well as virtual machines.</p><p>Containers inherently do not “contain” or prevent escapes from the runtime. They are built to pack and ship code in a standard universal unit (a tarfile layering the different binaries and dependencies with verifiable immutability) like a shipping container.</p><p>But a shipping container isn’t the same thing as a safe or vaulted lock box being moved in armored transport.. <br>Laboon runs unmodified Linux Binaries and OCI Container Images with the guests machine code executing natively on host CPU. It intercepts syscall instructions similarly to gVisor with some fundamentaly differences. They both run in userspace, however Laboons syscall wrapping can be extended to library OS style functions. Laboon is written in go and zig. This allows for much better performance over gVisor along with compatiability across Windows, MacOS and Linux. ARM 64, x86 64 and Apple Silicone ARM 64 Darwin.</p><p>The distinction is the execution boundary, not a security ranking. laboon combines supervisor mediation with a host-OS backstop. Docker on Linux shares the host kernel; on macOS and Windows its Linux VM supplies another boundary. Choose according to the workload and the boundary you need.</p><p>You can even run full performant XFCE Linux Desktops on a MacOS with no need for a virtual machine unlike Apple Containers (nano-micro vms) and Docker/Podman on Mac or Windows which also uses an underlying virtual machine to run Linux Containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*94FfzqXdUFzlyE8ZMjlaJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h9wqw3ukAKeD2XabVZAURA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f72fcc4a43e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bringing the [RFC PATCH 00/73] PVM to Linux 7.1]]></title>
            <link>https://medium.com/@dylanwong007/%EF%B8%8F-anatomy-of-a-9-hop-kernel-rebase-bringing-pvm-to-linux-7-1-de0c04915a6f?source=rss-ab981653959------2</link>
            <guid isPermaLink="false">https://medium.com/p/de0c04915a6f</guid>
            <dc:creator><![CDATA[Dylan Wong]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 03:41:25 GMT</pubDate>
            <atom:updated>2026-08-26T05:39:31.194Z</atom:updated>
            <content:encoded><![CDATA[<p>Pagetable Virtual Machines power Alibaba Cloud’s infrastructure ; securing millions of containers and MicroVMs for customers World Wide. However, their current PVM implementation is closed source, with only the 6.12/6.13 RFC Patch they had provided in 2024.</p><p>Building a custom hypervisor engine is grueling work. Moving it across three years of rapid, upstream open-source development is a whole different level of engineering.</p><p>My custom Pagetable Virtual Machine (PVM) module was happily humming along on top of Linux Kernel 6.12. But to future-proof our architecture, I decided to push our custom codebase all the way to <strong>Linux Kernel 7.1</strong>.</p><p>This was tested on multiple CPU types (4th Gen AMD EPYC™ Bergamo,3rd Gen AMD EPYC™ Milan, Intel Xeon® Platinum 8255C, Intel Xeon® E5–2667v4) all across real virtual machine instances and qemu environments for other benchmarking and testing purposes.</p><h3>The business value of my upgrades to the PVM RFC:</h3><p>1. <strong>More deployment flexibility.</strong><br> MicroVM workloads could run on standard cloud VMs instead of needing special instance types, you could secure containers using Kata Containers and MicroVMs.</p><p><strong>2. Lower infrastructure friction.</strong><br> Teams would not need to wait for nested virtualization support or buy bare metal.</p><p><strong>3. Potential cost optimization.</strong><br> If microVMs can run on commodity instances, customers may avoid more expensive specialized infrastructure.</p><p><strong>4. Better portability.</strong><br> The same Firecracker-based architecture could potentially work across cloud environments where KVM is restricted.</p><h4>Upgrading through 9 semvers of the Linux Kernel</h4><p>This wasn’t a standard version to version upgrade. I had to guide my custom code through a massive, repetitive, monotonous and meticulous <strong>9-hop incremental rebase chain</strong> (6.13 → 6.14 → 6.15 → 6.16 → 6.17 → 6.18 → 6.19 → 7.0 → 7.1). Along the way, I ran face-first into major architectural overhauls, security hardening, and internal API purges.</p><p>Here is exactly how I engineered my way through the drift.</p><p>🔀 Why a 9-Hop Chain Beats a One-Shot Rebase</p><p>When faced with a massive version gap, the temptation is to do a giant leap: git rebase v6.12 v7.1. <strong>Don&#39;t do it.</strong> A one-shot rebase across multiple major subsystems is a recipe for silent regression nightmare. If you jump straight from 6.12 to 7.1, you are trying to resolve hundreds of API changes simultaneously. A single &quot;take-ours&quot; merge blunder can quietly delete your custom feature code, and you won&#39;t catch it until compile-time—or worse, at runtime with a Kernel Panic.</p><p>Instead, I chose a <strong>sound, incremental 9-hop migration path</strong>.</p><p>By rebasing the 98 custom commits onto each individual stable base one release at a time, I isolated the exact moment every upstream API evolved.</p><ul><li><strong>The Power of </strong><strong>git rerere:</strong> By working step-by-step, Git&#39;s <em>Reuse Recorded Resolution</em> (rerere) tool automatically learned how I resolved redundant backports (like my custom per-CPU and PIE code that mainline eventually adopted).</li><li><strong>Clean Code History:</strong> If a build broke, I didn’t have to guess which of the 15 altered KVM headers caused it. We knew exactly which version introduced the change. The result? A perfectly clean, historical commit chain with zero conflict markers.</li></ul><p>🛑 The 7.1 Porting Conflict: Defeating the __switch_to Optimization</p><p>The most dangerous bottleneck I faced was a silent data-corruption trap hidden inside the kernel’s thread switching logic (arch/x86/kernel/process_64.c).</p><p>My virtual machine runs on an Intel Xeon E5 processor, but the cloud hypervisor masks out hardware virtualization handles. Because of this, the guest environment lacks native access to modern CPU flags like FSGSBASE and RDTSCP. To work around this, my customPVM engine intercepts user-space instruction faults (#UD) and utilizes a manual, paravirtualized fallback hypercall (PVM_HC_WRMSR) to handle critical Thread-Local Storage (TLS) adjustments.</p><p>Then came Linux 7.1.</p><p>To wring out every drop of performance, Linux 7.1 introduced an aggressive caching optimization inside the legacy segment loader (load_seg_legacy). When a task switches and the kernel calculates that the upcoming thread&#39;s base address is zero (next_base == 0), <strong>it completely skips writing to the hardware MSR_FS_BASE register.</strong> It assumes a standard hardware selector-load side effect will handle it.</p><ul><li><strong>The Problem:</strong> Because my PVM guest updates the thread base via software hypercalls without the host’s physical hardware awareness, this skip-optimization means the host CPU completely bypasses the register update. The host side stays stale, resulting in immediate, catastrophic thread-local storage corruption.</li><li><strong>My Solution:</strong> We modified the kernel’s low-level context switcher to check for thespecific guest capability flag (X86_FEATURE_KVM_PVM_GUEST). We forced PVM guests entirely onto the explicit-write pathway, breaking the cache optimization when the engine requires a true state sync. It actually was not too hard to bring PVM to 7.1 , however adding support without FSGSBASE and RDTSCP was much harder to bridge to 7.1. I had initially begun with using PVM on 6.x along with my instruction set modifications. In total; it took around 5–6 days to bridge 6.x to 7.1 with majority of the focus being on the instruction set migrations. The main issues</li></ul><p>Conceptually, here is the architecture of the patch we injected into process_64.c:</p><pre>/* arch/x86/kernel/process_64.c */<br> static __always_inline void load_seg_legacy(unsigned int seg, unsigned long next_base)<br> {<br>+       /* <br>+        * PVM GUEST HARDWARE OVERRIDE: <br>+        * If running as a paravirtualized PVM guest without native FSGSBASE,<br>+        * we cannot rely on hardware selector side-effects. Force the explicit write path.<br>+        */<br>+       if (static_cpu_has(X86_FEATURE_KVM_PVM_GUEST)) {<br>+               this_cpu_write(old_tls_desc_index, 0); // Invalidate 7.1&#39;s segment cache<br>+               wrmsrq(MSR_FS_BASE, next_base);       // Force physical register sync<br>+               return;<br>+       }<br>+<br>        if (next_base == 0) {<br>                /* 7.1 Skip-Optimization: Rely on hardware selector load */<br>                loadsegment(fs, seg);<br>        } else {<br>                /* Explicit fallback write path */<br>                wrmsrq(MSR_FS_BASE, next_base);<br>        }<br> }</pre><p>📦 Smashed Bugs &amp; Internal KVM Overhauls</p><p>Beyond the thread scheduler, Linux 7.1 completely reshaped the internal KVM subsystem to clear out legacy code. I mapped out and crushed a checklist of deep architectural mismatches to get the code to compile cleanly:</p><p><strong>1. MSR Framework Hardening</strong></p><p>To prevent speculative security exploits, raw internal setters like __kvm_set_msr were made static. I had to refactor the driver to pack register state into the new struct msr_data format and route them through the exported filter wrappers:</p><pre>/* arch/x86/kvm/pvm/pvm.c */<br>void pvm_inject_guest_msr_write(struct kvm_vcpu *vcpu, u32 msr_idx, u64 raw_data)<br>{<br>    struct msr_data msr;<br>    <br>    /* Wrap raw registers into the strict 7.1 structural payload */<br>    msr.index = msr_idx;<br>    msr.data = raw_data;<br>    msr.host_initiated = false;<br>/* Route through the modern exported common handler */<br>    kvm_set_msr_common(vcpu, &amp;msr);<br>}</pre><p><strong>2. The Great 486 Purge &amp; MMU Drift</strong></p><p>Linux 7.1 deleted over 140,000 lines of old 32-bit 486 compatibility code. This structural spring-cleaning completely rearranged the internal memory management files (mmu.c). Legacy definitions like HOST_ROOT_LEVEL were integrated into the core x86 paging infrastructure, forcing me to rebuild my 5-level paging maps (la57) to align cleanly with 7.1&#39;s modern page table descriptors.</p><p><strong>3. Namespace Encapsulation</strong></p><p>Generic symbol exports like EXPORT_SYMBOL_GPL were locked down for guest page physical caches (pfncache.c). To prevent out-of-tree leaks, I then transitioned the symbol bindings over to the newly required internal subsystem macro:</p><pre>/* arch/x86/kvm/pfncache.c */<br>- EXPORT_SYMBOL_GPL(kvm_gpc_refresh);<br>+ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_gpc_refresh);</pre><h3>Why upgrade when there is LTS for 6.12/6.13 until 2029?</h3><p>The upgrade isn’t necessarily a security or CVE factor; its the broad updates over the last 2 years that have also included long awaited core primitives to the GNU/Linux Operating System’s kernel.</p><p>One can spawn Virtual Functions (VFs) instantly through the sysfs configuration layout without even needing to reboot.</p><h4><strong>Forward-porting PVM from Linux 6.12 to 7.1 — including hosts without FSGSBASE/RDTSCP</strong></h4><p>How we moved the Pagetable-based Virtual Machine (PVM) hypervisor from its 6.12.33 base onto mainline Linux 7.1, got a Firecracker microVM to boot a full Ubuntu guest end-to-end on a nested cloud host that lacks `FSGSBASE` and `RDTSCP`, and root-caused the one remaining host crash to a Spectre-v2 RSB mitigation.*</p><p><strong>TL;DR</strong></p><ul><li><strong>**Result:**</strong> a stock Linux <strong>**7.1**</strong> kernel + `kvm-pvm.ko` boots a Firecracker microVM to a full Ubuntu 24.04 userspace (multi-user/graphical target, SSH, root shell) — `RESULT_GUEST_UP=1` — on a Tencent CVM host whose CPU has <strong>**neither FSGSBASE nor RDTSCP**</strong>.</li><li><strong>Strategy: </strong>incremental, one stable release at a time (6.12 → 6.13 → … → 7.1), build-and-fix at every hop, never a single 9-release jump.</li><li><strong>Three classes of work:</strong> (1) mechanical conflict resolution, (2) compile-driven KVM/entry <strong>**API-drift**</strong> fixes, (3) two <strong>**runtime**</strong> bugs that no amount of static diffing would have revealed.</li><li><strong>No-FSGSBASE/RDTSCP support:</strong> the switcher reads/writes GS base via MSRs and emulates `RDTSCP`, gated on CPU feature detection so it is a no-op on capable CPUs.</li><li><strong>The last crash was a mitigation, not a bug:</strong> an `int3` in the switcher’s RSB-stuffing was the Spectre-v2 `FILL_RETURN_BUFFER` interacting with this nested CPU’s non-architectural RSB-underflow behavior. Booting the host with</li><li><strong>spectre_v2=off </strong>removes exactly that and keeps MDS/TAA/MMIO/L1TF active. The complete patch is `pvm-6.12-to-7.1-complete.patch`; the reviewable per-commit series is `0001-*.patch … 0110-*.patch`.</li></ul><p><strong>— -</strong></p><h3><strong>Why is the port objectively “hard”?</strong></h3><p>PVM (Pagetable-based Virtual Machine) is an out-of-tree, KVM-style hypervisor that runs a guest <strong>without hardware virtualization (VMX/SVM)</strong>. Instead of VM-entry/exit it uses a hand-written <strong>software “switcher”</strong> (smod/umod transitions in arch/x86/entry/entry_64_switcher.S) plus a shadow MMU, and it exposes the familiar `/dev/kvm` ioctl surface so an unmodified VMM like Firecracker can drive it.</p><p>That design is exactly what makes a forward-port painful: PVM is 131 commits on top of e03ced99c437 (“Linux 6.12.33”), 139 files, and it lives in the two most churn-prone areas of the kernel — the x86 <strong>entry </strong>asm and the KVM x86 core. Every stable release reshuffles those, so a port is not “apply a patch,” it is “re-derive the patch against a moving target.”</p><p><strong>— -</strong></p><p><strong>## Strategy: incremental hops, build at every step</strong></p><p>We tried the seductive shortcut first — a single heuristic rebase from 6.14 straight to 7.1 — and it was lossy: a take-ours/union auto-resolver silently <strong>**dropped**</strong> PVM additions on shared files and <strong>**duplicated**</strong> others. Applies clean, won’t compile, and worse, <em>*compiles but misbehaves*</em>. The reliable method was boring and incremental:</p><pre>port-6.13 (131) → 6.14 (128) → 6.15 (113) → 6.16 (113) → 6.17 (112) → 6.18 (112) → 6.19 (111) → 7.0 (110) → 7.1 (100 commits)</pre><p>At each hop:</p><p>1. `git rebase — onto vN &lt;pvm-base&gt; &lt;branch&gt;` and resolve conflicts. The vast majority were <strong>**scaffolding**</strong> (PIE/objtool/percpu/relocation series that have since landed upstream) — those resolve to “take upstream.” A handful were real PVM-core collisions that needed hand-merging.</p><p>2. <strong>**Build it.**</strong> This is the step the big-jump skips and it is the whole game. Most bugs are <em>*silent API drift*</em>: the patch applies cleanly but the kernel’s function signatures moved underneath it. A few representative API-drift fixes, to give the flavor:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2FBkZEv%2F1%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2FBkZEv%2F1%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2FBkZEv%2Fplain-s.png%3Fv%3D1&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="542" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcbd371f77af90efc3feeaa700c0aa15/href">https://medium.com/media/dcbd371f77af90efc3feeaa700c0aa15/href</a></iframe><h4><strong>The KVM module-export overhaul (7.1’s biggest structural blocker)</strong></h4><p>7.1 made KVM’s symbol exports <strong>**namespaced to a whitelist of module names**</strong>.</p><pre>`EXPORT_SYMBOL_FOR_KVM`/`_INTERNAL` expands to `EXPORT_SYMBOL_FOR_MODULES<br>(sym, &quot;module:kvm,&lt;subs&gt;&quot;)`, and the whitelist (`KVM_SUB_MODULES`)<br> is computed *only* from `KVM_AMD`/`KVM_INTEL`. <br><br>With only `KVM_PVM=m` and neither vendor module built, vmlinux emitted **zero** KVM<br>exports - so `kvm.ko`/`kvm-pvm.ko` had ~13 undefined symbols<br>(`fpu_swap_kvm_fpstate`, `xfer_to_guest_mode_handle_work`, the gpc helpers…).</pre><p><strong>**Fix:**</strong> register `kvm-pvm` as a third vendor sub-module in</p><p>`arch/x86/include/asm/kvm_types.h` (enumerate all AMD/INTEL/PVM combos), and move PVM’s gpc users to `EXPORT_SYMBOL_FOR_KVM_INTERNAL`. That single registration cleared the entire first wave of link errors. Then seven PVM-specific undefined symbols, all from forward-port drops:</p><p>- `switcher_enter_guest` / `entry_SYSCALL_64_switcher` — the switcher object was never re-added to `arch/x86/entry/Makefile`.</p><p>- `idt_do_{interrupt,nmi}_irqoff` — 7.1 commit `0701c9e17bd9` made these entry internals and introduced the exported wrapper `x86_entry_from_kvm(EVENT_TYPE_…, vector)`; PVM now calls the wrapper.</p><p>- `kvm_handle_hypercall` — the whole PVM function was dropped from `x86.c`; re-added against 7.1’s <strong>**deferred-completion**</strong> hypercall API (`____kvm_emulate_hypercall(vcpu, cpl, complete_cb)`).</p><p>On x86–64, 7.1 routes the external-interrupt-from-KVM path through `fred_entry_from_kvm()` — a <em>software</em> FRED-frame dispatcher whose asm (`entry_64_fred.o`) is built only under `CONFIG_X86_FRED`. So a KVM x86–64 build now needs `CONFIG_X86_FRED=y`, and we extended six. `#if IS_ENABLED(CONFIG_KVM_INTEL)` gates to `|| IS_ENABLED(CONFIG_KVM_PVM)`.</p><p>This is safe for PVM: FRED is runtime-detected; with `fred=off` or on a non-FRED CPU the FRED dispatch tables are just used as a software interrupt-dispatch path, and PVM’s “no real FRED” requirement still holds.</p><h3>Who the hell is FRED?</h3><p><strong>FRED (Flexible Return and Event Delivery)</strong> is an advanced CPU feature designed by Intel to replace the old Interrupt Descriptor Table (IDT). A <strong>FRED-frame dispatcher</strong> refers to the software framework inside an operating system kernel (like <a href="https://lwn.net/Articles/919210/">Linux</a> or custom hobby OSs) that intercepts hardware events and routes them using a highly optimized memory structure. [<a href="https://docs.kernel.org/arch/x86/x86_64/fred.html">1</a>, <a href="https://lwn.net/Articles/919210/">2</a>, <a href="https://www.eejournal.com/article/we-interrupt-this-program/">3</a>, <a href="https://www.phoronix.com/news/Intel-FRED-Linux-Patches">4</a>]</p><p>Instead of using legacy, slow hardware routines to jump into interrupts or system exceptions, FRED streamlines how the CPU switches between regular user programs (Ring 3) and the operating system kernel (Ring 0). [<a href="https://lwn.net/Articles/919210/">1</a>, <a href="https://www.hwcooling.net/en/performance-boost-for-intel-cpus-impact-of-fred-measured/">2</a>]</p><p><strong>— -</strong></p><p><strong>## Running on a host without FSGSBASE and RDTSCP</strong></p><p>The target host is itself a nested guest (Tencent Cloud CVM, Bochs BIOS) and its vCPU exposes <strong>**neither `FSGSBASE` nor `RDTSCP`**</strong>. PVM’s switcher normally uses `{RD,WR}{FS,GS}BASE` to swap the guest/host GS base on every transition, and `RDTSCP` to read the CPU index — both unavailable here.</p><p>The no-FSGSBASE/RDTSCP support (carried as a discrete commit in the series, <em>*”run PVM on hosts without FSGSBASE/RDTSCP”*</em>) does two things, both gated on runtime CPU-feature detection so capable CPUs keep the fast path:</p><p>- <strong>**GS-base via MSR:**</strong> where the switcher would `RD/WRGSBASE`, fall back to `rdmsrq/wrmsrq(MSR_GS_BASE / MSR_KERNEL_GS_BASE)`. The host boots and prints the PVM “MSR-gsbase fallback” notice.</p><p>- <strong>**RDTSCP emulation:**</strong> read the TSC and synthesize the aux/CPU-index value the guest expects rather than executing `RDTSCP`. Required host cmdline for this CPU: `pti=off fred=off` (PTI’s per-CR3 trampoline and FRED both conflict with the switcher’s hand-rolled transitions), plus the mitigation flag discussed below.</p><p><strong>— -</strong></p><p><strong>## The two runtime bugs static analysis could never find</strong></p><p>With the module compiling and loading (`/dev/kvm` live), the first real guest run exposed two bugs that had nothing to do with conflict markers.</p><p><strong>### Bug 1 — Guest MSR hypercalls routed to the wrong handler</strong></p><p>The guest’s very first job in `pvm_early_setup()` is to publish its <strong>**PVCS** </strong>(per-vCPU shared structure) by writing `MSR_PVM_VCPU_STRUCT`. That write is a paravirt op → a PVM hypercall → the host’s `handle_hc_wrmsr`.</p><p>7.1 removed the public `kvm_{get,set}_msr`, and the forward-port had wrapped the <strong>**common**</strong> handlers (`kvm_{get,set}_msr_common`) directly. But the common handler doesn’t know the PVM virtual MSRs — so the PVCS write was **silently dropped**. With no PVCS, events were undeliverable; the guest wedged in a multi-million-iteration page-fault loop before it ever finished early boot.</p><p>In 6.12 this worked only because it went through `kvm_set_msr` → `static_call(kvm_x86_set_msr)` → <strong>**`pvm_set_msr`**</strong>, which <em>*does*</em> know the PVM MSRs and falls through to the common handler for everything else.</p><p><strong>**Fix**</strong> (`arch/x86/kvm/pvm/pvm.c`):</p><pre>- int r = kvm_get_msr_common(vcpu, &amp;msr);<br>+ int r = pvm_get_msr(vcpu, &amp;msr);<br>- return kvm_set_msr_common(vcpu, &amp;msr);<br>+ return pvm_set_msr(vcpu, &amp;msr);</pre><p>This got the guest from “dead at the first early `#PF`” all the way into `setup_arch`/PCI enumeration.</p><p><strong>**Debugging technique that cracked it:**</strong> printk is lost in the switcher’s atomic context, so we used <strong>**crash-survivable `module_param` counters**</strong> read from `/sys/module/kvm_pvm/parameters` — they survive a host panic and a kdump. A single counter (`setpvcs_calls == 0`) proved the PVCS write never arrived.</p><p><strong>### Bug 2 — The VMM’s register frame was clobbered by the guest</strong></p><p>With PVCS working, the guest ran deep into `setup_arch` and then **Firecracker itself** died with `SIGSEGV` — at a <em>*guest*</em> RIP, in its own address space. The host kernel never faulted. And it only happened on the **first exit that unwinds back to userspace**: the guest’s PCI-config port I/O (`out 0xcf8`) → `KVM_EXIT_IO`.</p><p>Root cause: the switcher loads guest <strong>**entry**</strong> registers from the sp0 (`cpu_entry_area`) stack, but a guest <strong>**exit**</strong> lands its frame in `task_pt_regs(current)` — the <em>*same*</em> frame the VMM saved when it called `ioctl(KVM_RUN)`, and the frame the syscall-return path restores from. So once the guest runs, `task_pt_regs` holds <strong>**guest**</strong> state. Harmless while exits are handled in-kernel and re-entered — fatal the instant one unwinds to userspace: the syscall return resumed Firecracker at the guest’s RIP/RSP.</p><p><strong>*Fix**</strong> (`pvm_vcpu_run_noinstr`): save the VMM frame before the run, restore it after `save_regs()` has pulled the guest exit state into `vcpu-&gt;arch.regs`. The next entry’s `load_regs()` re-materializes the guest registers, so it is lossless:</p><pre>struct pt_regs *vmm_regs = task_pt_regs(current);<br>struct pt_regs host_vmm_regs = *vmm_regs; /* before the run */<br>*vmm_regs = host_vmm_regs; /* after save_regs() */</pre><p><strong>**Debugging technique:**</strong> `systemd-coredump` was configured `Storage=none`, so we ran Firecracker <strong>**under gdb in batch mode**</strong>, passing through `SIGRTMIN` (34 — Firecracker uses it to kick vCPUs) and stopping on `SIGSEGV`. The backtrace showed RIP at a <em>*guest*</em> address; an in-kernel probe confirmed `task_pt_regs(current)-&gt;ip == guest rip` at the `KVM_EXIT_IO` point.</p><p>With both fixes, the microVM boots end-to-end:</p><pre>RESULT_DEVKVM=PRESENT<br>GUEST_UP=1<br>guest reachable after 2s (ping + SSH)<br>GUEST_UNAME=Linux ubuntu-fc-uvm 6.12.33+ … x86_64 GNU/Linux<br>GUEST_BOOT_OK=1<br>RESULT_GUEST_UP=1</pre><p><strong>— -</strong></p><p><strong>## The last crash: an `int3` that was actually a Spectre-v2 mitigation</strong></p><p>One host crash remained, and it was the most instructive of all. On a guest’s userspace-exit roundtrip the host would `Oops: int3` at `switcher_return_from_guest+0x18` — inside the `FILL_RETURN_BUFFER`/ `MITIGATION_ENTER` <strong>**RSB-stuffing**</strong> sequence. The smoking gun: at the trap, `RCX = 0x7ffffffff000` (the canonical-address mask) — <strong>**not**</strong> the stuffing loop’s own `mov $0x10, %rcx` counter. That means a `RET` **underflowed the RSB and landed on a stuffed `int3` speculation trap** — architecturally, not speculatively.</p><p>We exhausted the configuration hypotheses one controlled boot at a time. Everyone was <strong>**exonerated**</strong> (the crash was byte-for-byte identical with each disabled): call-depth tracking (`retbleed=off`), VMSCAPE, TSA, the PREEMPT model, ITS. The switcher asm and the host syscall entry/exit were verified</p><p><strong>**byte-identical**</strong> to the working 6.12 build, and the runtime mitigation states matched. So the `int3` is not a <em>*code*</em> divergence — it is a build-level</p><p><strong>**RSB-underflow**</strong> artifact: 7.1’s surrounding C/idtentry path drains the RSB slightly differently, and on this **nested Bochs CPU the RSB-underflow behavior is hypervisor-defined**, not architectural.</p><p>The `int3` <em>*is*</em> the RSB-VMEXIT mitigation. So the cure is to stop stuffing the RSB at vmexit — and the narrowest knob that does exactly that is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFBG8ZMv4Lvz6AH8pDZqmg.png" /></figure><p>`spectre_v2=off` makes `FILL_RETURN_BUFFER` inert (the int3 source disappears) while leaving every other mitigation on — strictly better than the blunt `mitigations=off`. After the boot, `…/vulnerabilities/spectre_v2` reads <em>*Vulnerable*</em> while `…/mds` still reads <em>*Clear CPU buffers attempted*</em>.</p><p>This is a defensible posture here specifically because **the host is itself a nested guest**: real speculative isolation is governed by the L0 hypervisor, so host-level Spectre-v2 RSB stuffing was largely theoretical to begin with. Final host cmdline: `pti=off fred=off spectre_v2=off`.</p><p><strong>— -</strong></p><p><strong>## What’s in the deliverable</strong></p><p>- <strong>**`pvm-6.12-to-7.1-complete.patch`**</strong> — one unified diff that applies the entire PVM stack (feature + no-FSGSBASE/RDTSCP + all forward-port and runtime fixes) onto a clean upstream <strong>**v7.1**</strong> tree.</p><p>- <strong>**`0001-*.patch … 0110-*.patch`**</strong> — the same work as a reviewable, bisectable commit series. `0001–0093` are the PVM feature rebased onto 7.1; `0094–0110` are the forward-port-specific commits, ending with the two runtime fixes.</p><p><strong>### Build &amp; boot</strong></p><pre># from a clean v7.1 source tree<br>git am 00*.patch # or: patch -p1 &lt; pvm-6.12-to-7.1-complete.patch<br># config: x86_64 + KVM_PVM=m, vendor KVM off, FRED on<br>scripts/config -e KVM -m KVM_PVM -d KVM_INTEL -d KVM_AMD -e X86_FRED<br>make -j&quot;$(nproc)&quot; bzImage modules &amp;&amp; make modules_install<br># host cmdline (CPU without FSGSBASE/RDTSCP):<br># pti=off fred=off spectre_v2=off</pre><p>`kvm-pvm.ko` builds clean (only a cosmetic `MODULE_DESCRIPTION` warning), loads on the running 7.1 host, and `/dev/kvm` comes up. A stock Firecracker then boots a full Ubuntu guest.</p><p><strong>— -</strong></p><p><strong>## Lessons</strong></p><p>1. **Forward-porting churny subsystems = textual merge + compile-driven API-repair + runtime debugging.** Skipping any layer just defers the cost.</p><p>2. <strong>**Build at every hop.**</strong> The big-jump heuristic trades correctness for speed and you pay it back with interest in silent breakage.</p><p>3. <strong>**When printk is dead, persist state somewhere a panic can’t erase**</strong> — `module_param` counters in `/sys`, kdump vmcores, gdb-on-the-VMM. The two runtime bugs were <em>*only*</em> findable this way.</p><p>4. **Sometimes the “bug” is a mitigation meeting an environment its model didn’t anticipate.** The `int3` was correct mitigation code colliding with a nested CPU’s non-architectural RSB behavior; the right fix was a scoped policy knob, not a code change.</p><h3>How I am actively using my 7.1 PVM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ypR3VpiTxYD5xPmnd-0xTw.png" /><figcaption>The constellation of Virtual Machine Nodes running Kata Containers inside Firecracker MicroVMs , with gVisor systrap acting as the container runtime and sandbox boundary <em>for the </em><strong>Kata Containers</strong></figcaption></figure><p>I am experimenting with building hosted control planes inwhich a microvm is used to host that control planes workloads in a compact yet isolated manner with live migration capabilities for scaling, migration/transfer (of-course) and disaster recovery use cases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de0c04915a6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Pagetable-based Virtual Machine more practical on cloud CPUs where KVM and specific x86…]]></title>
            <link>https://medium.com/@dylanwong007/running-firecracker-on-tencent-cloud-cvm-via-x86-pvm-without-fsgsbase-or-rdtscp-a146469a802a?source=rss-ab981653959------2</link>
            <guid isPermaLink="false">https://medium.com/p/a146469a802a</guid>
            <category><![CDATA[firecrackers]]></category>
            <category><![CDATA[pagetable-virtual-machine]]></category>
            <category><![CDATA[virtualization]]></category>
            <category><![CDATA[pvm]]></category>
            <category><![CDATA[kvm]]></category>
            <dc:creator><![CDATA[Dylan Wong]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 00:59:44 GMT</pubDate>
            <atom:updated>2026-06-27T06:08:16.146Z</atom:updated>
            <content:encoded><![CDATA[<h3>Making Pagetable-based Virtual Machine more practical on cloud CPUs where KVM and specific x86 Instruction Sets are Hidden by the Cloud Provider</h3><blockquote>Running Firecracker microVMs via KVM x86/PVM without FSGSBASE or RDTSCP</blockquote><p>**Warning, this implementation relies on Kernel Version 6.12, I am currently working on a migration to 7.1 for things like native NTFS**</p><p>Pagetable-based Virtual Machine, usually shortened to <strong>PVM</strong> or <strong>KVM x86/PVM</strong>, is one of the more interesting virtualization directions in the Linux/KVM ecosystem because it targets a real deployment gap: running VM-style isolation when normal hardware-assisted virtualization is not available to the workload.</p><p>Most virtualization stacks assume that the host has direct access to hardware virtualization extensions such as Intel VT-x or AMD-V. That assumption breaks down in many cloud environments. A virtual machine running inside a public cloud instance usually does not receive full access to the underlying CPU virtualization features. Nested virtualization may be disabled, unsupported, expensive, or only available on special instance types. Even when the physical CPU underneath supports a feature, the virtual CPU exposed by the cloud provider may intentionally hide that feature for compatibility, live migration, or platform consistency.</p><p>That is the class of problem PVM is interesting for.</p><p>I recently worked on an RFC patch series for <strong>KVM x86/PVM</strong> that explores a specific compatibility problem: allowing PVM to run on cloud CPUs where FSGSBASE and RDTSCP are not exposed.</p><p>The full project page, patch summary, benchmark table, reproduction notes, references, and raw RFC archive are here:</p><p><a href="https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/">https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/</a></p><p>The core idea is simple:</p><blockquote><em>Make PVM continue to work on cloud hosts that do not expose </em><em>FSGSBASE or </em><em>RDTSCP, by replacing hard CPU-feature failures with slower but functional fallback paths.</em></blockquote><p>The practical target is more ambitious:</p><blockquote><em>Boot Firecracker microVMs on a commodity cloud VM without VT-x, AMD-V, nested virtualization, or a hardware-backed host </em><em>/dev/kvm, using PVM to provide a software-backed </em><em>/dev/kvm path.</em></blockquote><p>This is not a claim that software-backed virtualization is faster than hardware virtualization. It is not. The point is portability. The point is making PVM usable on a wider class of real cloud hosts where the unmodified path fails before a guest can even boot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XY6eMu7b2s85ZSwYcnq_-A.png" /></figure><h3>Why this problem matters</h3><p>The normal Firecracker deployment model expects /dev/kvm.</p><p>That is because Firecracker is designed as a lightweight virtual machine monitor that uses Linux KVM to run microVMs efficiently. On a normal bare-metal host or a cloud instance with nested virtualization enabled, this is straightforward: the host exposes /dev/kvm, Firecracker opens it, and the guest runs through hardware-assisted virtualization.</p><p>But there are many environments where this is not true:</p><ul><li>The instance is itself already a VM.</li><li>Nested virtualization is disabled.</li><li>The cloud provider masks VMX or SVM.</li><li>The virtual CPU hides other features that kernel code expects.</li><li>/dev/kvm is absent.</li><li>The user wants microVM-style isolation but only has a commodity VM.</li></ul><p>This is where PVM becomes interesting.</p><p>PVM aims to provide a KVM-compatible virtualization path without relying on the same hardware virtualization path as VMX or SVM. That makes it relevant to secure-container, microVM, and nested-cloud scenarios where conventional nested hardware virtualization is unavailable.</p><p>However, a system like this must be robust against the kind of CPU feature masking that happens in real cloud environments.</p><p>The specific problem I hit was this:</p><pre>fsgsbase: absent<br>rdtscp:   absent</pre><p>On the target Tencent Cloud CVM host, both FSGSBASE and RDTSCP were hidden from /proc/cpuinfo.</p><p>That matters because the current PVM code treats both features as hard requirements. If the host CPU does not expose them, the PVM module refuses to load. That means PVM fails before it can create /dev/kvm, and Firecracker has nothing to use.</p><p>So the question became:</p><blockquote><em>Can PVM still run if </em><em>FSGSBASE and </em><em>RDTSCP are unavailable?</em></blockquote><p>The answer from this patch series is:</p><blockquote><em>Yes, if the fast hardware-dependent paths are preserved on capable hosts, while cloud-constrained hosts use carefully designed fallbacks.</em></blockquote><h3>The high-level result</h3><p>The RFC patch series modifies four areas:</p><ol><li>The PVM host switcher path that depends on FSGSBASE</li><li>The KVM x86 instruction emulator so it can emulate RDTSCP</li><li>The PVM capability checks and #UD path</li><li>The PVM guest kernel’s FS-base access path</li></ol><p>Together, these changes allow the target host to:</p><ul><li>Load kvm-pvm</li><li>Return rc=0</li><li>Create /dev/kvm</li><li>Soft-pass both missing feature gates</li><li>Boot a Firecracker Ubuntu 24.04 guest</li><li>Reach a guest root shell</li><li>Execute raw in-guest RDTSCP through emulation instead of crashing with SIGILL</li></ul><p>The full technical writeup is here:</p><p><a href="https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/">https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/</a></p><h3>The patch series</h3><p>The patch series is organized as four patches:</p><pre>1. x86/entry: PVM switcher gsbase switch without FSGSBASE<br>2. KVM: x86: emulate RDTSCP on #UD<br>3. KVM: x86/PVM: soft-gate FSGSBASE/RDTSCP and emulate guest user-mode #UD<br>4. x86/pvm: read/write guest FS base via hypercall without FSGSBASE</pre><p>The structure matters because there is not one single dependency on these CPU features. There are three separate places where the absence of FSGSBASE or RDTSCP matters:</p><ol><li>The PVM host switcher uses GS-base operations.</li><li>The guest vdso path may execute RDTSCP.</li><li>The PVM guest kernel uses FS-base operations.</li></ol><p>Each one needs its own fix.</p><h3>Part 1: Why FSGSBASE matters to the PVM switcher</h3><p>FSGSBASE is an x86 feature that allows direct reading and writing of the FS and GS base registers using instructions such as:</p><pre>RDFSBASE<br>WRFSBASE<br>RDGSBASE<br>WRGSBASE</pre><p>In the PVM switcher path, GS-base manipulation is important because the switcher is moving between different execution contexts. The PVM switcher uses RDGSBASE and WRGSBASE in direct switch paths to move GS base between modes without a full expensive exit path.</p><p>On a feature-complete host, that is the right fast path.</p><p>But on a host where FSGSBASE is absent, the instructions are not available. If the switcher tries to execute them anyway, the result is an invalid opcode fault.</p><p>So the first patch adds an alternate path.</p><p>The key idea is:</p><blockquote><em>Keep the fast </em><em>RDGSBASE / </em><em>WRGSBASE path when </em><em>FSGSBASE exists, but add a fallback using </em><em>MSR_KERNEL_GS_BASE when it does not.</em></blockquote><p>Because the switcher runs in host ring 0, it can manipulate GS-base state through MSRs. Specifically, the fallback uses SWAPGS plus MSR_KERNEL_GS_BASE behavior to reproduce the same architectural state that the direct FSGSBASE path would have produced.</p><p>This is the important part: the fallback is not just “make it not crash.” It must leave the CPU state in the same logical condition as the fast path.</p><p>That means preserving the correct active GS base, preserving the expected kernel GS base MSR value, and not corrupting guest state.</p><h3>Why register preservation matters</h3><p>The fallback path uses RDMSR and WRMSR.</p><p>Those instructions clobber registers such as:</p><pre>RAX<br>RCX<br>RDX</pre><p>That creates a subtle correctness issue.</p><p>In the switcher path, some of these registers carry live guest state. For example, RAX may contain a guest syscall number or return value, and RDX may contain a live syscall argument. If the fallback path overwrites them and does not restore them correctly, the VM can fail in confusing ways.</p><p>So the fallback path saves and restores the registers that need to survive the MSR access.</p><p>This is the kind of detail that matters for kernel code. A fallback that boots once but corrupts guest register state is not a real solution. The goal is for the fallback to be architecturally equivalent to the fast path, except slower.</p><p>On hosts with FSGSBASE, the original path remains the fast path. On hosts without FSGSBASE, PVM can still switch correctly using the slower MSR-based path.</p><h3>Part 2: Why RDTSCP matters to guest execution</h3><p>The second missing feature is RDTSCP.</p><p>RDTSCP is an instruction that reads the timestamp counter and also provides auxiliary information such as TSC_AUX. It is often used in fast userspace paths, including CPU identification paths.</p><p>In PVM, the guest vdso getcpu path can use RDTSCP.</p><p>That becomes a problem on a host where the virtual CPU does not expose RDTSCP.</p><p>There are two different cases to understand:</p><ol><li>The CPU feature is merely hidden in CPUID but the instruction still works.</li><li>The instruction genuinely cannot execute and raises #UD.</li></ol><p>The target case here is the second one.</p><p>On the target host, RDTSCP genuinely fails. It is not just a hidden CPUID bit. The instruction is unavailable to the guest and raises an invalid opcode fault.</p><p>If PVM reflects that #UD directly back into the guest, the guest sees an invalid opcode instead of getting a working getcpu path. That breaks the guest.</p><p>So the patch series adds a real emulator path for RDTSCP.</p><h3>Adding em_rdtscp() to the KVM x86 emulator</h3><p>KVM already has a rich x86 instruction emulator. The missing piece was that the emulator did not have the right executor for this RDTSCP case.</p><p>The patch adds an em_rdtscp() function.</p><p>Conceptually, the emulator needs to do what RDTSCP would have done architecturally:</p><pre>RDX:RAX = TSC<br>RCX     = IA32_TSC_AUX</pre><p>So the emulator reads the relevant MSR state, writes the expected destination registers, and continues guest execution.</p><p>The opcode is then marked with EmulateOnUD.</p><p>That flag matters because it tells KVM:</p><blockquote><em>If this instruction faults with </em><em>#UD, this is one of the instructions that may be emulated instead of simply being reflected back as an invalid opcode.</em></blockquote><p>This gives PVM a way to keep guest user-mode RDTSCP working even when the physical or virtualized host path cannot execute the instruction natively.</p><h3>Part 3: Routing guest user-mode #UD through handle_ud()</h3><p>Adding an emulator is not enough by itself.</p><p>The invalid-opcode fault must actually reach the KVM emulation path.</p><p>The issue in PVM is that guest user-mode #UD could be reflected directly back to the guest instead of being routed through the emulator. That means the new RDTSCP emulator would not be used for the case that matters: guest userspace executing RDTSCP.</p><p>The third patch changes this.</p><p>It routes both supervisor-mode and user-mode #UD through handle_ud().</p><p>That does not mean every invalid opcode is silently swallowed or emulated. The handler still only emulates instructions on the allowed emulation path. Everything else is reflected back as #UD, preserving normal behavior.</p><p>The important difference is that now RDTSCP, which is explicitly marked for EmulateOnUD, can be handled correctly.</p><p>This makes PVM behavior closer to the stock VMX/SVM flow, where guest #UD handling can go through the common KVM path.</p><h3>Part 4: Soft-gating FSGSBASE and RDTSCP</h3><p>The next issue is the initial module load gate.</p><p>Before these patches, PVM treated missing FSGSBASE and missing RDTSCP as hard failures. That means even if fallback support exists, the module would still refuse to load.</p><p>The patch changes these hard gates into informational messages.</p><p>Instead of saying:</p><pre>FSGSBASE missing -&gt; fail<br>RDTSCP missing   -&gt; fail</pre><p>the patched behavior is closer to:</p><pre>FSGSBASE missing -&gt; use slower MSR-based GS-base switching fallback<br>RDTSCP missing   -&gt; trap and emulate guest RDTSCP</pre><p>This is a key design point.</p><p>The patch does not pretend the missing features are free. The log messages should make clear that the fallback path is slower. But slower and correct is much better than failing to load on an otherwise useful cloud instance.</p><p>This is exactly the kind of change that matters in cloud environments. A cloud provider may mask a CPU feature for valid infrastructure reasons. A portability-oriented virtualization path should be able to degrade gracefully when possible.</p><h3>Part 5: Guest FS-base access without FSGSBASE</h3><p>There is one more FSGSBASE dependency: the PVM guest kernel itself.</p><p>The guest side uses RD/WRFSBASE for MSR_FS_BASE handling. If FSGSBASE is unavailable, the guest can fail very early in boot with an invalid opcode.</p><p>The fourth patch gates guest FS-base operations on X86_FEATURE_FSGSBASE.</p><p>The logic is:</p><pre>if FSGSBASE exists:<br>    use RDFSBASE / WRFSBASE<br>else:<br>    use PVM hypercall path for RDMSR / WRMSR</pre><p>The fallback uses the existing PVM hypercall mechanism:</p><pre>v</pre><p>This is the same broad idea as the host fallback: preserve the fast path on capable hardware, but provide a slower path when the feature is unavailable.</p><p>Again, the point is not to make the fallback faster than the native instruction. It will not be. The point is to prevent guest boot from dying just because the outer cloud hypervisor masked FSGSBASE.</p><h3>Why this is useful for Firecracker</h3><p>Firecracker normally wants KVM.</p><p>That is one of the reasons this project is interesting. If PVM can provide /dev/kvm on a host where normal hardware-backed KVM is unavailable, then Firecracker can potentially run in environments where it otherwise could not.</p><p>The target scenario looks like this:</p><pre>Cloud VM<br>  └── no nested VT-x / AMD-V<br>  └── no hardware-backed /dev/kvm<br>  └── FSGSBASE masked<br>  └── RDTSCP masked<br>  └── PVM provides software-backed /dev/kvm<br>        └── Firecracker opens /dev/kvm<br>              └── Ubuntu guest boots</pre><p>This is not the normal high-performance bare-metal Firecracker deployment model. It is a portability and experimentation model.</p><p>But portability matters.</p><p>If microVMs can run on a wider range of commodity cloud VMs, then developers can test, prototype, and deploy isolation models in environments that do not expose nested virtualization. That is useful for cloud labs, CI environments, secure-container experiments, and systems where instance availability matters more than raw virtualization speed.</p><h3>Validation path</h3><p>The validation was not just “it compiled.”</p><p>The milestone path looked like this:</p><pre>1. em_rdtscp + opcode EmulateOnUD<br>   Verification: symbols resolve; instruction decoder self-test passes</pre><pre>2. route user-mode #UD through handle_ud()<br>   Verification: no orphaned is_smod/pvm behavior; matches stock VMX/SVM style</pre><pre>3. soft-pass rdtscp gate<br>   Verification: diff reviewed</pre><pre>4. build kvm/kvm-pvm<br>   Verification: BUILD_RC=0</pre><pre>5. install + recoverable reboot<br>   Verification: modules fresh, pti=off, default kernel stock behavior preserved</pre><pre>6. kvm-pvm loads<br>   Verification: rc=0, /dev/kvm present, both gates soft-passed</pre><pre>7. microVM boots<br>   Verification: full Ubuntu guest reaches root shell; in-guest RDTSCP emulation proven</pre><p>This is also why the project page includes both a human-visible milestone image and an HTML version of the table. Images are useful for readers, but the text version is important for search engines and AI agents because they can extract the validation story without relying on OCR.</p><p>The project page with the full validation and archive is here:</p><p><a href="https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/">https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/</a></p><h3>Why sched_getcpu() is not enough to prove RDTSCP works</h3><p>One subtle testing issue is that calling sched_getcpu() inside the guest is not enough proof.</p><p>Modern glibc may use rseq for CPU lookup. That means a normal userspace call can succeed without ever executing RDTSCP.</p><p>So the test needs to execute the raw RDTSCP opcode inside the guest.</p><p>That distinction matters because the bug being fixed is not “can userspace get a CPU number somehow?” The bug is “can guest user-mode RDTSCP be handled correctly when the host cannot execute it?”</p><p>The patch validates the actual instruction path.</p><p>A successful result means:</p><pre>raw RDTSCP opcode executes in guest<br>no SIGILL<br>valid TSC returned<br>TSC_AUX path handled</pre><p>That is much stronger than a high-level library call.</p><h3>Performance results</h3><p>The performance results are important because they make the tradeoff visible.</p><p>The goal is not to hide the overhead. The fallback path is slower. PVM itself has software-switcher and software-MMU costs. The MSR-based GS-base fallback adds additional cost when FSGSBASE is unavailable. The guest FS-base hypercall path can also add overhead in paths where it is used.</p><p>But the result is still useful.</p><p>The measured results from the target host were approximately:</p><pre>CPU compute loop       native 0.957 s    PVM guest 1.113 s    1.16x<br>getpid syscall         native 445 ns     PVM guest 759 ns     1.7x<br>fork+exec x3000        native 1.53 s     PVM guest 5.59 s     3.6x<br>fork x3000             native 0.81 s     PVM guest 3.48 s     4.3x<br>raw RDTSCP             emulated in guest ~3.35 us             trap path<br>microVM boot           PVM guest reaches shell in ~1.3 s</pre><p>These numbers tell a clear story.</p><p>Compute-heavy work is relatively close to native. Syscall-heavy and fork-heavy workloads pay a larger cost. The emulated RDTSCP path is much slower than native instruction execution, but it is expected to be a cold path in many real workloads because common userspace paths may avoid executing it directly.</p><p>The key benchmark is not only speed. The key benchmark is viability:</p><pre>Before: PVM refuses to load or guest fails<br>After:  PVM loads, /dev/kvm exists, Firecracker guest boots</pre><p>That is the actual win.</p><h3>What this does not claim</h3><p>It is important to be precise about what this work does and does not claim.</p><p>This does not claim that PVM without hardware virtualization is faster than KVM on bare metal.</p><p>It does not claim that emulated RDTSCP is cheap.</p><p>It does not claim that every Firecracker workload should run this way.</p><p>It does not claim that this is production-ready in its RFC form.</p><p>The claim is narrower and more useful:</p><blockquote><em>PVM can be made more robust on cloud CPUs that mask </em><em>FSGSBASE and </em><em>RDTSCP, allowing it to provide a software-backed </em><em>/dev/kvm path where it previously failed.</em></blockquote><p>That is enough to matter.</p><p>In kernel work, making a subsystem gracefully handle real deployment constraints is valuable even when the fallback path is slower.</p><h3>Why Alibaba Cloud, Ant Group, and PVM contributors should care</h3><p>The original motivation behind PVM is closely related to VM-style secure containers and cloud environments where nested virtualization may not be available.</p><p>That makes CPU feature masking a real compatibility issue.</p><p>A cloud deployment target is not the same as a developer workstation. The virtual CPU may not expose everything the physical CPU supports. A system intended for cloud deployment needs to be resilient to that.</p><p>This patch series is relevant to PVM maintainers and cloud virtualization engineers because it expands the set of environments where PVM can be tested and used.</p><p>The relevant class of host is:</p><pre>Commodity cloud VM<br>No nested virtualization<br>No exposed VT-x/AMD-V<br>No host /dev/kvm<br>FSGSBASE unavailable<br>RDTSCP unavailable<br>Need VM-style isolation or microVM compatibility</pre><p>That is not an exotic scenario. It is a common cloud constraint.</p><p>If PVM can operate in this environment, it becomes more useful as a portability layer for VM-based isolation.</p><h3>Why this is also an SEO and discovery problem</h3><p>Kernel patches often live on mailing lists, but discoverability matters.</p><p>A patch series can be technically useful and still be hard to find if someone does not know the exact mailing list subject line or archive URL.</p><p>That is why I created a public technical landing page for this work:</p><p><a href="https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/">https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/</a></p><p>The page is designed to be useful to three audiences:</p><ol><li>Kernel and PVM contributors</li><li>Cloud virtualization engineers</li><li>Search engines and AI agents trying to understand the work</li></ol><p>The page includes:</p><ul><li>A direct answer-first summary</li><li>Patch list</li><li>Problem statement</li><li>Technical design</li><li>Performance table</li><li>Reproduction summary</li><li>Validation milestones</li><li>References to the original PVM work</li><li>Raw RFC patch archive</li><li>Structured metadata for technical search</li><li>A text version of image/table content so AI crawlers do not need OCR</li></ul><p>That matters because future engineers may search for symptoms rather than project names.</p><p>For example:</p><pre>PVM RDTSCP SIGILL<br>PVM FSGSBASE required<br>KVM PVM without RDTSCP<br>Firecracker without nested virtualization<br>PVM /dev/kvm cloud VM<br>WRFSBASE invalid opcode PVM<br>RDTSCP EmulateOnUD KVM</pre><p>A page that clearly connects those terms to a real patch series is more likely to be found by the exact people who need it.</p><h3>AEO: answering the questions AI agents will ask</h3><p>Search is changing. A technical page should not only target traditional Google ranking. It should also be easy for answer engines and AI agents to parse.</p><p>For this project, the important answer-engine questions are:</p><h3>Can PVM run without FSGSBASE?</h3><p>Yes, with a slower fallback path. The switcher can use an MSR-based GS-base fallback instead of direct RDGSBASE / WRGSBASE when FSGSBASE is unavailable.</p><h3>Can PVM run without RDTSCP?</h3><p>Yes, if guest RDTSCP is trapped and emulated. The patch series adds an em_rdtscp() executor and routes guest user-mode #UD through the emulator path.</p><h3>Does this help Firecracker?</h3><p>Yes. The target result is that PVM provides /dev/kvm in software, allowing Firecracker to boot a guest even where nested hardware virtualization is unavailable.</p><h3>Is this faster than normal KVM?</h3><p>No. The fallback paths are slightly slower. The value is compatibility and portability, not beating hardware virtualization.</p><h3>What was proven?</h3><p>The patched PVM module loaded, /dev/kvm appeared, Firecracker booted Ubuntu 24.04 to a root shell, and raw in-guest RDTSCP executed without SIGILL.</p><p>These short, direct answers are important because AI agents often extract concise claims from long technical documents. If the page does not state them clearly, the agent may miss the point.</p><h3>JavaScript SEO lesson from this project</h3><p>The project page intentionally does not depend on JavaScript for critical content.</p><p>That is the right choice for this kind of technical artifact.</p><p>Search engines can render JavaScript, but relying on JavaScript rendering creates avoidable risk. A kernel patch page does not need dynamic rendering. The important content should be present in the initial HTML response:</p><ul><li>Title</li><li>Canonical URL</li><li>Meta description</li><li>Patch names</li><li>Technical summary</li><li>Benchmark table</li><li>References</li><li>FAQ</li><li>Image alt text</li><li>Structured data</li><li>Raw RFC archive</li></ul><p>That makes the page easier for search engines, link previews, terminal browsers, text extractors, and AI agents.</p><p>A project like this should not hide important claims behind client-side rendering, hash routes, interactive widgets, or delayed JavaScript. Static HTML is the correct technical choice.</p><h3>Canonicalization matters</h3><p>Another small but important detail is canonicalization.</p><p>The page should have one preferred URL:</p><pre>https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/</pre><p>The canonical tag, sitemap URL, Open Graph URL, and internal links should all agree on that exact URL.</p><p>This avoids splitting signals across multiple variants such as:</p><pre>/pvm-no-fsgsbase-rdtscp<br>/pvm-no-fsgsbase-rdtscp/<br>/pvm-no-fsgsbase-rdtscp/index.html</pre><p>For a small technical project, every signal matters. The Medium article, GitHub README, sitemap, and social links should all point to the canonical URL.</p><h3>Suggested Medium image placement</h3><p>The milestone image should appear after the “Validation path” section.</p><p>Caption:</p><pre>Validation milestones for the KVM x86/PVM FSGSBASE/RDTSCP fallback series, from emulator support through Firecracker guest boot.</pre><p>This placement works because the reader has already learned what the problem is, and the image then acts as proof that the patch series reached the important milestones.</p><p>Do not use the image as the only copy of the milestone table. The HTML project page should include the table as real text too, which helps both accessibility and AI extraction.</p><h3>Suggested GitHub README support</h3><p>The Medium article should not be the only supporting page.</p><p>A GitHub README should also link to the main landing page using natural anchor text:</p><pre>Full technical writeup: KVM x86/PVM without FSGSBASE or RDTSCP<br>https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/</pre><p>The README should include:</p><pre>patches/<br>  0000-cover-letter.patch<br>  0001-x86-entry-PVM-switcher-gsbase-without-FSGSBASE.patch<br>  0002-KVM-x86-emulate-RDTSCP-on-UD.patch<br>  0003-KVM-x86-PVM-soft-gate-FSGSBASE-RDTSCP.patch<br>  0004-x86-pvm-FS-base-hypercall-without-FSGSBASE.patch</pre><p>This gives maintainers a practical way to inspect the work and gives search engines another high-relevance backlink.</p><h3>The most important technical takeaway</h3><p>The most important takeaway is not that one benchmark number improved.</p><p>The most important takeaway is that a hard failure became a graceful degradation path.</p><p>Before the patch series:</p><pre>Missing FSGSBASE -&gt; PVM refuses to load<br>Missing RDTSCP   -&gt; PVM refuses to load or guest user path fails<br>Guest FS-base    -&gt; early invalid opcode risk<br>Firecracker      -&gt; no usable /dev/kvm path</pre><p>After the patch series:</p><pre>Missing FSGSBASE -&gt; MSR-based GS-base fallback<br>Missing RDTSCP   -&gt; trap and emulate RDTSCP<br>Guest FS-base    -&gt; PVM hypercall fallback<br>Firecracker      -&gt; Ubuntu guest boots through PVM-provided /dev/kvm</pre><p>That is the kind of compatibility improvement that matters for real cloud deployments.</p><h3>Conclusion</h3><p>PVM is interesting because it opens a path for VM-style isolation in environments where normal nested hardware virtualization is not available.</p><p>But to be useful in real cloud environments, PVM needs to tolerate the way cloud providers expose virtual CPUs. That includes cases where features such as FSGSBASE and RDTSCP are hidden or unavailable.</p><p>This RFC patch series shows one way to do that:</p><ul><li>Preserve fast paths on feature-complete hosts</li><li>Add MSR-based fallback for GS-base switching</li><li>Add RDTSCP emulation on #UD</li><li>Route guest user-mode #UD through the KVM emulator path</li><li>Soft-gate PVM’s hard feature checks</li><li>Add guest FS-base hypercall fallback</li><li>Validate the result by loading kvm-pvm, creating /dev/kvm, and booting Firecracker</li></ul><p>The result is not magic and not free. It is slower than native hardware-assisted virtualization. But it changes the failure mode from “PVM cannot run here” to “PVM can run here with expected fallback overhead.”</p><p>That makes KVM x86/PVM more practical for commodity cloud VMs, secure-container experiments, and Firecracker-style microVM workflows where nested virtualization is unavailable.</p><p>Full technical page, patch archive, benchmarks, reproduction summary, and references:</p><p><a href="https://dywongcloud.github.io/pvm-no-fsgsbase-rdtscp/">KVM x86/PVM without FSGSBASE or RDTSCP</a></p><h3>Future Plans</h3><p>1. The process_64.c Dirty-Marking Fix</p><p>In Linux 7.1, thread switching heavily relies on x86_fsgsbase_load() and optimized architecture helpers. Because your PVM hypercall (PVM_HC_WRMSR) forces a write to MSR_FS_BASE behind the scheduler&#39;s back, you have to break its caching logic.</p><ul><li><strong>The Mechanism:</strong> When your code handles the guest FS-base hypercall fallback, you must manually invalidate the CPU’s cached copy of the selector or explicitly force the task structure to look “dirty.”</li><li><strong>The Code Blueprint:</strong> Your agent will likely inject an update directly into the state-tracking struct inside arch/x86/kernel/process_64.c:</li></ul><pre>#ifdef CONFIG_KVM_PVM_GUEST <br>/* Force the 7.1 sequencer to see a mismatch so <br>it is required to rewrite the MSR current-&gt; */<br>   thread.fsbase = new_emulated_fsbase; <br>   this_cpu_write(old_tls_desc_index, 0); <br>// Invalidates 7.1&#39;s segment descriptor cache #endif<br></pre><ul><li>Use code with caution.</li></ul><p>2. The 7.1 KVM Function Renames (The Missing 15)</p><p>The ~15 “missing” KVM symbols your agent ran into aren’t completely gone — their namespaces were refactored to separate core hardware emulation from guest state updates. Here is exactly where they are in 7.1:</p><ul><li><strong>kvm_set_msr &amp; </strong><strong>kvm_get_msr</strong>: In 7.1, these are strictly routed through structural state wrappers.</li><li>Look for <strong>__kvm_set_msr</strong> inside arch/x86/kvm/x86.h.</li><li>They now require a specific struct msr_data wrapper rather than raw register registers passed as individual arguments.</li><li><strong>kvm_update_cpuid_runtime</strong>: This was moved and unified into <strong>kvm_update_cpuid</strong> or <strong>kvm_vcpu_after_set_cpuid</strong> found inside arch/x86/kvm/cpuid.h.</li><li><strong>kvm_load_guest_xsave_state</strong>: Cleaned up entirely in favor of the unified architecture path <strong>kvm_vcpu_load_fpu</strong> or direct structural calls to the guest&#39;s fpu state block (vcpu-&gt;arch.guest_fpu).</li></ul><p>3. The kvm_x86_ops Signature Alignments</p><p>Because Linux 7.1 added support for Intel FRED and advanced architectural isolation features, the main function pointer table (struct kvm_x86_ops in kvm_ops.h) changed its callback arguments.</p><ul><li><strong>What to watch out for:</strong> Functions that used to accept raw unsigned long register values or simple booleans now take structured state pointers (like struct kvm_lapic or direct fault flag structs). Your agent will need to update the function declarations in your pvm.c driver to match these new signatures exactly, or the compiler will reject the module initialization vector.</li></ul><p>The hard part — rebasing 100+ PVM commits across 9 kernel releases onto mainline-latest, soundly — is 100% completed and also verified. The next steps are finishing the module’s compile against 7.1’s KVM internals (then a boot test) which unfortunately is a bounded but genuine multi-session expert tail;</p><p>I have patched and fixed~9 of the API/Interface breaks and also documented the rest of it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a146469a802a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Single-Node Kubernetes on Tencent CVM (RHEL 10 + Calico)]]></title>
            <link>https://medium.com/@dylanwong007/deploying-single-node-kubernetes-on-tencent-cvm-rhel-10-calico-b54df6dc2a0f?source=rss-ab981653959------2</link>
            <guid isPermaLink="false">https://medium.com/p/b54df6dc2a0f</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[calico]]></category>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Dylan Wong]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 23:58:35 GMT</pubDate>
            <atom:updated>2026-04-07T21:23:35.335Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xdgYGi4HlhFAs_kcHW27Q.png" /></figure><h3>Vibe DevOps: From raw infrastructure to a cloud-integrated cluster via AI Agents</h3><p>Standing up Kubernetes is easy to describe — but much harder to operationalize cleanly, especially when you’re working from a single node and building everything from scratch. I wanted to see how effective “vibe” coding could be used in the context of Platform Engineering and DevOps.</p><p>In this post, I walk through how I:</p><ul><li>Deployed a <strong>single-node Kubernetes cluster on Tencent Cloud CVM (RHEL 10)</strong></li><li>Diagnosed early <strong>CNI (Calico) issues using an AI-assisted workflow</strong></li><li>Brought up the standard <strong>web-based Kubernetes Admin dashboard</strong></li><li>Registered the cluster into <strong>Tencent Kubernetes Engine (TKE)</strong> as an <strong>external cluster</strong></li></ul><p>This isn’t just a step-by-step guide — it’s an <strong>operator’s deployment story</strong>, showing how a cluster evolves from “barely working” to fully integrated and observable.</p><h3>This setup is intentionally minimal — perfect for:</h3><ul><li>Edge deployments</li><li>POCs</li><li>Internal platforms</li><li>AI-driven infra experimentation</li></ul><h3>🚀 Phase 1: Bootstrapping Kubernetes on CVM</h3><p>The cluster started as a <strong>single CVM instance running RHEL 10</strong>, acting as both control plane and worker.</p><p>Instead of manually running every command, I used an <strong>AI agent over SSH</strong> to:</p><ul><li>Install Kubernetes components</li><li>Perform health checks</li><li>Diagnose failures in real time</li></ul><h3>🔍 First Reality Check: Control Plane vs Networking</h3><p>The cluster didn’t come up perfectly — and that’s where things got interesting.</p><p>From the initial validation:</p><ul><li>✅ API server reachable</li><li>✅ etcd, scheduler, controller-manager running</li><li>✅ CoreDNS healthy</li><li>❌ calico-node stuck at 0/1</li></ul><p>This is a <strong>classic single-node failure mode</strong>:</p><blockquote><em>Kubernetes is “alive,” but the network dataplane is broken.</em></blockquote><p>The key insight:</p><ul><li>Don’t rebuild</li><li>Don’t panic</li><li>Narrow the failure domain</li></ul><p>As captured in the deployment journal, the AI agent quickly isolated the issue to Calico readiness and suggested targeted diagnostics like pod logs, events, and DNS checks .</p><h3>🧠 Why AI-assisted debugging actually mattered</h3><p>This wasn’t just convenience — it changed how debugging worked:</p><ul><li>It <strong>separated control plane health from CNI issues</strong></li><li>It avoided unnecessary rebuilds</li><li>It proposed <strong>safe, iterative diagnostics instead of guesswork</strong></li></ul><p>Instead of “cluster is broken,” the mindset became:</p><blockquote><em>“The control plane is fine — networking is the only blocker.”</em></blockquote><h3>🔁 Phase 2: Iterative CNI Debugging</h3><p>On the second pass, debugging became more surgical:</p><ul><li>Inspect Calico DaemonSet rollout</li><li>Describe failing pods</li><li>Check install-cni container logs</li><li>Validate config maps</li></ul><p>This is where most people give up and rebuild — but the cluster was already <strong>90% functional</strong>.</p><p>The journal explicitly highlights this iterative narrowing approach, focusing only on the failing networking layer rather than treating the system as fully broken.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhOXe9uCaNY2XOmJQNuA5g.png" /></figure><h3>🖥️ Phase 3: Bringing Up the Kubernetes Dashboard</h3><p>Once the cluster reached a usable state, I added a <strong>browser-based Kubernetes dashboard</strong>.</p><p>This was a huge turning point.</p><p>Instead of relying only on kubectl, I now had:</p><ul><li>Visual workload status</li><li>Namespace exploration</li><li>Real-time pod/deployment health</li></ul><p>From the dashboard:</p><ul><li>Namespaces were accessible</li><li>Pods and Jobs were visible</li><li>Management workloads were running</li></ul><p>As shown in the dashboard view, the cluster was serving live workload data externally — confirming it was no longer just “internally alive,” but actually usable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rebdQTkKa-QBboChV1Uiwg.png" /></figure><h3>☁️ Phase 4: Registering into Tencent Kubernetes Engine (TKE)</h3><p>Now comes the most interesting part:</p><p>Taking a <strong>self-managed cluster</strong> and turning it into a <strong>cloud-managed asset</strong>.</p><h3>Step 1: Start registration</h3><p>In Tencent Cloud Console:</p><ul><li>Define cluster name</li><li>Select region</li><li>Add metadata</li></ul><p>This creates a <strong>registration stub</strong> in TKE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W_z3r4PRP2gaxtSzl4cZjg.png" /></figure><h3>Step 2: Apply the registration manifest</h3><p>Tencent generates a YAML manifest that includes:</p><ul><li>clusternet-system namespace</li><li>Service account</li><li>ClusterRoleBinding (cluster-admin)</li><li>Installation Job for clusternet-agent</li></ul><p>This isn’t just a connection — it’s a <strong>full integration payload</strong>.</p><blockquote><em>TKE provides an explicit, auditable bootstrap manifest rather than a vague handshake</em></blockquote><p>You simply:</p><pre>kubectl apply -f tke-registration.yaml</pre><h3>Step 3: Verify cluster import</h3><p>Once applied, the cluster appears in TKE as:</p><ul><li>Type: External Cluster</li><li>Status: Running</li><li>Node count visible</li><li>Kubernetes version detected</li></ul><p>But the real validation?</p><p>👉 <strong>Workloads show up in Tencent Cloud UI</strong></p><p>The journal shows:</p><ul><li>dex deployment → 1/1 running</li><li>openshift-console → 1/1 running</li></ul><p>This proves:</p><blockquote><em>TKE isn’t just tracking the cluster — it’s actively observing it</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t54lcmwVF2sg5Qj9pL54WA.png" /></figure><h3>🧩 What This Architecture Demonstrates</h3><p>This workflow highlights something powerful:</p><h3>1. CVM can run real Kubernetes</h3><p>A single node is enough for:</p><ul><li>Testing</li><li>Demos</li><li>Edge workloads</li></ul><h3>2. AI changes infrastructure operations</h3><p>AI-assisted workflows:</p><ul><li>Reduce debugging time</li><li>Improve signal vs noise</li><li>Prevent unnecessary rebuilds</li></ul><h3>3. Dashboard = operational visibility</h3><p>Not optional — essential.</p><h3>4. TKE bridges self-managed and cloud-native</h3><p>You get:</p><ul><li>Centralized visibility</li><li>Cloud control plane integration</li><li>Workload introspection</li></ul><p>Without giving up:</p><ul><li>Flexibility</li><li>Custom environments</li></ul><h3>🔚 Final Take</h3><p>What makes this workflow compelling isn’t just that it works — it’s that it becomes <strong>understandable</strong>.</p><ul><li>The <strong>AI agent</strong> made the bootstrap legible</li><li>The <strong>dashboard</strong> made the cluster visible</li><li><strong>TKE</strong> made it a first-class cloud asset</li></ul><p>What started as a <strong>single RHEL 10 VM</strong> ended up as:</p><blockquote><em>A fully operational Kubernetes environment with both </em><strong><em>local and cloud-side observability</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b54df6dc2a0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secure Multi Party Computing for Edge]]></title>
            <link>https://medium.com/@dylanwong007/secure-multi-party-computing-a5d2c1e00dbf?source=rss-ab981653959------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5d2c1e00dbf</guid>
            <category><![CDATA[multiparty-computation]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[edge-computing]]></category>
            <dc:creator><![CDATA[Dylan Wong]]></dc:creator>
            <pubDate>Mon, 25 Jul 2022 04:40:17 GMT</pubDate>
            <atom:updated>2022-07-25T04:47:14.179Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Secure MPC </strong>accounts for the<strong> </strong>goal of creating methods for parties to jointly compute a function over their peer&#39;s inputs while simultaneously keeping those inputs private. Unlike traditional processing, where the cryptography in this model protects participants’ <a href="https://en.wikipedia.org/wiki/Privacy">privacy</a> from each node.</p><p>This brings revolutionary benefits to MEC, (Multi Access Edge Computing) and distributed systems because it provides an autonomous way of establishing trust and facilitating zero knowledge execution of functions in distributed regions.</p><blockquote><strong><em>A primitive way to measure this test of zero-knowledge execution is with a simple Dot Product. </em></strong><em>(An operation that will compile two equal length sequences of numbers into a single number)</em></blockquote><blockquote><em>Let x &amp; y; be Vector 1 and Vector 2 where N can be the dimension of vector space and x of i; and y; of i; represent a specific iteration through the Summative Notation where i; can represent any value… lets just say 1.</em></blockquote><blockquote><em>Well… we can basically prove that Computer 1 can contain a value for x while Computer 2 can contain a value y.</em></blockquote><blockquote><em>If both machines could compute their shared values and return the same output synchronously; without being aware of each others variables (via SGX or TEE) , then that can provide a simple mathematical proof in between individual execution processes and time stamps of a given Serverless Function.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/0*4W6Wa51LEu-sVw6n.png" /></figure><p>Enclaves like Intel SGX and AMD SEV are vulnerable to memory side-channeling, raising the need for a decentralized form of governance to provide reputation scoring for nodes, however, that is a straw-man form of security, ignoring the common need for decentralized ledger systems like blockchains for verifying ZK Proofs.</p><h3>Challenges</h3><p>GPUs are still the mainstream hardware for ZKP computing in the foreseeable future due to:</p><ol><li>ZKP algorithms will frequently change in the future, and GPUs are the most developer-friendly hardware.</li><li>Rigs that hold a large number of GPUs are readily available, especially for the Ethereum community. When Ethereum finally switches to PoS, these GPUs will be available for ZKP mining.</li></ol><p>The second challenge is the parallel computing of ZKP on distributed hardware. Currently, there are three types of solutions:</p><ol><li>If each proof takes only a little bit of computation, such as Aleo, the traditional mining pool is suitable for assigning computing tasks to distributed hardware.</li><li>Sometimes we can separate a single proof into multiple proofs, such as <a href="https://starli.medium.com/l2-deep-into-plonk-aggregation-circuit-d9928ccd0749">zkSync</a> and <a href="https://research.protocol.ai/blog/2021/snarkpack-how-to-aggregate-snarks-efficiently/">Filecoin</a>. In this case, the separated proofs can be computed parallelly and then consecutively aggregated into a single one.</li><li><a href="https://github.com/scipr-lab/dizk">DIZK</a> is an architecture able to compute a single proof in a distributed manner.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5d2c1e00dbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>