From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0F30C54EE9 for ; Thu, 22 Sep 2022 18:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbiIVSQY (ORCPT ); Thu, 22 Sep 2022 14:16:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232562AbiIVSP5 (ORCPT ); Thu, 22 Sep 2022 14:15:57 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63693ECCF6 for ; Thu, 22 Sep 2022 11:15:55 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id fs14so10599358pjb.5 for ; Thu, 22 Sep 2022 11:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=nr+7IOo73RGkvtgVJL29Z6tTdRJTDEqf8P4Dgi+ndyk=; b=iCbAH699W/1jdjiG2kRIgTTGjNJ5vcrMUHEZiTItrbfKJTprZauxI3v9qa0UROhNZr DZVLcgpXxGfjASMaNGvsr+48JArAMzqrKzmuUwDRSzXAO+AV38MGkuSd8IKWFWMxmq57 IVAlqyLz4MjUrkcJEWxDoYgZmZjildnN9Mn4b5brZXAEjMP74jepQoH/jsSRDHnHWFSL keK98O4wx8P4KazUlE6D2uVkK0AZwMmyKqiIzEr19A5psRnmcVPw6zrNtA47R26O9Ux8 1UKArM89stdi9Sv/I+ry6iDlkr44SkIuFvhejq69GNvmuHB3Lg1fZnMH/a3LfaTzvZQu jcjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=nr+7IOo73RGkvtgVJL29Z6tTdRJTDEqf8P4Dgi+ndyk=; b=Xlzjvd/uIfRCWKzGKCYi+NSgsIkBEjioID2omWWKvx726pfZT7kb6CdBAysltvBjSC 45kV+MiGsp1tradAx7aJDBPw5e6ALwceWWRw/L7sGg8lScHAiuIDY84bYjelTrC31QWi NjH+Go/UfkdwxM00vKTcrdSrdwANUcYQeRN9x766sW3H7w7nlwLV8IaPOt+5gflxJec6 JR353JIcISJKt3lCUchtxflCtB4UPtlQiAifeTRpY7JYtSeQi7YoyanZTlXWQErkAccn y1qG9563XbamQv0XxabONu1wSf3SSCj/pJMmhT9yct9kO0PfYRvwiM7UPrz4uMfa+CEi UmEQ== X-Gm-Message-State: ACrzQf2qJ6Md9oREpxzNSRW7dGwrZ1mB+wt0deL7J9kcW3+RggPilrmw Ac8hhRoCe3s9S7M1LOniMLIa4Q== X-Google-Smtp-Source: AMsMyM5kij3DFL/RpvWafQ7/3nGP1AgvQjnHkj47Y1XxBIToLerAFAgu3hxeiBE8fghxkrFPyShFzw== X-Received: by 2002:a17:90b:4b4c:b0:203:1eef:d810 with SMTP id mi12-20020a17090b4b4c00b002031eefd810mr16788791pjb.75.1663870554760; Thu, 22 Sep 2022 11:15:54 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id a4-20020a170902ecc400b0016dcbdf9492sm4414118plh.92.2022.09.22.11.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 11:15:54 -0700 (PDT) Date: Thu, 22 Sep 2022 18:15:50 +0000 From: Sean Christopherson To: Jim Mattson Cc: David Matlack , Paolo Bonzini , kvm list , LKML , Andrew Jones , Anup Patel , Atish Patra , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Oliver Upton Subject: Re: [PATCH 0/5] KVM: selftests: Fix "fix hypercall test" build errors Message-ID: References: <20220908233134.3523339-1-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Sep 22, 2022, Jim Mattson wrote: > On Thu, Sep 22, 2022 at 10:20 AM David Matlack wrote: > > > > On Thu, Sep 8, 2022 at 4:34 PM Sean Christopherson 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 , 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.