From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 Received: by atuin.qyliss.net (Postfix, from userid 496) id E3B412152; Sun, 14 Mar 2021 22:36:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 364872112; Sun, 14 Mar 2021 22:36:36 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 3A1132070; Sun, 14 Mar 2021 22:36:33 +0000 (UTC) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by atuin.qyliss.net (Postfix) with ESMTPS id 9439220D7; Sun, 14 Mar 2021 22:36:28 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 9FA7D2874; Sun, 14 Mar 2021 18:36:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 14 Mar 2021 18:36:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= date:from:to:cc:subject:message-id:mime-version:content-type; s= fm2; bh=sVjSHzZDOZx6If2MqW+SwMktdz8Jiy+UaawXygeuGkE=; b=lQNvW87f 1FDOsg4hzQDk2PRRVuS9Puqe2S+o6CIJsm+XB2FLx1qUXlii3QAWOj1yT+YF3RMB GixCiMG8SMDgwu7mQeTqBid6Bw0lIZZHb8UPG7CeQ9CfkzF3G/cw+6+HKA06HGzp Ur2K2ZhSz/27Y5EOeVcbd1FKgiOobXp4b2vo5sxYbjj/KV1NzbUk7+s/KKM4I+zp uthJWRyoJ1q02jpuFVFIbkWCpLTp+HJrEeDVRCeWTCPmOnz78+O6kdpO/nNPkxbu F3VSasz23ySRXsvwW+uGxFkX2VY+M3K9bSGamzT1v9SqmJPKDzU6l2Kal7A5a6Kt +F3DTdA+CT36ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=sVjSHzZDOZx6If2MqW+SwMktdz8Ji y+UaawXygeuGkE=; b=lXURCynMAhpM6oDIjpthIDd57py0asjCviy5f7A1ImOr4 DL4boT79tXRW0ICqVL7SyHf1QD3G7kke8RIu87t3JsAnbzMk7DrJUM9fbtUniVLw Rbnm8byA6unlXoEt22EuVNs08vycdeS1CcguqOHUy2R7qfwGDyrxvoX1w/duGqKD lYP+i37rbwvoNMjXrbrD74FL3nfKqPXJ+pNLEMnOXV3NlMY28n1X8zl5KNm9d+OS NzYp50v1CTUciTRU17yDAS7pK8SMoMUhREoqnCG3jAwWDZBNXn8N9AfnxqMJ6sfF Q59N/uyio33MY8uZrlG5nvg0bx1cUtOJIJQINdDWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvjedgudeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugesghdttdertddtvdenucfhrhhomheptehlhihsshgr ucftohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepffevff efjeegveevgfeffffgheeuudelueehjeettdefgeekheffiedtjeevgeeknecuffhomhgr ihhnpehrohhstghiughushdrtghomhdpshhpvggtthhruhhmqdhoshdrohhrghdpmhgrnh ejrdhorhhgpdihphdrthhopdhqvghmuhdrohhrghenucfkphepjeelrddvfeehrdduvdej rddvvdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epqhihlhhishhssegvvhgvrdhqhihlihhsshdrnhgvth X-ME-Proxy: Received: from eve.qyliss.net (p4feb7fe0.dip0.t-ipconnect.de [79.235.127.224]) by mail.messagingengine.com (Postfix) with ESMTPA id 6A6991080066; Sun, 14 Mar 2021 18:36:24 -0400 (EDT) Received: by eve.qyliss.net (Postfix, from userid 1000) id C4BA61093; Sun, 14 Mar 2021 22:36:22 +0000 (UTC) Date: Sun, 14 Mar 2021 22:36:22 +0000 From: Alyssa Ross To: discuss@spectrum-os.org, devel@spectrum-os.org Subject: This Week in Spectrum, 2021-W10 Message-ID: <20210314223622.tbk55x2mijrvociw@eve.qyliss.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="547idkefojet72it" Content-Disposition: inline Message-ID-Hash: HDESF3S7YS2MANHDL6GIPRKWDNW6LPUB X-Message-ID-Hash: HDESF3S7YS2MANHDL6GIPRKWDNW6LPUB X-MailFrom: qyliss@eve.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Thomas Leonard , Cole Helbling X-Mailman-Version: 3.3.1 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: --547idkefojet72it Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Surprise! I sent the last This Week in Spectrum in August. Since then, it's been pretty quiet. What happened? Towards then end of last year, I was aggressively pushing to achieve a funding milestone, but was starting to struggle to keep myself going. After that last TWiS, I decided to stop posting them for a while to fully concentrate on the push. I continued like that for two more months, before getting to the point where I was so burned out I just couldn't keep going, with the milestone still not done, the work I had done so far on it unpublished (and not in a good state to be published), and time running out. Fortunately, I was able to talk to NLnet, and they agreed to extend my funding deadlines and renegotiate the milestones. With that sorted out, in late November I began a hiatus from Spectrum to allow myself to recover from the burnout. I'm very grateful to my GitHub Sponsors, thanks to whom I was able to take this time to recover. I tried to come back at the end of January, but after a single day of Spectrum work I was feeling much the same as I had been in November. This week, though, something changed! I've been working on Spectrum again for the last week, and I've been feeling great about it! Now, there were three months of work between the last TWiS in August, and the start of my hiatus. That's a lot of work I haven't written about. But I think the only way this is really going to work is if I leave that largely unwritten about for now, because TWiS tends to be thousands of words long even when it's covering a single week of work. So I'm just going to talk about what I've done in the last week, explaining context from previous work as necessary. With all that in mind, here we go! "Qubes-lite with KVM and Wayland"[1] ------------------------------------ First up is something somebody else did, which is always nice! Thomas has been doing his own great work replacing his Qubes system with a system built on NixOS, using KVM and Wayland. Thomas got in touch on the Spectrum discuss mailing list in January[2] asking some questions about how some things were implemented, and we went back and forth a bit then (although not as much as I'd have liked, due to my burnout :/). Since then, he's come up with some awesome stuff, like an OCaml implementation of a virtio-wayland proxy (equivalent to Sommelier in Chromium OS). In our further conversation prompted by Thomas's article, Thomas raised a further interesting idea[3] -- what if we had a Sommelier-like Wayland proxy, but that ran in the same security domain as the compositor. That way, we could filter to allow only the protocol extensions we want to. We could implement our own permissions when the compositor doesn't. This code would be responsible for securely handling Wayland messages from an untrusted guest, which would be beneficial because it would be a lot less code to audit, and because it could be written in a memory-safe language. This would avoid the need to write or find a secure Wayland compositor, and would in fact allow us to use virtually any compositor without having to worry nearly as much about its security credentials. I'm very excited by that idea, and I've been asking myself for the past few days why I didn't think of it before! I've thought several times "it's quite nice that Sommelier gives us a known subset of Wayland, but it's a shame we can't rely on it since it runs inside a application guest". But for some reason it just never occurred to me to follow that idea one step further, to "what if we had a similar program that run in the compositor's security domain". [1]: https://roscidus.com/blog/blog/2021/03/07/qubes-lite-with-kvm-and-wayland/ [2]: https://spectrum-os.org/lists/archives/spectrum-discuss/CAG4opy_hz_ESEpY0TqJy7u3ZSiOOMPWmQkmmDZbi-pjY3cF=YQ@mail.gmail.com/ [3]: https://spectrum-os.org/lists/archives/spectrum-discuss/CAG4opy_JztAH3tD+ZUqpf9Un9mcLauYeuQaTrEA1sF7CY0z9fA@mail.gmail.com/ uscpi-vsock ----------- ucspi-vsock[4] is a program I started writing in September. VSOCK[5] is a special Linux socket type that allows for communication between VMs, and I'm using it to allow services running in VMs (a USBIP daemon, for example), to notify the host (and by extension other VMs), when the service in the VM becomes ready to accept connections. USCPI[6] is a standard command interface for making it easy to do socket communication using standard IO primitives, without having to teach programs how to do socket connections for every kind of socket. There are several UCSPI implementations for common socket types like Internet and Unix domain sockets, but until now there was not one for VSOCK. So, for example, in a VM we can do: vsockclient 2 $port sh -c 'echo >&7' Which will connect to the host over VSOCK (in VSOCK the host is always address 2), write a newline, and close the connection. UCSPI lets us implement this with standard shell tools. There's an equivalent "vsockserver" program for the other end, that will run a command whenever a connection is received. Anyway, this week I went back to ucspi-vsock to fix some bugs[7][8][9][10]. As usual, (although I'm happy to realise this is still the case after all these months!) Cole was kind enough to review my patches. [4]: https://spectrum-os.org/git/ucspi-vsock/ [5]: https://man7.org/linux/man-pages/man7/vsock.7.html [6]: https://cr.yp.to/proto/ucspi.txt [7]: https://spectrum-os.org/lists/archives/spectrum-devel/20210309154048.14474-1-hi@alyssa.is/ [8]: https://spectrum-os.org/lists/archives/spectrum-devel/20210309171816.8589-1-hi@alyssa.is/ [9]: https://spectrum-os.org/lists/archives/spectrum-devel/20210310204516.20041-1-hi@alyssa.is/ [10]: https://spectrum-os.org/lists/archives/spectrum-devel/20210310204555.20725-1-hi@alyssa.is/ Interguest networking --------------------- The bulk of my work this week has been in Spectrum's Nixpkgs, which is where (for now, at least) all the VM definitions and stuff live. Mostly, I've been trying to clean up months of frantic work into something I can actually publish as a series of patches, so it's out there instead of just on my computer! My focus at the moment is on doing this with the interguest networking implementation I wrote last year. The plan for this remains the same as last year: have a VM that manages all network hardware access and acts as a router for other VMs that need to talk to the outside world. Eventually, this will hopefully use virtio-vhost-user[11], which will allow us to avoid going through a networking stack on the host at all (or even having one), but until virtio-vhost-user is further along, we'll use bridge devices on the host to connect client VMs to the router. A very basic version of the latter is implemented and working for me locally -- I can run an application VM, and have it connect to another VM which runs the drivers for my ethernet port using VFIO (PCI passthrough). This code was a big ball of mud, and I'd also subtly broken it when I moved on from interguest networking last year to try to get a proof of concept going for another form of interguest communication. So I spent this week trying to page all the context I'd lost in the last few months back into my brain, making lots of partial git commits, writing commit messages, and fixing it up so that it works again. I think what I have is about ready to publish -- hopefully you'll see some patches next week. But what exists at the moment is still very limited -- the biggest limitation is that the router VM doesn't support hotplugging, so a VM that wants to connect to it actually has to be started first, before the router VM. Not good for something that should be run as a system service and likely started on boot! To overcome this limitation, I'll probably have to add support in crosvm for adding network devices at runtime using the control socket. I think this should be easy enough, and I haven't looked at what's happened in crosvm + rust-vmm since I've been away, so it's even possible somebody else will have done this already. [11]: https://wiki.qemu.org/Features/VirtioVhostUser So, the todo list for next week is getting the initial interguest networking PoC patchset posted. That'll come with a nice little demo other people will be able to try out if they want to. And then, I'll work on improving it further to the point where it's actually practical. I don't want to spend /too/ much time on this, since ultimately I do want to be using a virtio-vhost-user stack, which is quite different, but it's important to have an implementation of this so there's something to test further development (that doesn't care about the implementation details) against. My biggest worry at the moment is burning out again. Working in moderation isn't easy for me (I tend to get very sucked into things), but it's important for the project that I find a way to keep my work sustainable, so we don't lose time like this again. I'm still a little hesitant to say "this is it, I'm back for real". But the signs are looking good. Thank you for sticking with me through this. --547idkefojet72it Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEdZTIUP7JZVWM3Ir2XDnhXb2v5OUFAmBOj+UACgkQXDnhXb2v 5OWOyxAAq5zT1xSB1AUjJ04yt1XHYYS2eqbAl7VpDi6+JzPu3LQ8Q0q74zVAmOwu pxHVB0WiSBGSRBDdyBLtb52u7UUlhw202qMOVNzTB7Q1THmlWvi02Vy1fKptXSkD RrsqvgSPnfMfpLV2/sUPeVXWN8rtEWxQbjgV7Sv2C0VPeDj1pCALFCrDBsCd81AH 801X6DF/JCjXwXIbJcIAck/cXbD+Re6Hpk0fdBtqNDC3HBpxUnEzamaCs9cNyuQo lHqJ7vvBpGQepRN9GJGxvWMeYQbnHoT5PqdUvrBVUgDLy1bWc+3kSLrND2EQq/uS 33RJBopeuhtBMpfkKur4d+JqTPzuC42I0fIMYpb00MXkpHs7xNGvrAVosMTAxnjR jWOgJ1Zs3SvGUKmSl5GDL6ngGTaJLxAjp5YkeAeKZD9H0l8oKK+JHivQZSoTpN9T UN9uhqmqUpzY5h4sJ1Fo7esz6gofTYUHfOLWuQAjyKOvlA4AAUdBn2CzmoMpsNZX iQd8jaj5kg2/IGGFys8iVG8o0C5Ths4+WM+k+CAikV+Q85uqYtTClQvy36OOGZdv V9+A1PXD36+yloklFXy3ibOkLxTGfY+MKYafyQLYxYtngSNQNTrsJATgqy+HO3Xw clPTg9ImHPHOAoa37Cb01I5OeIdPdWWtiT9wygM9ZOiZCceN6RA= =RAyS -----END PGP SIGNATURE----- --547idkefojet72it--