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: 697964 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp594007wrs; Fri, 30 Jun 2023 11:08:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlF2ghnI9f44WuPQh9WRLT0ViV2TN4ztKZM6+Z5EFMXUGxYXTIxUTmyuJvaC4f+Y5z4AfvSL X-Received: by 2002:a05:6359:6a5:b0:134:ece4:1e81 with SMTP id ei37-20020a05635906a500b00134ece41e81mr1492661rwb.7.1688148509921; Fri, 30 Jun 2023 11:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688148509; cv=none; d=google.com; s=arc-20160816; b=KeRMN954WmTAcJLThg5jAlRaQ692+7KKJWqnFMDYc2yZbiaJ2xY+QS/xqHzTr6VYwW bCWlUm7B9PK9ZBAo5VE72+Nc9CceodOSAFb3Wh9Yxz6iU+U+qpAUO6nFcoPH7N6OstTH YkzcjUDeYjK8pC41IQ1rkzls+QTTQcwqlpH2lkzVsFtwhh0xcGneTO19KaidEpbt1KIV juTZIqwNZ+mPwE20bMZhoF6aIpqb7RUtwoH/BKV3Zcq67HN1e8pSfyp11sDm0X7kJrBA FjS68KnJZ7hz1DwEjwhOpYwfdtvFwD880Iskumow7a3gOYI2laaur3/XyZSYzaElmlPm uYcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lz5lxf2E/M/Con0bds2DlcTKe4KZQ3/27M1SQX+Iwww=; fh=OltHerz+Vf7zZkebZbScoRT4WgVwJDskRS7DoEjx2Hw=; b=DeVO/1uI+IxLTKcaaQmKVBAyQJZowvB3Y1J3FeNiZ3RfCPL0f/jRdJ8ZNBjj+gUJmf DdtYkdM81RHGU6qjdvLjiWw0om08dmR7muNphZ64V6nQdhMJK2+T17BfV3sz0+zz60za xiTPnr9/2ltXBx1cOQX+D1grO99jbPIRTATZIqIc93wk8hyuQdocvRThqFnRcL/mRQMj 3W56vM5L2EnRNG+XzqSi5O8x53QqHzAlu9PD02aWCkO8nR4yjWG9uMogBBctLWRhaHtz 29dHYW6YDqbLdsbahbv7I+IriT7u+vzw/eoM/UhW40Zx+Z5FP+O+OFFq+kyB/c7rkJau 4hIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lFHAHR36; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d7-20020a05621421c700b005f97bebca20si9097981qvh.59.2023.06.30.11.08.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 11:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lFHAHR36; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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