Re: [PATCH 2/3] kvm: fix potentially corrupt mmio cache

From: Paolo Bonzini
Date: Tue Sep 02 2014 - 12:49:20 EST


Il 02/09/2014 18:44, David Matlack ha scritto:
> >
> > -#define MMIO_GEN_SHIFT 19
> > -#define MMIO_GEN_LOW_SHIFT 9
> > -#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 1)
> > +#define MMIO_GEN_SHIFT 20
> > +#define MMIO_GEN_LOW_SHIFT 10
> > +#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 2)
> > #define MMIO_GEN_MASK ((1 << MMIO_GEN_SHIFT) - 1)
> > #define MMIO_MAX_GEN ((1 << MMIO_GEN_SHIFT) - 1)
> >
> > @@ -4428,7 +4432,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm)
> > * The very rare case: if the generation-number is round,
> > * zap all shadow pages.
> > */
> > - if (unlikely(kvm_current_mmio_generation(kvm) >= MMIO_MAX_GEN)) {
> > + if (unlikely(kvm_current_mmio_generation(kvm) == 0)) {
>
> This should be in patch 1/3.

I don't think so. This change is not due to the removal of biasing in
x86.c, but rather due to removing bit 0 from MMIO_GEN_LOW_MASK.

I placed it here, because the previous test works just fine until bit 0
is removed from MMIO_GEN_LOW_MASK.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/