From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22246C4332E for ; Thu, 14 Jan 2021 01:54:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA7862075E for ; Thu, 14 Jan 2021 01:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728066AbhANBxx (ORCPT ); Wed, 13 Jan 2021 20:53:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729679AbhAMX7I (ORCPT ); Wed, 13 Jan 2021 18:59:08 -0500 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CD42C061786 for ; Wed, 13 Jan 2021 15:58:20 -0800 (PST) Received: by ozlabs.org (Postfix, from userid 1007) id 4DGPXP6JWrz9sWC; Thu, 14 Jan 2021 10:58:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1610582293; bh=nGtVdJLJCKqUWV/HXYXHb49Ayq+DLtWoYF9H0m46txY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T4OiI22q43gfVnYl0FBDX6F0W3TCx1mMaxdtWf5zzbzBz7oDiTXOEjWFzoZd1AU9p VtkZI68q02SuvqgHjmAr4kc4bL1pozDmKlVAFhUqyzOZ0LDj71QqxEiEfuyV/DyEDb Y09xQM1AxHi3rm2NQYNBt7exLJOICj8t3PlVhef4= Date: Thu, 14 Jan 2021 10:56:20 +1100 From: David Gibson To: Christian Borntraeger Cc: Cornelia Huck , pasic@linux.ibm.com, brijesh.singh@amd.com, pair@us.ibm.com, dgilbert@redhat.com, qemu-devel@nongnu.org, andi.kleen@intel.com, qemu-ppc@nongnu.org, Paolo Bonzini , Marcelo Tosatti , Greg Kurz , frankja@linux.ibm.com, thuth@redhat.com, mdroth@linux.vnet.ibm.com, richard.henderson@linaro.org, kvm@vger.kernel.org, Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , Marcel Apfelbaum , Eduardo Habkost , david@redhat.com, mst@redhat.com, qemu-s390x@nongnu.org, pragyansri.pathi@intel.com, jun.nakajima@intel.com Subject: Re: [PATCH v6 13/13] s390: Recognize confidential-guest-support option Message-ID: <20210113235620.GL435587@yekko.fritz.box> References: <20210112044508.427338-1-david@gibson.dropbear.id.au> <20210112044508.427338-14-david@gibson.dropbear.id.au> <20210112123607.39597e3d.cohuck@redhat.com> <20210113005748.GD435587@yekko.fritz.box> <3e524040-826f-623d-6cd5-0946af51ca57@de.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9JSHP372f+2dzJ8X" Content-Disposition: inline In-Reply-To: <3e524040-826f-623d-6cd5-0946af51ca57@de.ibm.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org --9JSHP372f+2dzJ8X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 13, 2021 at 07:57:41AM +0100, Christian Borntraeger wrote: >=20 >=20 > On 13.01.21 01:57, David Gibson wrote: > > On Tue, Jan 12, 2021 at 12:36:07PM +0100, Cornelia Huck wrote: > > 65;6201;1c> On Tue, 12 Jan 2021 09:15:26 +0100 > >> Christian Borntraeger wrote: > >> > >>> On 12.01.21 05:45, David Gibson wrote: > >>>> At least some s390 cpu models support "Protected Virtualization" (PV= ), > >>>> a mechanism to protect guests from eavesdropping by a compromised > >>>> hypervisor. > >>>> > >>>> This is similar in function to other mechanisms like AMD's SEV and > >>>> POWER's PEF, which are controlled by the "confidential-guest-support" > >>>> machine option. s390 is a slightly special case, because we already > >>>> supported PV, simply by using a CPU model with the required feature > >>>> (S390_FEAT_UNPACK). > >>>> > >>>> To integrate this with the option used by other platforms, we > >>>> implement the following compromise: > >>>> > >>>> - When the confidential-guest-support option is set, s390 will > >>>> recognize it, verify that the CPU can support PV (failing if not) > >>>> and set virtio default options necessary for encrypted or protect= ed > >>>> guests, as on other platforms. i.e. if confidential-guest-support > >>>> is set, we will either create a guest capable of entering PV mode, > >>>> or fail outright. > >>>> > >>>> - If confidential-guest-support is not set, guests might still be > >>>> able to enter PV mode, if the CPU has the right model. This may = be > >>>> a little surprising, but shouldn't actually be harmful. > >>>> > >>>> To start a guest supporting Protected Virtualization using the new > >>>> option use the command line arguments: > >>>> -object s390-pv-guest,id=3Dpv0 -machine confidential-guest-suppo= rt=3Dpv0 =20 > >>> > >>> > >>> This results in > >>> > >>> [cborntra@t35lp61 qemu]$ qemu-system-s390x -enable-kvm -nographic -m = 2G -kernel ~/full.normal=20 > >>> ** > >>> ERROR:../qom/object.c:317:type_initialize: assertion failed: (parent-= >instance_size <=3D ti->instance_size) > >>> Bail out! ERROR:../qom/object.c:317:type_initialize: assertion failed= : (parent->instance_size <=3D ti->instance_size) > >>> Aborted (core dumped) > >>> > >> > >>>> +static const TypeInfo s390_pv_guest_info =3D { > >>>> + .parent =3D TYPE_CONFIDENTIAL_GUEST_SUPPORT, > >>>> + .name =3D TYPE_S390_PV_GUEST, > >>>> + .instance_size =3D sizeof(S390PVGuestState), > >>>> + .interfaces =3D (InterfaceInfo[]) { > >>>> + { TYPE_USER_CREATABLE }, > >>>> + { } > >>>> + } > >>>> +}; > >> > >> I think this needs TYPE_OBJECT in .parent and > >> TYPE_CONFIDENTIAL_GUEST_SUPPORT as an interface to fix the crash. > >=20 > > No, that was true of an earlier revision, but parent is correct in the > > current version. >=20 > right now parent is obviously wrong as it triggers the above warning (and= all other > variants in the previous patches also use TYPE_OBJECT). It is probably th= e right > thing when you fix >=20 > +struct S390PVGuestState { > + Object parent_obj; > +}; > + >=20 > and change Object to the proper type I guess.=20 Yes, I think so. In the next spin I've fixed the parent_obj field (as well as moving to OBJECT_DEFINE_TYPE()) and it's passing the gitlab CI, at least. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --9JSHP372f+2dzJ8X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl//iKAACgkQbDjKyiDZ s5IR0A/7BBeaYAmNps8ImKrO4gmSvb0Jig0f5roEqltdtvjDftPVyERhoLlmNy/5 5T7F5E1y8zCDNAogE4vR20KzAWt02b6No74Hv0syBg6B2MKbiOeUgLj2mewW/EHK SDM9OOt5DmqZoc66h4wwWXxQtFcCF5nIHa0cBcOebz4xSwlqCYgQsKMAkynHhDH/ aPiUaOnnxsKHRZvBVxZ5nEQIvXtCuWNQZ900EYcxkh9dOyVqoi9Jc5dioJs7ssI4 60OSboTJD9dLqIXCIV8ByNlB2VaByBjupMbKFZ8xxgL/jy6qciq4wVkliA0Sdh4y uNm4jlCLKcnK/Lu5PpNCdPIZynsF5LemnT87GkycwcYRF9gWsoilcWpjHQJxD4jM ZcpViwd72wd9nYAHq9CJbQeZUSi6Zmw63XbzoTDibt+pXT/5s8XNU8Kw1Jg/Afzg IBl8MHanbvqO7LkRLTOUPm3zid3MT4SQmiEi3znnbSgYWD6M1HdNsr+Gp1y8DE7G erkAlkasZqVoXTNp6YCAb10rLy8IG9+AIlCiuXQ+yAgdxEc9uCsXma4jj2Bc/ZiL yEw4BBtxmtvhadShuikPPCQwipgZpKHPy97tqIqF3v4+yNLu6UKtCH4uwDF5wBQA OQCmQ68LLyXmp17KG6DqbJ+Jsiekdk8ChGaZhpyIjsL5EIZHMyU= =VKL8 -----END PGP SIGNATURE----- --9JSHP372f+2dzJ8X-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A21BEC433E0 for ; Thu, 14 Jan 2021 00:06:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 541CD22ADF for ; Thu, 14 Jan 2021 00:06:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 541CD22ADF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzq9w-0007Qj-Vr for qemu-devel@archiver.kernel.org; Wed, 13 Jan 2021 19:06:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzq1z-0006uq-9f; Wed, 13 Jan 2021 18:58:27 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:44483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzq1v-0006ZV-OH; Wed, 13 Jan 2021 18:58:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4DGPXP6JWrz9sWC; Thu, 14 Jan 2021 10:58:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1610582293; bh=nGtVdJLJCKqUWV/HXYXHb49Ayq+DLtWoYF9H0m46txY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T4OiI22q43gfVnYl0FBDX6F0W3TCx1mMaxdtWf5zzbzBz7oDiTXOEjWFzoZd1AU9p VtkZI68q02SuvqgHjmAr4kc4bL1pozDmKlVAFhUqyzOZ0LDj71QqxEiEfuyV/DyEDb Y09xQM1AxHi3rm2NQYNBt7exLJOICj8t3PlVhef4= Date: Thu, 14 Jan 2021 10:56:20 +1100 From: David Gibson To: Christian Borntraeger Subject: Re: [PATCH v6 13/13] s390: Recognize confidential-guest-support option Message-ID: <20210113235620.GL435587@yekko.fritz.box> References: <20210112044508.427338-1-david@gibson.dropbear.id.au> <20210112044508.427338-14-david@gibson.dropbear.id.au> <20210112123607.39597e3d.cohuck@redhat.com> <20210113005748.GD435587@yekko.fritz.box> <3e524040-826f-623d-6cd5-0946af51ca57@de.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9JSHP372f+2dzJ8X" Content-Disposition: inline In-Reply-To: <3e524040-826f-623d-6cd5-0946af51ca57@de.ibm.com> Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pair@us.ibm.com, Cornelia Huck , brijesh.singh@amd.com, kvm@vger.kernel.org, david@redhat.com, qemu-devel@nongnu.org, frankja@linux.ibm.com, mst@redhat.com, mdroth@linux.vnet.ibm.com, pasic@linux.ibm.com, pragyansri.pathi@intel.com, andi.kleen@intel.com, thuth@redhat.com, Eduardo Habkost , richard.henderson@linaro.org, dgilbert@redhat.com, Greg Kurz , qemu-s390x@nongnu.org, jun.nakajima@intel.com, Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , Marcelo Tosatti , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --9JSHP372f+2dzJ8X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 13, 2021 at 07:57:41AM +0100, Christian Borntraeger wrote: >=20 >=20 > On 13.01.21 01:57, David Gibson wrote: > > On Tue, Jan 12, 2021 at 12:36:07PM +0100, Cornelia Huck wrote: > > 65;6201;1c> On Tue, 12 Jan 2021 09:15:26 +0100 > >> Christian Borntraeger wrote: > >> > >>> On 12.01.21 05:45, David Gibson wrote: > >>>> At least some s390 cpu models support "Protected Virtualization" (PV= ), > >>>> a mechanism to protect guests from eavesdropping by a compromised > >>>> hypervisor. > >>>> > >>>> This is similar in function to other mechanisms like AMD's SEV and > >>>> POWER's PEF, which are controlled by the "confidential-guest-support" > >>>> machine option. s390 is a slightly special case, because we already > >>>> supported PV, simply by using a CPU model with the required feature > >>>> (S390_FEAT_UNPACK). > >>>> > >>>> To integrate this with the option used by other platforms, we > >>>> implement the following compromise: > >>>> > >>>> - When the confidential-guest-support option is set, s390 will > >>>> recognize it, verify that the CPU can support PV (failing if not) > >>>> and set virtio default options necessary for encrypted or protect= ed > >>>> guests, as on other platforms. i.e. if confidential-guest-support > >>>> is set, we will either create a guest capable of entering PV mode, > >>>> or fail outright. > >>>> > >>>> - If confidential-guest-support is not set, guests might still be > >>>> able to enter PV mode, if the CPU has the right model. This may = be > >>>> a little surprising, but shouldn't actually be harmful. > >>>> > >>>> To start a guest supporting Protected Virtualization using the new > >>>> option use the command line arguments: > >>>> -object s390-pv-guest,id=3Dpv0 -machine confidential-guest-suppo= rt=3Dpv0 =20 > >>> > >>> > >>> This results in > >>> > >>> [cborntra@t35lp61 qemu]$ qemu-system-s390x -enable-kvm -nographic -m = 2G -kernel ~/full.normal=20 > >>> ** > >>> ERROR:../qom/object.c:317:type_initialize: assertion failed: (parent-= >instance_size <=3D ti->instance_size) > >>> Bail out! ERROR:../qom/object.c:317:type_initialize: assertion failed= : (parent->instance_size <=3D ti->instance_size) > >>> Aborted (core dumped) > >>> > >> > >>>> +static const TypeInfo s390_pv_guest_info =3D { > >>>> + .parent =3D TYPE_CONFIDENTIAL_GUEST_SUPPORT, > >>>> + .name =3D TYPE_S390_PV_GUEST, > >>>> + .instance_size =3D sizeof(S390PVGuestState), > >>>> + .interfaces =3D (InterfaceInfo[]) { > >>>> + { TYPE_USER_CREATABLE }, > >>>> + { } > >>>> + } > >>>> +}; > >> > >> I think this needs TYPE_OBJECT in .parent and > >> TYPE_CONFIDENTIAL_GUEST_SUPPORT as an interface to fix the crash. > >=20 > > No, that was true of an earlier revision, but parent is correct in the > > current version. >=20 > right now parent is obviously wrong as it triggers the above warning (and= all other > variants in the previous patches also use TYPE_OBJECT). It is probably th= e right > thing when you fix >=20 > +struct S390PVGuestState { > + Object parent_obj; > +}; > + >=20 > and change Object to the proper type I guess.=20 Yes, I think so. In the next spin I've fixed the parent_obj field (as well as moving to OBJECT_DEFINE_TYPE()) and it's passing the gitlab CI, at least. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --9JSHP372f+2dzJ8X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl//iKAACgkQbDjKyiDZ s5IR0A/7BBeaYAmNps8ImKrO4gmSvb0Jig0f5roEqltdtvjDftPVyERhoLlmNy/5 5T7F5E1y8zCDNAogE4vR20KzAWt02b6No74Hv0syBg6B2MKbiOeUgLj2mewW/EHK SDM9OOt5DmqZoc66h4wwWXxQtFcCF5nIHa0cBcOebz4xSwlqCYgQsKMAkynHhDH/ aPiUaOnnxsKHRZvBVxZ5nEQIvXtCuWNQZ900EYcxkh9dOyVqoi9Jc5dioJs7ssI4 60OSboTJD9dLqIXCIV8ByNlB2VaByBjupMbKFZ8xxgL/jy6qciq4wVkliA0Sdh4y uNm4jlCLKcnK/Lu5PpNCdPIZynsF5LemnT87GkycwcYRF9gWsoilcWpjHQJxD4jM ZcpViwd72wd9nYAHq9CJbQeZUSi6Zmw63XbzoTDibt+pXT/5s8XNU8Kw1Jg/Afzg IBl8MHanbvqO7LkRLTOUPm3zid3MT4SQmiEi3znnbSgYWD6M1HdNsr+Gp1y8DE7G erkAlkasZqVoXTNp6YCAb10rLy8IG9+AIlCiuXQ+yAgdxEc9uCsXma4jj2Bc/ZiL yEw4BBtxmtvhadShuikPPCQwipgZpKHPy97tqIqF3v4+yNLu6UKtCH4uwDF5wBQA OQCmQ68LLyXmp17KG6DqbJ+Jsiekdk8ChGaZhpyIjsL5EIZHMyU= =VKL8 -----END PGP SIGNATURE----- --9JSHP372f+2dzJ8X--