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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 569F7C433EF for ; Thu, 7 Oct 2021 12:25:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EC086124A for ; Thu, 7 Oct 2021 12:25:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241308AbhJGM12 (ORCPT ); Thu, 7 Oct 2021 08:27:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37302 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241197AbhJGM12 (ORCPT ); Thu, 7 Oct 2021 08:27:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633609534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wPzCUic6CYIMy5ARHGSfae0aVwrn1CpgSsq1foikCFo=; b=Ip64Ea21sg8e/3GjPft2cUL/siACw0CiSMNuAc9Mmh+0lYZcoXKOrZbSLKsJiUwohn/Ic/ G8I+n1Zx8hGeTxy8Z8fBSmQqntpovbrS+tn/0uPv/mGa5BQKQoxH9W67ty2LG5/B2WpnvK qyvPueEXytAZbxAZBu51vZXJH6BnmUQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-461-xLTmpATrPPGGvDnlwnSPPw-1; Thu, 07 Oct 2021 08:25:33 -0400 X-MC-Unique: xLTmpATrPPGGvDnlwnSPPw-1 Received: by mail-wr1-f69.google.com with SMTP id s18-20020adfbc12000000b00160b2d4d5ebso4577914wrg.7 for ; Thu, 07 Oct 2021 05:25:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=wPzCUic6CYIMy5ARHGSfae0aVwrn1CpgSsq1foikCFo=; b=Ltd61WTk5SKTyC/CE4jDAHNaHOHyE2Lt730PB+i4qK2n50wiaqoSeW4+BEhZNP8y8Y 3NaLgF1j5Ov4paIT2lYTs/aMw5wEiEumKSCqDexUBsqSjavDZK7q05yKJWk+ksSLFiH7 xjS/DwMaJfRrRGDwGqHTefe4RkSrf/RJeez5JSNghnC8JDLmWpfRBdZkZa4fgMyK2XGt bU2FpEcf5V1pgFLvsu9jeEHtKsXCsKipYOuaY1V2fZe25QCMZ1Pyq3qAt4YXQ0z/mOxm r5sfYWhwvYLbJ3VAqPKa/zq4s3AmbsmfAqxWFN2YP/rI1oGFRAUaVeb8BTVc+vDWxTDA 1/lQ== X-Gm-Message-State: AOAM532tO8JCduVelRlE3kWvHS1DMF/vl3eFMmCA1toJ987wo5Su+bAN qmgEK0w0DmxDVtzvDmyeuunpbHC6ajZ0IliBtqTSo8vA5EspkmAfPJiWRvYYOELCOjCkidj+zTr 5r0Bi2laplcRU X-Received: by 2002:adf:a413:: with SMTP id d19mr5034975wra.246.1633609532109; Thu, 07 Oct 2021 05:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhng+oeuXPF66rcVW/Ky2EelAOIslOG8kX+JhVf4qUHjTpWyaYVL3GY9nKDyOtcqagNm5w0g== X-Received: by 2002:adf:a413:: with SMTP id d19mr5034951wra.246.1633609531928; Thu, 07 Oct 2021 05:25:31 -0700 (PDT) Received: from work-vm (cpc109025-salf6-2-0-cust480.10-2.cable.virginm.net. [82.30.61.225]) by smtp.gmail.com with ESMTPSA id q3sm5544623wmf.11.2021.10.07.05.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 05:25:31 -0700 (PDT) Date: Thu, 7 Oct 2021 13:25:28 +0100 From: "Dr. David Alan Gilbert" To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: Paolo Bonzini , Sergio Lopez , Brijesh Singh , kvm@vger.kernel.org, Connor Kuehl , James Bottomley , Dov Murik , "Daniel P . Berrange" , Eduardo Habkost , qemu-devel@nongnu.org Subject: Re: [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build Message-ID: References: <20211002125317.3418648-1-philmd@redhat.com> <20211002125317.3418648-6-philmd@redhat.com> <8f12bc3e-53aa-c946-bb06-f7d08721b243@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8f12bc3e-53aa-c946-bb06-f7d08721b243@redhat.com> User-Agent: Mutt/2.0.7 (2021-05-04) Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org * Philippe Mathieu-Daudé (philmd@redhat.com) wrote: > On 10/4/21 10:11, Paolo Bonzini wrote: > > On 02/10/21 14:53, Philippe Mathieu-Daudé wrote: > >> If the management layer tries to inject a secret, it gets an empty > >> response in case the binary built without SEV: > >> > >>    { "execute": "sev-inject-launch-secret", > >>      "arguments": { "packet-header": "mypkt", "secret": "mypass", > >> "gpa": 4294959104 } > >>    } > >>    { > >>        "return": { > >>        } > >>    } > >> > >> Make it clearer by returning an error, mentioning the feature is > >> disabled: > >> > >>    { "execute": "sev-inject-launch-secret", > >>      "arguments": { "packet-header": "mypkt", "secret": "mypass", > >> "gpa": 4294959104 } > >>    } > >>    { > >>        "error": { > >>            "class": "GenericError", > >>            "desc": "this feature or command is not currently supported" > >>        } > >>    } > >> > >> Reviewed-by: Dr. David Alan Gilbert > >> Reviewed-by: Connor Kuehl > >> Signed-off-by: Philippe Mathieu-Daudé > >> --- > >>   target/i386/monitor.c | 5 +++++ > >>   1 file changed, 5 insertions(+) > >> > >> diff --git a/target/i386/monitor.c b/target/i386/monitor.c > >> index 196c1c9e77f..a9f85acd473 100644 > >> --- a/target/i386/monitor.c > >> +++ b/target/i386/monitor.c > >> @@ -28,6 +28,7 @@ > >>   #include "monitor/hmp-target.h" > >>   #include "monitor/hmp.h" > >>   #include "qapi/qmp/qdict.h" > >> +#include "qapi/qmp/qerror.h" > >>   #include "sysemu/kvm.h" > >>   #include "sysemu/sev.h" > >>   #include "qapi/error.h" > >> @@ -743,6 +744,10 @@ void qmp_sev_inject_launch_secret(const char > >> *packet_hdr, > >>                                     bool has_gpa, uint64_t gpa, > >>                                     Error **errp) > >>   { > >> +    if (!sev_enabled()) { > >> +        error_setg(errp, QERR_UNSUPPORTED); > >> +        return; > >> +    } > >>       if (!has_gpa) { > >>           uint8_t *data; > >>           struct sev_secret_area *area; > >> > > > > This should be done in the sev_inject_launch_secret stub instead, I > > think.  Or if you do it here, you can remove the "if (!sev_guest)" > > conditional in the non-stub version. > > This part is not related to SEV builtin; what we want to avoid here > is management layer to try to inject secret while the guest hasn't > been started with SEV (IOW 'no memory encryption requested for KVM). > > Maybe this error message is more explicit? > > error_setg(errp, "Guest is not using memory encryption"); > > Or: > > error_setg(errp, "Guest is not using SEV"); This is better; there's a separate feature called memory encryption, so we don't want to confuse things. Dave > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA724C433F5 for ; Thu, 7 Oct 2021 12:28:19 +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 6654C61042 for ; Thu, 7 Oct 2021 12:28:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6654C61042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYSVW-0002De-9y for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 08:28:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYSSw-000075-Gx for qemu-devel@nongnu.org; Thu, 07 Oct 2021 08:25:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYSSu-00072h-60 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 08:25:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633609534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wPzCUic6CYIMy5ARHGSfae0aVwrn1CpgSsq1foikCFo=; b=Ip64Ea21sg8e/3GjPft2cUL/siACw0CiSMNuAc9Mmh+0lYZcoXKOrZbSLKsJiUwohn/Ic/ G8I+n1Zx8hGeTxy8Z8fBSmQqntpovbrS+tn/0uPv/mGa5BQKQoxH9W67ty2LG5/B2WpnvK qyvPueEXytAZbxAZBu51vZXJH6BnmUQ= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-191-d1Hw0zRKPxOS8TO7iuaBNQ-1; Thu, 07 Oct 2021 08:25:33 -0400 X-MC-Unique: d1Hw0zRKPxOS8TO7iuaBNQ-1 Received: by mail-wr1-f70.google.com with SMTP id l6-20020adfa386000000b00160c4c1866eso4551243wrb.4 for ; Thu, 07 Oct 2021 05:25:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=wPzCUic6CYIMy5ARHGSfae0aVwrn1CpgSsq1foikCFo=; b=Aly6BWcdRkKEHaqrgLDbwJyGRfF2Yt57RGdiZFs3c4DmUXKIOBh8agw4VncGsIbAFJ k1gMuu9dHHlbxM1fbKvFUcHfhO2VOA6OA9OHlsvLNunHm6E940vz+aiCEItqztdiR50Z 14OlQ0QQSvrIUkJDNfbeRmpiJPSbl8T4VTspPU/DJJd6FBScWk5VbBsDCBcy+91pdpIw Md1tWLhfKqPze+OFgLwjavGkrg/Smyjlc7PHHPyQzcQ/pyZCXe0LbrhEljAtHy7PsLK+ 5VEObhC/Ta1vQ+B9+qbDY2NrZziW7ekTrYg0W8Ir3yrcGPlpVm5W3VMtolgWOsra/BM9 KRbg== X-Gm-Message-State: AOAM533QdiKTKlLFT/bF10iTSobjNEzpBvg/U7Q3A8XB0ZRkeGqMyGWS KMoO86sfWv7w6VUVOyCqCPueH5H9L5skyamfzeyLuYVmJYw/7eQAjWBod6U7gpslr3qOvgxzYqw seJdr5Ioj5rCIcsk= X-Received: by 2002:adf:a413:: with SMTP id d19mr5034977wra.246.1633609532109; Thu, 07 Oct 2021 05:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhng+oeuXPF66rcVW/Ky2EelAOIslOG8kX+JhVf4qUHjTpWyaYVL3GY9nKDyOtcqagNm5w0g== X-Received: by 2002:adf:a413:: with SMTP id d19mr5034951wra.246.1633609531928; Thu, 07 Oct 2021 05:25:31 -0700 (PDT) Received: from work-vm (cpc109025-salf6-2-0-cust480.10-2.cable.virginm.net. [82.30.61.225]) by smtp.gmail.com with ESMTPSA id q3sm5544623wmf.11.2021.10.07.05.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 05:25:31 -0700 (PDT) Date: Thu, 7 Oct 2021 13:25:28 +0100 From: "Dr. David Alan Gilbert" To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Subject: Re: [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build Message-ID: References: <20211002125317.3418648-1-philmd@redhat.com> <20211002125317.3418648-6-philmd@redhat.com> <8f12bc3e-53aa-c946-bb06-f7d08721b243@redhat.com> MIME-Version: 1.0 In-Reply-To: <8f12bc3e-53aa-c946-bb06-f7d08721b243@redhat.com> User-Agent: Mutt/2.0.7 (2021-05-04) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: Brijesh Singh , Sergio Lopez , kvm@vger.kernel.org, Connor Kuehl , James Bottomley , "Daniel P . Berrange" , qemu-devel@nongnu.org, Dov Murik , Paolo Bonzini , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" * Philippe Mathieu-Daudé (philmd@redhat.com) wrote: > On 10/4/21 10:11, Paolo Bonzini wrote: > > On 02/10/21 14:53, Philippe Mathieu-Daudé wrote: > >> If the management layer tries to inject a secret, it gets an empty > >> response in case the binary built without SEV: > >> > >>    { "execute": "sev-inject-launch-secret", > >>      "arguments": { "packet-header": "mypkt", "secret": "mypass", > >> "gpa": 4294959104 } > >>    } > >>    { > >>        "return": { > >>        } > >>    } > >> > >> Make it clearer by returning an error, mentioning the feature is > >> disabled: > >> > >>    { "execute": "sev-inject-launch-secret", > >>      "arguments": { "packet-header": "mypkt", "secret": "mypass", > >> "gpa": 4294959104 } > >>    } > >>    { > >>        "error": { > >>            "class": "GenericError", > >>            "desc": "this feature or command is not currently supported" > >>        } > >>    } > >> > >> Reviewed-by: Dr. David Alan Gilbert > >> Reviewed-by: Connor Kuehl > >> Signed-off-by: Philippe Mathieu-Daudé > >> --- > >>   target/i386/monitor.c | 5 +++++ > >>   1 file changed, 5 insertions(+) > >> > >> diff --git a/target/i386/monitor.c b/target/i386/monitor.c > >> index 196c1c9e77f..a9f85acd473 100644 > >> --- a/target/i386/monitor.c > >> +++ b/target/i386/monitor.c > >> @@ -28,6 +28,7 @@ > >>   #include "monitor/hmp-target.h" > >>   #include "monitor/hmp.h" > >>   #include "qapi/qmp/qdict.h" > >> +#include "qapi/qmp/qerror.h" > >>   #include "sysemu/kvm.h" > >>   #include "sysemu/sev.h" > >>   #include "qapi/error.h" > >> @@ -743,6 +744,10 @@ void qmp_sev_inject_launch_secret(const char > >> *packet_hdr, > >>                                     bool has_gpa, uint64_t gpa, > >>                                     Error **errp) > >>   { > >> +    if (!sev_enabled()) { > >> +        error_setg(errp, QERR_UNSUPPORTED); > >> +        return; > >> +    } > >>       if (!has_gpa) { > >>           uint8_t *data; > >>           struct sev_secret_area *area; > >> > > > > This should be done in the sev_inject_launch_secret stub instead, I > > think.  Or if you do it here, you can remove the "if (!sev_guest)" > > conditional in the non-stub version. > > This part is not related to SEV builtin; what we want to avoid here > is management layer to try to inject secret while the guest hasn't > been started with SEV (IOW 'no memory encryption requested for KVM). > > Maybe this error message is more explicit? > > error_setg(errp, "Guest is not using memory encryption"); > > Or: > > error_setg(errp, "Guest is not using SEV"); This is better; there's a separate feature called memory encryption, so we don't want to confuse things. Dave > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK