From patchwork Fri Jun 30 18:03:54 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: 1802090 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=lFHAHR36; 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 4Qt3GR2H8yz20Zw for ; Sat, 1 Jul 2023 04:08:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFIU5-0008MG-F2; Fri, 30 Jun 2023 14:04:41 -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 1qFITy-0008IT-J4 for qemu-devel@nongnu.org; Fri, 30 Jun 2023 14:04:35 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFITv-0006zx-CL for qemu-devel@nongnu.org; Fri, 30 Jun 2023 14:04:34 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3141c8a6f30so2111473f8f.1 for ; Fri, 30 Jun 2023 11:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688148270; x=1690740270; 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=Lz5lxf2E/M/Con0bds2DlcTKe4KZQ3/27M1SQX+Iwww=; b=lFHAHR36qCUu5wDEbG6J2QygRFQ2dD6A2GOtDeYxbbedkkOgJiAAatzJHDROvNA9Mz D3yDxkwcuMd87xCib4gslxnYZMP+m4Xx+uESdIqbzyLtSAoYRM1ukKpjjNNMbbvejMW3 c5Ixz7R+EBFoFWiIX7R0xQkoIm6MYmg73irj/wL9avvujI7WIl+ZImvvcoo4+tLpMwJg 27B7qFQqtbeEghKIjRyulpI2mrjGMpLO423EsQ7kJ2NBKLTJN+D8YXaxNxp7TmXrw8ku DrZdWMiQepXxr6t5atiD8tlhKaLj2zHBwkOT+GQuT1ZIcxAg6mksMVS950op+gNwdKOm SihA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688148270; x=1690740270; 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=Lz5lxf2E/M/Con0bds2DlcTKe4KZQ3/27M1SQX+Iwww=; b=ZazQ0t1wa9bdBSiDjGxLhbO89fTgKrvYS3v8e7gKc+12T8r4PcoOZNj+0Wy8Pk3/rE eGSBaLFeLHQ62pZPIntTy7sMLD/xAUhswxnVTBVVHepP4yqjq/i5lY/BK0K7tplVntVv V3YJcVn6DwZFBUYYttM0llK+SQgSQQReydLnq4wUlbLyAYwdn7nqBGzA8F4RRiGrf8n8 vcZ4Y27hpwH+xxbrnxUarWp8GxlIDi1eXfvssVwEmXV0ezIKBI9NVDpIJ+qjFEfmv8i7 yt/rRMaN5wLF0T7R+mR2u5I0d8eO1+CoMZOUREkFbzFzNVAf8B0zJtheC94MW1nZsSBg qqoQ== X-Gm-Message-State: ABy/qLY6dxBPjnEX4i4Bwi2UhP3Hq28jMl/C+mSWm9zxh+DJjjnmjlYW C6YmxF5CDVysxFFgLEJTPnz2NA== X-Google-Smtp-Source: APBJJlEiPqgM5kvGo7qmT2/Isyy9irChggO4Xh9AggjCPkzXMJr+s/x42v/FfN/5sav3B2grqoiiKw== X-Received: by 2002:adf:d4c3:0:b0:314:117e:d332 with SMTP id w3-20020adfd4c3000000b00314117ed332mr2803305wrk.49.1688148269794; Fri, 30 Jun 2023 11:04:29 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id t25-20020a7bc3d9000000b003fbb8c7c799sm4838941wmj.30.2023.06.30.11.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:04:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D870D1FFC3; Fri, 30 Jun 2023 19:04:24 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , Stefan Hajnoczi , Leonardo Bras , Laurent Vivier , Peter Xu , Juan Quintela , Beraldo Leal , Radoslaw Biernacki , Qiuhao Li , Peter Maydell , Yanan Wang , Riku Voipio , Wainer dos Santos Moschetta , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Laurent Vivier , Bin Meng , Marcel Apfelbaum , Bandan Das , Cleber Rosa , Richard Henderson , Leif Lindholm , Marcin Juszkiewicz , qemu-arm@nongnu.org, Darren Kenny , Alexander Bulekov Subject: [PATCH v4 09/38] tests/docker: add test-fuzz Date: Fri, 30 Jun 2023 19:03:54 +0100 Message-Id: <20230630180423.558337-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230630180423.558337-1-alex.bennee@linaro.org> References: <20230630180423.558337-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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 4feea49a6e..7164cf55a1 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