From patchwork Sat Jul 29 00:36:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13332801 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0D06C001DF for ; Sat, 29 Jul 2023 00:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=us0fmiDbBr1u0AoDRaBhLA7PSHsY4ie+eRia7opuH4E=; b=q5wOb0unmZs4hW aGteZSoE5rl3Duat0i0JjGvjOY78g3GY/Hrxh/1noepYorJlGtljGqgdJbcz6Opw0PnYpIe28LpJj E8Y27xM2ulYSd6r7iJyl/y16ne/TSkuI7eGeoI7wNJrScRM/lzjWyxVNKcXOZnQnppTB8QejzAVMU qGMjxvfy6D7+Nss+vkG+3L62njrJOJCO21kbY4b+wqv7b1vk4LUlRqH0i7Ebxy3SRP+hb/Ee0OBZr zYccaXMRML1M6KekCEvcOrQVasHJh9VpOpLLWP9KSfNmvfQo/aNBQAR2uQJgnV181BgzTr+MXAAts GYKIEq4ezsyF3j+/7mqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPXxD-005cfo-0X; Sat, 29 Jul 2023 00:37:07 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPXx1-005cag-0g for linux-arm-kernel@lists.infradead.org; Sat, 29 Jul 2023 00:36:56 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5843fed1e88so26716317b3.0 for ; Fri, 28 Jul 2023 17:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690591014; x=1691195814; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Z3Pu8s+tZVLEYyiWqFZT+4FnWB/kYWBw56lgxTY04lg=; b=QhOCz4agpP5D5cbpsEZdNZlI5wRey05iapUs6eqbsCyeWw7ESGDEaWL+JAIY5SreVo j4pjb93sMrM6hSxu6w1NyfTe0JbHBmnKzcSv8XEHiOxiqzRovWo0kdaZNgOMIaC1LEmO uBeX0ALUqhXhfo9xI+4stfGH9a4o+HD2bd3H/Z2c/1xXwHy1QrfRssnf1Gu3oPEy3rvP Cp4Y2ayDWQqnOoPjgFaSM4cN0ajnTBpyLN0nMdsGRL7mNczp8jpfjXG/KGcgbQSSClEe jHWhHsMP3HKknY07k/h2dlQ/7+/Qp8Z/7Ko2t314af5vv9Hv0O/jrmNV/8FUZdmWsODb 9/sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591014; x=1691195814; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z3Pu8s+tZVLEYyiWqFZT+4FnWB/kYWBw56lgxTY04lg=; b=K9oXmVH9Vbllb/2cM4jQBSOx9M+3miP0RVfX7cqjijLFQ6hH68zOzesGoC92yei1zZ Q3LHECK2ZzxdHlJpr4ANzXnm1m+jCU2gqlaAhOWmQsLrS5T3xPeKutvL9siOUMpkU9vk VaK7O18OPNeVvTP7Qtlb57bN3YEg3xkL2+Fzwsu2ztY0xgYaAZ82M1y1bRRlXKHEz0lQ fzSifOsWVEnqHTXaO1Bks+7zLOwkqUbS4DXXmXlVHmAqVDACx1u+BZsZ56hMnzkjT45z if0GP8KHDIzuKOn4wMcY6uoNqhlkQggE+N7KvgYb9T2c2D9kZ5Ljnkfl9aea98Jz7dty 850A== X-Gm-Message-State: ABy/qLaBJ+GC93l91KOOJz7G1Yv/0HI+M25IBjowT5OQWIl9bZXnagxk 5pOkF2vvU/GHwLyYLJWXW+WlOd0dKXQ= X-Google-Smtp-Source: APBJJlGW0fmejVcH9KMrFQrUYFzrJ+xt9BpeDmhOtEq6gjiJBZGY9QsusOFgjsma9PSCF+gN7f3Yz2Qr00k= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:ad27:0:b0:581:3899:91bc with SMTP id l39-20020a81ad27000000b00581389991bcmr22355ywh.6.1690591013864; Fri, 28 Jul 2023 17:36:53 -0700 (PDT) Date: Fri, 28 Jul 2023 17:36:13 -0700 In-Reply-To: <20230729003643.1053367-1-seanjc@google.com> Mime-Version: 1.0 References: <20230729003643.1053367-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230729003643.1053367-5-seanjc@google.com> Subject: [PATCH v4 04/34] KVM: selftests: Add strnlen() to the string overrides From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Sean Christopherson , Thomas Huth , " =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= " , Aaron Lewis X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230728_173655_251023_2C9581E2 X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Aaron Lewis Add strnlen() to the string overrides to allow it to be called in the guest. The implementation for strnlen() was taken from the kernel's generic version, lib/string.c. This will be needed when printf() is introduced. Signed-off-by: Aaron Lewis Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/Makefile | 1 + tools/testing/selftests/kvm/lib/string_override.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index c692cc86e7da..f6c14ab476ac 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -204,6 +204,7 @@ endif CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ -Wno-gnu-variable-sized-type-not-at-end -MD\ -fno-builtin-memcmp -fno-builtin-memcpy -fno-builtin-memset \ + -fno-builtin-strnlen \ -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ -I$(