Project

General

Profile

Bug #12749

gcc10 complains about vmcb_state struct packing

Added by Patrick Mooney about 2 months ago.

Status:
New
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
bhyve
Gerrit CR:

Description

As noted in #12746, gcc10 was complaining about pointer access into the vmcb_state struct:

../../i86pc/io/vmm/amd/svm.c: In function 'svm_vmexit':
../../i86pc/io/vmm/amd/svm.c:1522:49: error: taking address of packed member of 'struct vmcb_state' may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1522 |   handled = x86_emulate_cpuid(svm_sc->vm, vcpu, &state->rax,
      |                                                 ^~~~~~~~~~~
cc1: all warnings being treated as errors
Even with the CPUID issues resolved, it's still not happy about those accesses. Closer inspection of the vmcb_state struct calls into question the necessity of its packed status. We can probably remove the packed attribute, and verify its offsets with CTASSERT() to safely address the warning.

Related issues

Related to illumos gate - Bug #12746: x86_emulate_cpuid() should clear upper 32 bitsClosed

Actions

History

#1

Updated by Patrick Mooney about 2 months ago

  • Related to Bug #12746: x86_emulate_cpuid() should clear upper 32 bits added

Also available in: Atom PDF