[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27ff7009-ee8a-facc-681c-d229cec84b91@linux.ibm.com>
Date: Thu, 22 Sep 2022 09:04:38 +0200
From: Christian Borntraeger <borntraeger@...ux.ibm.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrew Jones <andrew.jones@...ux.dev>,
Anup Patel <anup@...infault.org>,
Atish Patra <atishp@...shpatra.org>,
Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Oliver Upton <oliver.upton@...ux.dev>
Subject: Re: [PATCH 0/5] KVM: selftests: Fix "fix hypercall test" build errors
Am 09.09.22 um 01:31 schrieb Sean Christopherson:
> 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.
>
> Tested on x86 and ARM, compile tested on RISC-V and s390. Full testing on
> RISC-V and s390 would be welcome, the seemingly benign addition of memxxx()
> helpers managed to break ARM due to gcc generating an infinite loop for
> memset() (see patch 1 for details).
Seems to run fine on s390.
Powered by blists - more mailing lists