All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Sergio Lopez <slp@redhat.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	kvm@vger.kernel.org, Connor Kuehl <ckuehl@redhat.com>,
	James Bottomley <jejb@linux.ibm.com>,
	Dov Murik <dovmurik@linux.ibm.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build
Date: Thu, 7 Oct 2021 13:25:28 +0100	[thread overview]
Message-ID: <YV7nOJolgSSIX5Wf@work-vm> (raw)
In-Reply-To: <8f12bc3e-53aa-c946-bb06-f7d08721b243@redhat.com>

* 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 <dgilbert@redhat.com>
> >> Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> >> ---
> >>   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


WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>,
	Sergio Lopez <slp@redhat.com>,
	kvm@vger.kernel.org, Connor Kuehl <ckuehl@redhat.com>,
	James Bottomley <jejb@linux.ibm.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	qemu-devel@nongnu.org, Dov Murik <dovmurik@linux.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build
Date: Thu, 7 Oct 2021 13:25:28 +0100	[thread overview]
Message-ID: <YV7nOJolgSSIX5Wf@work-vm> (raw)
In-Reply-To: <8f12bc3e-53aa-c946-bb06-f7d08721b243@redhat.com>

* 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 <dgilbert@redhat.com>
> >> Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> >> ---
> >>   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



  reply	other threads:[~2021-10-07 12:25 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02 12:52 [PATCH v3 00/22] target/i386/sev: Housekeeping SEV + measured Linux SEV guest Philippe Mathieu-Daudé
2021-10-02 12:52 ` Philippe Mathieu-Daudé
2021-10-02 12:52 ` [PATCH v3 01/22] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines Philippe Mathieu-Daudé
2021-10-02 12:52   ` Philippe Mathieu-Daudé
2021-10-04  8:05   ` Paolo Bonzini
2021-10-04  8:05     ` Paolo Bonzini
2021-10-02 12:52 ` [PATCH v3 02/22] qapi/misc-target: Group SEV QAPI definitions Philippe Mathieu-Daudé
2021-10-02 12:52   ` Philippe Mathieu-Daudé
2021-10-04  8:05   ` Paolo Bonzini
2021-10-02 12:52 ` [PATCH v3 03/22] target/i386/kvm: Introduce i386_softmmu_kvm Meson source set Philippe Mathieu-Daudé
2021-10-02 12:52   ` Philippe Mathieu-Daudé
2021-10-04  8:06   ` Paolo Bonzini
2021-10-02 12:52 ` [PATCH v3 04/22] target/i386/kvm: Restrict SEV stubs to x86 architecture Philippe Mathieu-Daudé
2021-10-02 12:52   ` Philippe Mathieu-Daudé
2021-10-04  8:06   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:11   ` Paolo Bonzini
2021-10-07 11:29     ` Philippe Mathieu-Daudé
2021-10-07 11:29       ` Philippe Mathieu-Daudé
2021-10-07 12:25       ` Dr. David Alan Gilbert [this message]
2021-10-07 12:25         ` Dr. David Alan Gilbert
2021-10-02 12:53 ` [PATCH v3 06/22] target/i386/cpu: Add missing 'qapi/error.h' header Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:11   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 07/22] target/i386/sev_i386.h: Remove unused headers Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:11   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 08/22] target/i386/sev: Remove sev_get_me_mask() Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:11   ` Paolo Bonzini
2021-10-04  8:11   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 09/22] target/i386/sev: Mark unreachable code with g_assert_not_reached() Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:12   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 10/22] target/i386/sev: sev_get_attestation_report use g_autofree Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:13   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 11/22] target/i386/sev: Restrict SEV to system emulation Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:14   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 12/22] target/i386/sev: Declare system-specific functions in 'sev_i386.h' Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:15   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 13/22] target/i386/sev: Remove stubs by using code elision Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:19   ` Paolo Bonzini
2021-10-06 18:55     ` Philippe Mathieu-Daudé
2021-10-08 15:46       ` Brijesh Singh
2021-10-02 12:53 ` [PATCH v3 14/22] target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:23   ` Paolo Bonzini
2021-10-06 20:45     ` Philippe Mathieu-Daudé
2021-10-04  9:57   ` Dr. David Alan Gilbert
2021-10-04  9:57     ` Dr. David Alan Gilbert
2021-10-07  9:48     ` Philippe Mathieu-Daudé
2021-10-07  9:48       ` Philippe Mathieu-Daudé
2021-10-02 12:53 ` [PATCH v3 15/22] target/i386/sev: Move qmp_sev_inject_launch_secret() " Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:24   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 16/22] target/i386/sev: Move qmp_query_sev_capabilities() " Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:24   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 17/22] target/i386/sev: Move qmp_query_sev_launch_measure() " Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:24   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 18/22] target/i386/sev: Move qmp_query_sev() & hmp_info_sev() " Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:24   ` Paolo Bonzini
2021-10-02 12:53 ` [PATCH v3 19/22] monitor: Restrict 'info sev' to x86 targets Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:26   ` Paolo Bonzini
2021-10-07 15:18     ` Philippe Mathieu-Daudé
2021-10-02 12:53 ` [PATCH v3 20/22] sev/i386: Introduce sev_add_kernel_loader_hashes for measured linux boot Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-02 12:53 ` [PATCH v3 21/22] x86/sev: generate SEV kernel loader hashes in x86_load_linux Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-02 12:53 ` [PATCH v3 22/22] MAINTAINERS: Cover AMD SEV files Philippe Mathieu-Daudé
2021-10-02 12:53   ` Philippe Mathieu-Daudé
2021-10-04  8:27   ` Paolo Bonzini
2021-10-06 20:35     ` Philippe Mathieu-Daudé
2021-10-04  8:27 ` [PATCH v3 00/22] target/i386/sev: Housekeeping SEV + measured Linux SEV guest Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YV7nOJolgSSIX5Wf@work-vm \
    --to=dgilbert@redhat.com \
    --cc=berrange@redhat.com \
    --cc=brijesh.singh@amd.com \
    --cc=ckuehl@redhat.com \
    --cc=dovmurik@linux.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=slp@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.