From patchwork Tue Jun 27 16:06:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 1800663 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=HAXvgYVQ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qr8mm28GPz20bH for ; Wed, 28 Jun 2023 02:09:44 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEBDn-0000FU-6p; Tue, 27 Jun 2023 12:07:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qEBDi-0000AP-4j for qemu-devel@nongnu.org; Tue, 27 Jun 2023 12:07:10 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEBDd-00057t-Qc for qemu-devel@nongnu.org; Tue, 27 Jun 2023 12:07:09 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31297125334so12624f8f.0 for ; Tue, 27 Jun 2023 09:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687882024; x=1690474024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OoH/DOZFZDe6ZD+LHfFvG2TjLm3SJ3G2i0MfunKyFLs=; b=HAXvgYVQj2aKDGxr/IBoeMC/673IqY3UyaMYpy1khbhfutpblQDEXBXTT4NiIIujFh z6ni3z7fPvio4+65wfSn2GpY/YovvOJ1VfmyKKyNfwL8/W/Uwcbxr2/iDuW1vy+vLYJZ CL0ZtNLsaogPzhEe+70qbgrrWSv08GeGefu5kmWa7VsQc6CNWShZb/E6IgeY9BwiN3Dv IHzbWdRciWoqV4uiSmypf622q4OHybxzw4mfK6louRtiAacJ4Mnm7s1SQq5i+om2kSl5 qELZE1EB3uLoc2ENG6rqEep4zcgAhHvrnBkeYIsr8eiMCc2vTuojT1yFBUDlxLMsxqWt 89cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687882024; x=1690474024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OoH/DOZFZDe6ZD+LHfFvG2TjLm3SJ3G2i0MfunKyFLs=; b=gE9G7c/Hb0VAGHGW8BKTyVZrcAF9CImJAv9tIClRzg7RIQbKSaFM3/iV6xNN8lRMCC 1VQVUx8CvLYISqx4tpfMv2caGSyUGuhoMz5s6BN7gbiXgrpDI09NMtF+scpStPAHPPk4 JQVDctdb+zX+nqm/yvJ7MAPe1AXng5QDH5m6TtIOEC/rc7jdkGsxijRTGAbO/clv3/sY P6OBx6kHToeHT6WOKmzCUGk4W9WtJMkCSW52T22NhQwH20s6BOiGvoQZXa+yj1PRqEFV iV+VFE7Gu/s2+RMmXJ6yzkYhRllWqNeWcBXOsaGGLL5WAuO8xwdd9JLme4aGGYwUnhF8 Y3og== X-Gm-Message-State: AC+VfDxWqk9sjztICuyiz10vW1mrgYqMTwabgNrKrIKfxRmslt/O+wFq qQrhDGOls/AVFo+8bcWhrjG20g== X-Google-Smtp-Source: ACHHUZ5YUf9Pc2z7Ru43a/ga3iT6wg7eVySD1P1/WZZhe4mC/RKmOBI4W7nLzILe8rLTfbO/V9FttQ== X-Received: by 2002:adf:edd1:0:b0:311:3ce9:c9fa with SMTP id v17-20020adfedd1000000b003113ce9c9famr24936345wro.3.1687882024100; Tue, 27 Jun 2023 09:07:04 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id t12-20020a7bc3cc000000b003f604793989sm13855945wmj.18.2023.06.27.09.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 09:07:03 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BD5531FFBB; Tue, 27 Jun 2023 17:07:01 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Riku Voipio , Leonardo Bras , Wainer dos Santos Moschetta , Leif Lindholm , Yanan Wang , Marcin Juszkiewicz , Bandan Das , Beraldo Leal , Laurent Vivier , Marcel Apfelbaum , Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= , Stefan Hajnoczi , Richard Henderson , Peter Maydell , Thomas Huth , Cleber Rosa , Alexandre Iooss , Juan Quintela , Eduardo Habkost , Paolo Bonzini , Qiuhao Li , Mahmoud Mandour , Peter Xu , Radoslaw Biernacki , Darren Kenny , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexander Bulekov Subject: [PATCH v3 09/36] tests/docker: add test-fuzz Date: Tue, 27 Jun 2023 17:06:33 +0100 Message-Id: <20230627160700.2955547-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230627160700.2955547-1-alex.bennee@linaro.org> References: <20230627160700.2955547-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Running the fuzzer requires some hoop jumping and some problems only show up in containers. This basically replicates the build-oss-fuzz job from our CI so we can run in the same containers we use in CI. Message-Id: <20230626215926.2522656-10-alex.bennee@linaro.org> Reviewed-by: Alexander Bulekov Signed-off-by: Alex Bennée --- v3 - checkpatch cleanups --- MAINTAINERS | 1 + tests/docker/test-fuzz | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 tests/docker/test-fuzz diff --git a/MAINTAINERS b/MAINTAINERS index e07746ac7d..3cfc389db0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3106,6 +3106,7 @@ R: Qiuhao Li S: Maintained F: tests/qtest/fuzz/ F: tests/qtest/fuzz-*test.c +F: tests/docker/test-fuzz F: scripts/oss-fuzz/ F: hw/mem/sparse-mem.c F: docs/devel/fuzzing.rst diff --git a/tests/docker/test-fuzz b/tests/docker/test-fuzz new file mode 100755 index 0000000000..7e506ae1f6 --- /dev/null +++ b/tests/docker/test-fuzz @@ -0,0 +1,28 @@ +#!/bin/bash -e +# +# Compile and check with oss-fuzz. +# +# Copyright (c) 2023 Linaro Ltd. +# +# Authors: +# Alex Bennée +# +# SPDX-License-Identifier: GPL-2.0-or-later + +. common.rc + +requires_binary clang + +# the build script runs out of $src so we need to copy across +cd "$BUILD_DIR" +cp -a $QEMU_SRC . +cd src +mkdir build-oss-fuzz +export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt +env CC="clang" CXX="clang++" CFLAGS="-fsanitize=address" ./scripts/oss-fuzz/build.sh +export ASAN_OPTIONS="fast_unwind_on_malloc=0" +for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f | grep -v slirp); do + grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ; + echo Testing ${fuzzer} ... ; + "${fuzzer}" -runs=1 -seed=1 || exit 1 ; +done