* [PULL 0/3] Misc changes for 2022-04-05
@ 2022-04-05 9:19 Paolo Bonzini
2022-04-05 9:19 ` [PULL 1/3] coverity: update model for latest tools Paolo Bonzini
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-04-05 9:19 UTC (permalink / raw)
To: qemu-devel
The following changes since commit 20661b75ea6093f5e59079d00a778a972d6732c5:
Merge tag 'pull-ppc-20220404' of https://github.com/legoater/qemu into staging (2022-04-04 15:48:55 +0100)
are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 776a6a32b4982a68d3b7a77cbfaae6c2b363a0b8:
docs/system/i386: Add measurement calculation details to amd-memory-encryption (2022-04-05 10:42:06 +0200)
----------------------------------------------------------------
* fix vss-win32 compilation with clang++
* update Coverity model
* add measurement calculation to amd-memory-encryption docs
----------------------------------------------------------------
Dov Murik (1):
docs/system/i386: Add measurement calculation details to amd-memory-encryption
Helge Konetzka (1):
qga/vss-win32: fix compilation with clang++
Paolo Bonzini (1):
coverity: update model for latest tools
docs/system/i386/amd-memory-encryption.rst | 54 +++++++++++++++++++++++++++---
qga/vss-win32/install.cpp | 3 +-
scripts/coverity-scan/model.c | 3 +-
3 files changed, 54 insertions(+), 6 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PULL 1/3] coverity: update model for latest tools
2022-04-05 9:19 [PULL 0/3] Misc changes for 2022-04-05 Paolo Bonzini
@ 2022-04-05 9:19 ` Paolo Bonzini
2022-04-05 9:20 ` [PULL 2/3] qga/vss-win32: fix compilation with clang++ Paolo Bonzini
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-04-05 9:19 UTC (permalink / raw)
To: qemu-devel
Coverity is now rejecting incomplete types in the modeling file.
Just use a random number (in the neighborhood of the actual one)
for the size of a GIOChannel.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/coverity-scan/model.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/coverity-scan/model.c b/scripts/coverity-scan/model.c
index 9d4fba53d9..686d1a3008 100644
--- a/scripts/coverity-scan/model.c
+++ b/scripts/coverity-scan/model.c
@@ -356,7 +356,8 @@ int g_poll (GPollFD *fds, unsigned nfds, int timeout)
typedef struct _GIOChannel GIOChannel;
GIOChannel *g_io_channel_unix_new(int fd)
{
- GIOChannel *c = g_malloc0(sizeof(GIOChannel));
+ /* cannot use incomplete type, the actual struct is roughly this size. */
+ GIOChannel *c = g_malloc0(20 * sizeof(void *));
__coverity_escape__(fd);
return c;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 2/3] qga/vss-win32: fix compilation with clang++
2022-04-05 9:19 [PULL 0/3] Misc changes for 2022-04-05 Paolo Bonzini
2022-04-05 9:19 ` [PULL 1/3] coverity: update model for latest tools Paolo Bonzini
@ 2022-04-05 9:20 ` Paolo Bonzini
2022-04-05 9:20 ` [PULL 3/3] docs/system/i386: Add measurement calculation details to amd-memory-encryption Paolo Bonzini
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-04-05 9:20 UTC (permalink / raw)
To: qemu-devel
Cc: Marc-André Lureau, Helge Konetzka,
Philippe Mathieu-Daudé,
Konstantin Kostiuk
From: Helge Konetzka <hk@zapateado.de>
This fixes:
qga/vss-win32/install.cpp:49:24: error: cannot initialize a variable of
type 'char *' with an rvalue of type 'const char *'
char *msg = NULL, *nul = strchr(text, '(');
^ ~~~~~~~~~~~~~~~~~
Signed-off-by: Helge Konetzka <hk@zapateado.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Message-Id: <39400817-3dc9-516d-9096-bc1f68862531@zapateado.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qga/vss-win32/install.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 8076efe3cb..b57508fbe0 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -46,7 +46,8 @@ void errmsg(DWORD err, const char *text)
* If text doesn't contains '(', negative precision is given, which is
* treated as though it were missing.
*/
- char *msg = NULL, *nul = strchr(text, '(');
+ char *msg = NULL;
+ const char *nul = strchr(text, '(');
int len = nul ? nul - text : -1;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 3/3] docs/system/i386: Add measurement calculation details to amd-memory-encryption
2022-04-05 9:19 [PULL 0/3] Misc changes for 2022-04-05 Paolo Bonzini
2022-04-05 9:19 ` [PULL 1/3] coverity: update model for latest tools Paolo Bonzini
2022-04-05 9:20 ` [PULL 2/3] qga/vss-win32: fix compilation with clang++ Paolo Bonzini
@ 2022-04-05 9:20 ` Paolo Bonzini
2022-04-05 11:42 ` [PULL 0/3] Misc changes for 2022-04-05 Peter Maydell
2022-04-05 18:46 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-04-05 9:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Dov Murik, Daniel P . Berrangé, Dr . David Alan Gilbert
From: Dov Murik <dovmurik@linux.ibm.com>
Add a section explaining how the Guest Owner should calculate the
expected guest launch measurement for SEV and SEV-ES.
Also update the name and links to the SEV API Spec document.
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20220217110059.2320497-1-dovmurik@linux.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/system/i386/amd-memory-encryption.rst | 54 ++++++++++++++++++++--
1 file changed, 50 insertions(+), 4 deletions(-)
diff --git a/docs/system/i386/amd-memory-encryption.rst b/docs/system/i386/amd-memory-encryption.rst
index 215946f813..dcf4add0e7 100644
--- a/docs/system/i386/amd-memory-encryption.rst
+++ b/docs/system/i386/amd-memory-encryption.rst
@@ -47,7 +47,7 @@ The guest policy is passed as plaintext. A hypervisor may choose to read it,
but should not modify it (any modification of the policy bits will result
in bad measurement). The guest policy is a 4-byte data structure containing
several flags that restricts what can be done on a running SEV guest.
-See KM Spec section 3 and 6.2 for more details.
+See SEV API Spec ([SEVAPI]_) section 3 and 6.2 for more details.
The guest policy can be provided via the ``policy`` property::
@@ -92,7 +92,7 @@ expects.
``LAUNCH_FINISH`` finalizes the guest launch and destroys the cryptographic
context.
-See SEV KM API Spec ([SEVKM]_) 'Launching a guest' usage flow (Appendix A) for the
+See SEV API Spec ([SEVAPI]_) 'Launching a guest' usage flow (Appendix A) for the
complete flow chart.
To launch a SEV guest::
@@ -118,6 +118,49 @@ a SEV-ES guest:
- Requires in-kernel irqchip - the burden is placed on the hypervisor to
manage booting APs.
+Calculating expected guest launch measurement
+---------------------------------------------
+
+In order to verify the guest launch measurement, The Guest Owner must compute
+it in the exact same way as it is calculated by the AMD-SP. SEV API Spec
+([SEVAPI]_) section 6.5.1 describes the AMD-SP operations:
+
+ GCTX.LD is finalized, producing the hash digest of all plaintext data
+ imported into the guest.
+
+ The launch measurement is calculated as:
+
+ HMAC(0x04 || API_MAJOR || API_MINOR || BUILD || GCTX.POLICY || GCTX.LD || MNONCE; GCTX.TIK)
+
+ where "||" represents concatenation.
+
+The values of API_MAJOR, API_MINOR, BUILD, and GCTX.POLICY can be obtained
+from the ``query-sev`` qmp command.
+
+The value of MNONCE is part of the response of ``query-sev-launch-measure``: it
+is the last 16 bytes of the base64-decoded data field (see SEV API Spec
+([SEVAPI]_) section 6.5.2 Table 52: LAUNCH_MEASURE Measurement Buffer).
+
+The value of GCTX.LD is
+``SHA256(firmware_blob || kernel_hashes_blob || vmsas_blob)``, where:
+
+* ``firmware_blob`` is the content of the entire firmware flash file (for
+ example, ``OVMF.fd``). Note that you must build a stateless firmware file
+ which doesn't use an NVRAM store, because the NVRAM area is not measured, and
+ therefore it is not secure to use a firmware which uses state from an NVRAM
+ store.
+* if kernel is used, and ``kernel-hashes=on``, then ``kernel_hashes_blob`` is
+ the content of PaddedSevHashTable (including the zero padding), which itself
+ includes the hashes of kernel, initrd, and cmdline that are passed to the
+ guest. The PaddedSevHashTable struct is defined in ``target/i386/sev.c``.
+* if SEV-ES is enabled (``policy & 0x4 != 0``), ``vmsas_blob`` is the
+ concatenation of all VMSAs of the guest vcpus. Each VMSA is 4096 bytes long;
+ its content is defined inside Linux kernel code as ``struct vmcb_save_area``,
+ or in AMD APM Volume 2 ([APMVOL2]_) Table B-2: VMCB Layout, State Save Area.
+
+If kernel hashes are not used, or SEV-ES is disabled, use empty blobs for
+``kernel_hashes_blob`` and ``vmsas_blob`` as needed.
+
Debugging
---------
@@ -142,8 +185,11 @@ References
`AMD Memory Encryption whitepaper
<https://developer.amd.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf>`_
-.. [SEVKM] `Secure Encrypted Virtualization Key Management
- <http://developer.amd.com/wordpress/media/2017/11/55766_SEV-KM-API_Specification.pdf>`_
+.. [SEVAPI] `Secure Encrypted Virtualization API
+ <https://www.amd.com/system/files/TechDocs/55766_SEV-KM_API_Specification.pdf>`_
+
+.. [APMVOL2] `AMD64 Architecture Programmer's Manual Volume 2: System Programming
+ <https://www.amd.com/system/files/TechDocs/24593.pdf>`_
KVM Forum slides:
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PULL 0/3] Misc changes for 2022-04-05
2022-04-05 9:19 [PULL 0/3] Misc changes for 2022-04-05 Paolo Bonzini
` (2 preceding siblings ...)
2022-04-05 9:20 ` [PULL 3/3] docs/system/i386: Add measurement calculation details to amd-memory-encryption Paolo Bonzini
@ 2022-04-05 11:42 ` Peter Maydell
2022-04-05 18:46 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2022-04-05 11:42 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Tue, 5 Apr 2022 at 10:25, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 20661b75ea6093f5e59079d00a778a972d6732c5:
>
> Merge tag 'pull-ppc-20220404' of https://github.com/legoater/qemu into staging (2022-04-04 15:48:55 +0100)
>
> are available in the Git repository at:
>
> https://gitlab.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 776a6a32b4982a68d3b7a77cbfaae6c2b363a0b8:
>
> docs/system/i386: Add measurement calculation details to amd-memory-encryption (2022-04-05 10:42:06 +0200)
>
> ----------------------------------------------------------------
> * fix vss-win32 compilation with clang++
>
> * update Coverity model
>
> * add measurement calculation to amd-memory-encryption docs
>
> ----------------------------------------------------------------
Hi; this tag doesn't match what your pullreq cover letter claims
it is -- it is pointing at 267b85d4e3d15, not 776a6a32b49, and
it has way more than 3 patches in it.
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PULL 0/3] Misc changes for 2022-04-05
2022-04-05 9:19 [PULL 0/3] Misc changes for 2022-04-05 Paolo Bonzini
` (3 preceding siblings ...)
2022-04-05 11:42 ` [PULL 0/3] Misc changes for 2022-04-05 Peter Maydell
@ 2022-04-05 18:46 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2022-04-05 18:46 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Tue, 5 Apr 2022 at 10:25, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 20661b75ea6093f5e59079d00a778a972d6732c5:
>
> Merge tag 'pull-ppc-20220404' of https://github.com/legoater/qemu into staging (2022-04-04 15:48:55 +0100)
>
> are available in the Git repository at:
>
> https://gitlab.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 776a6a32b4982a68d3b7a77cbfaae6c2b363a0b8:
>
> docs/system/i386: Add measurement calculation details to amd-memory-encryption (2022-04-05 10:42:06 +0200)
>
> ----------------------------------------------------------------
> * fix vss-win32 compilation with clang++
>
> * update Coverity model
>
> * add measurement calculation to amd-memory-encryption docs
>
> ----------------------------------------------------------------
> Dov Murik (1):
> docs/system/i386: Add measurement calculation details to amd-memory-encryption
>
> Helge Konetzka (1):
> qga/vss-win32: fix compilation with clang++
>
> Paolo Bonzini (1):
> coverity: update model for latest tools
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-05 18:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 9:19 [PULL 0/3] Misc changes for 2022-04-05 Paolo Bonzini
2022-04-05 9:19 ` [PULL 1/3] coverity: update model for latest tools Paolo Bonzini
2022-04-05 9:20 ` [PULL 2/3] qga/vss-win32: fix compilation with clang++ Paolo Bonzini
2022-04-05 9:20 ` [PULL 3/3] docs/system/i386: Add measurement calculation details to amd-memory-encryption Paolo Bonzini
2022-04-05 11:42 ` [PULL 0/3] Misc changes for 2022-04-05 Peter Maydell
2022-04-05 18:46 ` Peter Maydell
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.