Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EA2AC433F5 for ; Mon, 28 Mar 2022 20:39:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.295578.503056 (Exim 4.92) (envelope-from ) id 1nYw8m-0003Wp-2Y; Mon, 28 Mar 2022 20:39:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 295578.503056; Mon, 28 Mar 2022 20:39:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nYw8l-0003Wi-Ur; Mon, 28 Mar 2022 20:39:03 +0000 Received: by outflank-mailman (input) for mailman id 295578; Mon, 28 Mar 2022 20:39:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nYw8j-0003Wc-QP for xen-devel@lists.xenproject.org; Mon, 28 Mar 2022 20:39:02 +0000 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 16d94938-aed7-11ec-a405-831a346695d4; Mon, 28 Mar 2022 22:38:58 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3D9055C021E; Mon, 28 Mar 2022 16:38:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 28 Mar 2022 16:38:56 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Mar 2022 16:38:55 -0400 (EDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 16d94938-aed7-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Jus8ZJ3zuA3UyTCO7 C2XcvuCNtvWOSEYF+Qqu8mSD30=; b=lZbVk+3scvkwjonIpDObuye6Nl4oWLIID LS2NT1AArpO67jTnxMD5erkgegYA3ucDOu8KclTA9lxOBHmRaW9+2L21Z3TEwE7s WsVg5xALnwcynV73L30HwJvr+DIHh2ZfcEjXcHKzxy6BiVuCnVh6z388rKczX803 FMRxvwbfrIqqkzoZ4leGtplei/MTRQlu1nePYwYA2iMCIMa91s8BBSIbN1kBo+M1 1UKUDCjyhvZHlR6FHtGQWiXRdkGgCvoXDLK7tgFnKATTSY4dDLnHd5swa5zMzgwX A0wD3gh0xIIGo92gwjjzRYiHuW7uh8LLnFfA9reqIKuaDTM72G/gQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudehjedgudehfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfvfhfhufgjtgesghdtreertdefjeenucfhrhhomhepffgvmhhi ucforghrihgvucfqsggvnhhouhhruceouggvmhhisehinhhvihhsihgslhgvthhhihhngh hslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhepuedugedugfetfeejfeehtdfggeet ffelvdegvdejtefhhfekfeeludetveduhfeunecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepuggvmhhisehinhhvihhsihgslhgvthhhihhnghhs lhgrsgdrtghomh X-ME-Proxy: Message-ID: <10e7b01a-2a8e-17cd-6418-1a6f836cc251@invisiblethingslab.com> Date: Mon, 28 Mar 2022 16:38:33 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: Mark Kettenis Cc: djm@mindrot.org, roger.pau@citrix.com, marmarek@invisiblethingslab.com, xen-devel@lists.xenproject.org, tech@openbsd.org References: <37a4b6-cd56-1993-be2-b5522b9aa4d7@mindrot.org> From: Demi Marie Obenour Subject: Re: Security support status of xnf(4) and xbf(4) In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------kxld3QJ8sYt5KflTU7puNuUI" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------kxld3QJ8sYt5KflTU7puNuUI Content-Type: multipart/mixed; boundary="------------G4sArzC1TocU1Lwf14jsB78h"; protected-headers="v1" From: Demi Marie Obenour To: Mark Kettenis Cc: djm@mindrot.org, roger.pau@citrix.com, marmarek@invisiblethingslab.com, xen-devel@lists.xenproject.org, tech@openbsd.org Message-ID: <10e7b01a-2a8e-17cd-6418-1a6f836cc251@invisiblethingslab.com> Subject: Re: Security support status of xnf(4) and xbf(4) References: <37a4b6-cd56-1993-be2-b5522b9aa4d7@mindrot.org> In-Reply-To: --------------G4sArzC1TocU1Lwf14jsB78h Content-Type: multipart/mixed; boundary="------------pwi7rCsQeNxR0kZ0WVjfsB2b" --------------pwi7rCsQeNxR0kZ0WVjfsB2b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 3/28/22 10:39, Mark Kettenis wrote: >> Date: Mon, 28 Mar 2022 09:51:22 -0400 >> From: Demi Marie Obenour >> >> On 3/27/22 21:45, Damien Miller wrote: >>> On Fri, 25 Mar 2022, Demi Marie Obenour wrote: >>> >>>> Linux=E2=80=99s netfront and blkfront drivers recently had a securit= y >>>> vulnerability (XSA-396) that allowed a malicious backend to potentia= lly >>>> compromise them. In follow-up audits, I found that OpenBSD=E2=80=99= s xnf(4) >>>> currently trusts the backend domain. I reported this privately to T= heo >>>> de Raadt, who indicated that OpenBSD does not consider this to be a >>>> security concern. >>>> >>>> This is obviously a valid position for the OpenBSD project to take, = but >>>> it is surprising to some (such as myself) from the broader Xen >>>> ecosystem. Standard practice in the Xen world is that bugs in front= ends >>>> that allow a malicious backend to cause mischief *are* considered >>>> security bugs unless there is explicit documentation to the contrary= =2E >>>> As such, I believe this deserves to be noted in xnf(4) and xbf(4)=E2= =80=99s man >>>> pages. If the OpenBSD project agrees, I am willing to write a patch= , >>>> but I have no experience with mandoc so it might take a few tries. >>> >>> Hang on, what is a "malicious backend" in this context? Is it somethi= ng >>> other than the Xen Hypervisor? If not, then it seems not to be a usef= ul >>> attack model, as the hypervisor typically has near-complete access to= >>> guests' memory and CPU state. >> >> The backend can run in any Xen VM. It often runs in dom0, but it >> is not required to, and in Qubes OS the network backend never runs >> in dom0. Unless it runs in dom0, it has no access to frontend memory,= >> except for memory the frontend has explicitly given it access to via >> grant tables. >=20 > So this is somewhat similar to the situation on sun4v (Sun's > virtualization of the SPARC architecture). When writing the vnet(4) > and vdsk(4) drivers for OpenBSD, I did consider the implications of > those drivers talking to a "malicious" domain. the SPARC hypervisor > implements a concept similar to grant tables. It is fairly obvious > that any memory you grant access to should be considered insecure. > This means that you either have to make a copy of the data or revoke > access to the shared memory through some sort of Hypervisor call that > implements a synchronization point of some sorts. Otherwise you and > up TOCTOU issues all over the place. But this obviously has > significant performance consequences. For vnet(4) I decided that an > extra copy was worth doing and the only reasonable way of doing things > given how OpenBSD's mbuf layer works. But for vdsk(4) I decided to > trust the other domain as there is no way to prevent it from feeding > you compromised data. Full disk encryption doesn't really solve the > problem unless you have a way to securely verify the bootloader. In Qubes OS, xbf(4) devices are configurable. While all of them are provided by dom0 (which is trusted) by default, it is possible to attach devices that are *not* provided by dom0, and these devices should not be trusted. > Personally I think it might be beneficial for us to turn xnf(4) into > what we colloquially call a "bcopy" network driver. But folks who > actually use xen may find the performance impact of doing this > unacceptable and decide to trust the backend instead. You actually don=E2=80=99t have to do that. The Xen network protocol requires the backend to drop access to the buffer before giving it to the frontend, so the frontend only needs to ensure that it cannot regain access. This will fail if the backend still has access, but that is a bug in the backend, in which case you should shut down the interface. So there should not be any significant performance impact. If you are curious about how Linux does this, you can look at drivers/xen/grant-table.c, drivers/net/xen-netfront.c, and drivers/block/xen-blkfront.c from the Linux source. They are dual licensed GPL/MIT so there should not be licensing issues there. Be sure to use a version at or after =E2=80=9Cxen/netfront: react properl= y to failing gnttab_end_foreign_access_ref()=E2=80=9D and the other XSA-396 pa= tches. --=20 Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab --------------pwi7rCsQeNxR0kZ0WVjfsB2b Content-Type: application/pgp-keys; name="OpenPGP_0xB288B55FFF9C22C1.asc" Content-Disposition: attachment; filename="OpenPGP_0xB288B55FFF9C22C1.asc" Content-Description: OpenPGP public key Content-Transfer-Encoding: quoted-printable -----BEGIN PGP PUBLIC KEY BLOCK----- xsFNBFp+A0oBEADffj6anl9/BHhUSxGTICeVl2tob7hPDdhHNgPR4C8xlYt5q49y B+l2nipdaq+4Gk6FZfqC825TKl7eRpUjMriwle4r3R0ydSIGcy4M6eb0IcxmuPYf bWpr/si88QKgyGSVZ7GeNW1UnzTdhYHuFlk8dBSmB1fzhEYEk0RcJqg4AKoq6/3/ UorR+FaSuVwT7rqzGrTlscnTDlPWgRzrQ3jssesI7sZLm82E3pJSgaUoCdCOlL7M MPCJwI8JpPlBedRpe9tfVyfu3euTPLPxwcV3L/cfWPGSL4PofBtB8NUU6QwYiQ9H zx4xOyn67zW73/G0Q2vPPRst8LBDqlxLjbtx/WLR6h3nBc3eyuZ+q62HS1pJ5EvU T1vjyJ1ySrqt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k3Ls3AVIxIffLoY34E+MYSfkEjBz0E8CLOcAw7JIwAaeBT =3Dx+Ro -----END PGP PUBLIC KEY BLOCK----- --------------pwi7rCsQeNxR0kZ0WVjfsB2b-- --------------G4sArzC1TocU1Lwf14jsB78h-- --------------kxld3QJ8sYt5KflTU7puNuUI Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdodNnxM2uiJZBxxxsoi1X/+cIsEFAmJCHN0ACgkQsoi1X/+c IsEOSg/+K8nsru6EGEQVDdnj5Cnv69pRuOfBJC/+Mz+iElMXf1hTUHRwfeO4BXFi XQQuMtXAspjBRYu1yMrsht4NLpKkwJuYpXVufMmXvjMTmezxpHmZJ39n+2Dl/7fe pQiaVxnVCmA+4l+08gCwnt55Dy1eHrwYf0uEewtR8e/hkZn7hn3/APtERjnnwOYU M3Usv6OetqMjfYZQQW8VyU9rjVO9FtyG3a++1fQdU0trE62ZlXMytUd/AGSp9aMm sVQak+URBWmbRu9VRhICXx6hfgeAZTOLut5AUeElfGrT6n67Ha+/iOT37xGIzU1F FS61Zy3p8MDUA6uxPX8Gf0/dbNCDQ5qmGMMzB6+sAcs+8UvESy1ZibayNcqEZG3e k5WfrI8G9VH4pJ7+Ly/XxgbWUbV5YXysDx7W2OMcHEDnjGtAgZjrrnhDpF/VfTwa JM+ECuuu96YjLVwt/6y4RRahgxxsB28YnOUe/mtM9k5zHN59dPrQXbDHbBOMnJsP KKJEgSLIN1JN1KPndUciJfvnZCmEearMsq+X2IgHzTtCFriRf5iaD2aDUCMjz8bX xjn9W/7jTvLkp6N/b1cbpszVBSyO2VL2fZM3YZeKNZz61XN/2JANCAL+yS2KR+HU 3blBkPzA6DYL/zOwDtEVgRGXOLTVGpw21s/WZ6cQ/YmK4+IEHK8= =tnwt -----END PGP SIGNATURE----- --------------kxld3QJ8sYt5KflTU7puNuUI--