All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: David Matlack <dmatlack@google.com>
Cc: kvm@vger.kernel.org, Venkatesh Srinivas <venkateshs@chromium.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Ben Gardon <bgardon@google.com>, Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()
Date: Sat, 22 May 2021 12:59:18 +0200	[thread overview]
Message-ID: <20210522105918.krdukoxe7jd2df6a@gator> (raw)
In-Reply-To: <20210521173828.1180619-1-dmatlack@google.com>

On Fri, May 21, 2021 at 05:38:28PM +0000, David Matlack wrote:
> vm_get_max_gfn() casts vm->max_gfn from a uint64_t to an unsigned int,
> which causes the upper 32-bits of the max_gfn to get truncated.
> 
> Nobody noticed until now likely because vm_get_max_gfn() is only used
> as a mechanism to create a memslot in an unused region of the guest
> physical address space (the top), and the top of the 32-bit physical
> address space was always good enough.
> 
> This fix reveals a bug in memslot_modification_stress_test which was
> trying to create a dummy memslot past the end of guest physical memory.
> Fix that by moving the dummy memslot lower.
> 
> Fixes: 52200d0d944e ("KVM: selftests: Remove duplicate guest mode handling")
> Reviewed-by: Venkatesh Srinivas <venkateshs@chromium.org>
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
> 
> v1 -> v2:
>  - Added Venkatesh's R-b line.
>  - Used PRIx64 to print uint64_t instead of %lx.
> 
>  tools/testing/selftests/kvm/include/kvm_util.h |  2 +-
>  tools/testing/selftests/kvm/lib/kvm_util.c     |  2 +-
>  .../testing/selftests/kvm/lib/perf_test_util.c |  4 +++-
>  .../kvm/memslot_modification_stress_test.c     | 18 +++++++++++-------
>  4 files changed, 16 insertions(+), 10 deletions(-)
>

Reviewed-by: Andrew Jones <drjones@redhat.com>

Thanks,
drew


  parent reply	other threads:[~2021-05-22 10:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 17:38 [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn() David Matlack
2021-05-21 17:49 ` Peter Xu
2021-05-22 10:59 ` Andrew Jones [this message]
2021-05-24 12:30 ` Paolo Bonzini
2021-06-08  8:39 ` Christian Borntraeger
2021-06-08 10:03   ` Christian Borntraeger
2021-06-08 11:45     ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger
2021-06-08 11:49       ` Janosch Frank
2021-06-08 11:55         ` Christian Borntraeger
2021-06-08 12:18       ` Christian Borntraeger
2021-06-08 12:39     ` [PATCH v2] " Christian Borntraeger
2021-06-08 16:41       ` David Matlack
2021-06-08 17:19       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210522105918.krdukoxe7jd2df6a@gator \
    --to=drjones@redhat.com \
    --cc=bgardon@google.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=venkateshs@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.