RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2040820 - RFE: provide a command to pretty-print the contents of a VMSA dump
Summary: RFE: provide a command to pretty-print the contents of a VMSA dump
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: sevctl
Version: 9.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Cole Robinson
QA Contact: zixchen
URL:
Whiteboard:
Depends On: 2085085
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-14 18:43 UTC by Daniel Berrangé
Modified: 2022-11-15 11:38 UTC (History)
5 users (show)

Fixed In Version: sevctl-0.3.0-4.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 10:31:18 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-108222 0 None None None 2022-01-14 18:44:38 UTC
Red Hat Product Errata RHBA-2022:8171 0 None None None 2022-11-15 10:31:37 UTC

Description Daniel Berrangé 2022-01-14 18:43:09 UTC
Description of problem:
When validating the measurement of a SEV-ES guest, it is necessary to provide the expected VMSA state for the boot CPU and non-boot CPUs. This is a 4096 byte binary blob of register state.

In the Linux kernel this is represented by 'struct vmcb_save_area' from  arch/x86/include/asm/svm.h

As a debugging aid it is desirable if there was a tool to pretty print the contents of the VMSA binary file. Essentially to display the register names and their associated values.

This will aid users/admins in understanding whether the content for any given VMSA is sane, and/or identifying what the semantics differences are if anything changes in a platform.

This feels like a use case for a 'sevctl' command. For example this potential output format:

$ sevctl dump-vmsa vcpu0.bin
es.selector         : <zero>
es.attrib           : 0x0093
es.limit            : 0x0000ffff
es.base             : <zero>
cs.selector         : 0xf000
cs.attrib           : 0x009b
cs.limit            : 0x0000ffff
cs.base             : 0x00000000ffff0000
ss.selector         : <zero>
ss.attrib           : 0x0093
ss.limit            : 0x0000ffff
ss.base             : <zero>
ds.selector         : <zero>
ds.attrib           : 0x0093
ds.limit            : 0x0000ffff
ds.base             : <zero>
fs.selector         : <zero>
fs.attrib           : 0x0093
fs.limit            : 0x0000ffff
fs.base             : <zero>
gs.selector         : <zero>
gs.attrib           : 0x0093
gs.limit            : 0x0000ffff
gs.base             : <zero>
gdtr.selector       : <zero>
gdtr.attrib         : <zero>
gdtr.limit          : 0x0000ffff
gdtr.base           : <zero>
ldtr.selector       : <zero>
ldtr.attrib         : 0x0082
ldtr.limit          : 0x0000ffff
ldtr.base           : <zero>
idtr.selector       : <zero>
idtr.attrib         : <zero>
idtr.limit          : 0x0000ffff
idtr.base           : <zero>
tr.selector         : <zero>
tr.attrib           : 0x008b
tr.limit            : 0x0000ffff
tr.base             : <zero>
reserved_1          : <zero>
cpl                 : <zero>
reserved_2          : <zero>
efer                : 0x0000000000001000
reserved_3          : <zero>
xss                 : <zero>
cr4                 : 0x0000000000000040
cr3                 : <zero>
cr0                 : 0x0000000000000010
dr7                 : 0x0000000000000400
dr6                 : 0x00000000ffff0ff0
rflags              : 0x0000000000000002
rip                 : 0x000000000000fff0
reserved_4          : <zero>
rsp                 : <zero>
reserved_5          : <zero>
rax                 : <zero>
star                : <zero>
lstar               : <zero>
cstar               : <zero>
sfmask              : <zero>
kernel_gs_base      : <zero>
sysenter_cs         : <zero>
sysenter_esp        : <zero>
sysenter_eip        : <zero>
cr2                 : <zero>
reserved_6          : <zero>
g_pat               : 0x0007040600070406
dbgctl              : <zero>
br_from             : <zero>
br_to               : <zero>
last_excp_from      : <zero>
last_excp_to        : <zero>
reserved_7          : <zero>
spec_ctrl           : <zero>
reserved_7b         : <zero>
pkru                : <zero>
reserved_7a         : <zero>
reserved_8          : <zero>
rcx                 : <zero>
rdx                 : 0x0000000000830f10
rbx                 : <zero>
reserved_9          : <zero>
rbp                 : <zero>
rsi                 : <zero>
rdi                 : <zero>
r8                  : <zero>
r9                  : <zero>
r10                 : <zero>
r11                 : <zero>
r12                 : <zero>
r13                 : <zero>
r14                 : <zero>
r15                 : <zero>
reserved_10         : <zero>
sw_exit_code        : <zero>
sw_exit_info_1      : <zero>
sw_exit_info_2      : <zero>
sw_scratch          : <zero>
reserved_11         : <zero>
xcr0                : 0x0000000000000001
valid_bitmap        : <zero>
x87_state_gpa       : <zero>
padding             : <zero>


Allowing comparison of vCPU 0 and vCPU 1:

$ sevctl dump-vmsa vcpu0.bin > a
$ sevctl dump-vmsa vcpu0.bin > b
$ diff -u a b
--- a	2022-01-14 18:41:44.034487235 +0000
+++ b	2022-01-14 18:41:46.938469381 +0000
@@ -5,7 +5,7 @@
 cs.selector         : 0xf000
 cs.attrib           : 0x009b
 cs.limit            : 0x0000ffff
-cs.base             : 0x00000000ffff0000
+cs.base             : 0x0000000000800000
 ss.selector         : <zero>
 ss.attrib           : 0x0093
 ss.limit            : 0x0000ffff
@@ -50,7 +50,7 @@
 dr7                 : 0x0000000000000400
 dr6                 : 0x00000000ffff0ff0
 rflags              : 0x0000000000000002
-rip                 : 0x000000000000fff0
+rip                 : 0x000000000000b004
 reserved_4          : <zero>
 rsp                 : <zero>
 reserved_5          : <zero>


shows the reset vector addresses associated with the OVMF loader in use.

Comment 3 John Ferlan 2022-05-12 20:30:42 UTC
upstream code posted: https://github.com/virtee/sevctl/pull/18

Will eventually be resolved as part of rebase to new sevctl release

Comment 4 John Ferlan 2022-05-12 21:00:59 UTC
Cole - IIUC, you're doing the pretty print part of the work while Tyler is doing the build & dump part of the work

Comment 5 John Ferlan 2022-06-17 12:58:42 UTC
Changes have been merged upstream: https://github.com/virtee/sevctl/commit/f11015f523935895c5ca116e599c9fdc863dd92c

Moving to POST and awaiting the sevctl rebase to be completed.

Comment 6 zixchen 2022-07-05 02:48:44 UTC
Test with sevctl-0.3.0-4.el9, sevctl vmsa show passed.

Version:
sevctl-0.3.0-4.el9
kernel-5.14.0-121.el9.x86_64

# sevctl vmsa show NEW-VMSA0.bin 
{
  "es": {
    "selector": 0,
    "attrib": 147,
    "limit": 65535,
    "base": 0
  },
  "cs": {
    "selector": 61440,
    "attrib": 155,
    "limit": 65535,
    "base": 8388608
  },
  "ss": {
    "selector": 0,
    "attrib": 147,
    "limit": 65535,
    "base": 0
  },
  "ds": {
    "selector": 0,
    "attrib": 147,
    "limit": 65535,
    "base": 0
  },
  "fs": {
    "selector": 0,
    "attrib": 147,
    "limit": 65535,
    "base": 0
  },
  "gs": {
    "selector": 0,
    "attrib": 147,
    "limit": 65535,
    "base": 0
  },
  "gdtr": {
    "selector": 0,
    "attrib": 0,
    "limit": 65535,
    "base": 0
  },
  "ldtr": {
    "selector": 0,
    "attrib": 130,
    "limit": 65535,
    "base": 0
  },
  "idtr": {
    "selector": 0,
    "attrib": 0,
    "limit": 65535,
    "base": 0
  },
  "tr": {
    "selector": 0,
    "attrib": 139,
    "limit": 65535,
    "base": 0
  },
  "reserved_1": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "cpl": 0,
  "reserved_2": [
    0,
    0,
    0,
    0
  ],
  "efer": 4096,
  "reserved_3": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "xss": 0,
  "cr4": 64,
  "cr3": 0,
  "cr0": 16,
  "dr7": 1024,
  "dr6": 4294905840,
  "rflags": 2,
  "rip": 32772,
  "reserved_4": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "rsp": 0,
  "reserved_5": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "rax": 0,
  "star": 0,
  "lstar": 0,
  "cstar": 0,
  "sfmask": 0,
  "kernel_gs_base": 0,
  "sysenter_cs": 0,
  "sysenter_esp": 0,
  "sysenter_eip": 0,
  "cr2": 0,
  "reserved_6": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "g_pat": 1974748653749254,
  "dbgctl": 0,
  "br_from": 0,
  "br_to": 0,
  "last_excp_from": 0,
  "last_excp_to": 0,
  "reserved_7": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "spec_ctrl": 0,
  "reserved_7b": [
    0,
    0,
    0,
    0
  ],
  "pkru": 0,
  "reserved_7a": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "reserved_8": 0,
  "rcx": 0,
  "rdx": 10489617,
  "rbx": 0,
  "reserved_9": 0,
  "rbp": 0,
  "rsi": 0,
  "rdi": 0,
  "r8": 0,
  "r9": 0,
  "r10": 0,
  "r11": 0,
  "r12": 0,
  "r13": 0,
  "r14": 0,
  "r15": 0,
  "reserved_10": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "sw_exit_code": 0,
  "sw_exit_info_1": 0,
  "sw_exit_info_2": 0,
  "sw_scratch": 0,
  "reserved_11": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "xcr0": 1,
  "valid_bitmap": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "x87_state_gpa": 0
}

Comment 9 zixchen 2022-07-05 09:59:32 UTC
Since sevctl-0.3.0-4.el9 is already tested, move this to VERIFIED

Comment 11 errata-xmlrpc 2022-11-15 10:31:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sevctl bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8171


Note You need to log in before you can comment on or make changes to this bug.