From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: David Matlack <dmatlack@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm list <kvm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Jones <andrew.jones@linux.dev>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Oliver Upton <oliver.upton@linux.dev>
Subject: Re: [PATCH 0/5] KVM: selftests: Fix "fix hypercall test" build errors
Date: Thu, 22 Sep 2022 18:15:50 +0000 [thread overview]
Message-ID: <YyymVtI2afiKtIbN@google.com> (raw)
In-Reply-To: <CALMp9eTgQyj22XgO4r1MYvjh4UVC3+4KF+xMUZxV50W3iYYgVw@mail.gmail.com>
On Thu, Sep 22, 2022, Jim Mattson wrote:
> On Thu, Sep 22, 2022 at 10:20 AM David Matlack <dmatlack@google.com> wrote:
> >
> > On Thu, Sep 8, 2022 at 4:34 PM Sean Christopherson <seanjc@google.com> wrote:
> > >
> > > After a toolchain upgrade (I think), the x86 fix_hypercall_test started
> > > throwing warnings due to -Werror=array-bounds rightly complaining that
> > > the test is generating an out-of-bounds array access.
> > >
> > > The "obvious" fix is to replace the memcpy() with a memcmp() and compare
> > > only the exact size of the hypercall instruction. That worked, until I
> > > fiddled with the code a bit more and suddenly the test started jumping into
> > > the weeds due to gcc generating a call to the external memcmp() through the
> > > PLT, which isn't supported in the selftests.
> > >
> > > To fix that mess, which has been a pitfall for quite some time, provide
> > > implementations of memcmp(), memcpy(), and memset() to effectively override
> > > the compiler built-ins. My thought is to start with the helpers that are
> > > most likely to be used in guest code, and then add more as needed.
> >
> > Ah ha! This also fixes an issue I've long since noticed and finally
> > got around to debugging this morning. userspace_io_test fails for me
> > when built with Clang but passes with GCC. It turns out Clang
> > generates a call to <memset@plt>, whereas GCC directly generates rep
> > stos, to clear @buffer in guest_code().
>
> Hey! Did I miss a revert of commit ed290e1c20da ("KVM: selftests: Fix
> nested SVM tests when built with clang") in that patch set?
LOL, no, no you did not. I'll do that in v2.
prev parent reply other threads:[~2022-09-22 18:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 23:31 [PATCH 0/5] KVM: selftests: Fix "fix hypercall test" build errors Sean Christopherson
2022-09-08 23:31 ` [PATCH 1/5] KVM: selftests: Implement memcmp(), memcpy(), and memset() for guest use Sean Christopherson
2022-09-22 17:29 ` David Matlack
2022-09-22 17:40 ` Sean Christopherson
2022-09-22 17:49 ` David Matlack
2022-09-22 18:20 ` Sean Christopherson
2022-09-08 23:31 ` [PATCH 2/5] KVM: selftests: Compare insn opcodes directly in fix_hypercall_test Sean Christopherson
2022-09-19 21:17 ` Oliver Upton
2022-09-08 23:31 ` [PATCH 3/5] KVM: selftests: Remove unnecessary register shuffling " Sean Christopherson
2022-09-19 21:19 ` Oliver Upton
2022-09-08 23:31 ` [PATCH 4/5] KVM: selftests: Explicitly verify KVM doesn't patch hypercall if quirk==off Sean Christopherson
2022-09-19 21:23 ` Oliver Upton
2022-09-20 18:46 ` Sean Christopherson
2022-09-08 23:31 ` [PATCH 5/5] KVM: selftests: Dedup subtests of fix_hypercall_test Sean Christopherson
2022-09-19 21:26 ` Oliver Upton
2022-09-22 7:04 ` [PATCH 0/5] KVM: selftests: Fix "fix hypercall test" build errors Christian Borntraeger
2022-09-22 17:20 ` David Matlack
2022-09-22 17:53 ` Jim Mattson
2022-09-22 18:15 ` Sean Christopherson [this message]
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=YyymVtI2afiKtIbN@google.com \
--to=seanjc@google.com \
--cc=andrew.jones@linux.dev \
--cc=anup@brainfault.org \
--cc=atishp@atishpatra.org \
--cc=borntraeger@linux.ibm.com \
--cc=dmatlack@google.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
/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.