On Mon, 2024-06-24 at 14:50 +0100, Daniel P. Berrangé wrote:
> On Fri, Jun 21, 2024 at 03:29:03PM +0100, Roy Hopkins wrote:
> > Based-on: 02d9c38236
> >
> > Here is v3 of the set of patches to add support for IGVM files to QEMU.
> >
> > Firstly, apologies for the long gap between v2 and v3. This was due to a
> > number
> > of factors, but particularly holding back until SEV-SNP support landed in
> > QEMU
> > as well as for some changes to be merged in the upstream IGVM specification
> > and
> > library. The delay meant that I could include the SEV-SNP IGVM changes that
> > I
> > had been separately maintaining for COCONUT-SVSM into this series, giving
> > full
> > support for the full range of SEV technologies.
> >
> > Thank-you to everyone who reviewed the previous set of patches [1]. I
> > have hopefully addressed all of the comments in those reviews. Some of these
> > changes required a reasonable amount of rework. Along with the inclusion of
> > support for SEV-SNP, this has resulted in a fairly large set of differences
> > from
> > v2. This v3 patch series is also available on github: [2]
>
> snip
>
> FYI, I hit some compile problems reporting array bounds issues,
> with this posting. I'm using Fedora 40, which has gcc 14 in
> case that matters.
>
The reason I was not seeing this was because I included `--enable-debug` which
apparently hides the problem.
There is technically a bounds issue with the function overflowing the end of the
array for the TR and LDTR registers but, coincidently or not, it overflows into
the correct register storage meaning the code works correctly.
I've added a patch to fix this for v4.
>
> In file included from
> /var/home/berrange/src/virt/qemu/include/sysemu/kvm.h:214,
> from ../target/i386/sev.c:29:
> In function ‘cpu_x86_load_seg_cache’,
> inlined from ‘sev_apply_cpu_context’ at ../target/i386/sev.c:454:13:
> ../target/i386/cpu.h:2236:20: error: array subscript 6 is above array bounds
> of ‘SegmentCache[6]’ [-Werror=array-bounds=]
> 2236 | sc = &env->segs[seg_reg];
> | ~~~~~~~~~^~~~~~~~~
> ../target/i386/cpu.h: In function ‘sev_apply_cpu_context’:
> ../target/i386/cpu.h:1682:18: note: while referencing ‘segs’
> 1682 | SegmentCache segs[6]; /* selector values */
> | ^~~~
> In function ‘cpu_x86_load_seg_cache’,
> inlined from ‘sev_apply_cpu_context’ at ../target/i386/sev.c:454:13:
> ../target/i386/cpu.h:2236:20: error: array subscript 6 is above array bounds
> of ‘SegmentCache[6]’ [-Werror=array-bounds=]
> 2236 | sc = &env->segs[seg_reg];
> | ~~~~~~~~~^~~~~~~~~
> ../target/i386/cpu.h: In function ‘sev_apply_cpu_context’:
> ../target/i386/cpu.h:1682:18: note: while referencing ‘segs’
> 1682 | SegmentCache segs[6]; /* selector values */
> | ^~~~
> In function ‘cpu_x86_load_seg_cache’,
> inlined from ‘sev_apply_cpu_context’ at ../target/i386/sev.c:454:13:
> ../target/i386/cpu.h:2236:20: error: array subscript 6 is above array bounds
> of ‘SegmentCache[6]’ [-Werror=array-bounds=]
> 2236 | sc = &env->segs[seg_reg];
> | ~~~~~~~~~^~~~~~~~~
> ../target/i386/cpu.h: In function ‘sev_apply_cpu_context’:
> ../target/i386/cpu.h:1682:18: note: while referencing ‘segs’
> 1682 | SegmentCache segs[6]; /* selector values */
> | ^~~~
> ...cut many more similar warnings...
>
>
> With regards,
> Daniel
Regards,
Roy