From nobody Fri Dec 19 21:47:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599220677; cv=none; d=zohomail.com; s=zohoarc; b=ION6VU5ohrKLvWUd0pGPQWhORHbHMuZ7s1cXoKc9eWofO8KjQJYzVr1b8MeLryTvNbVQFsCkcbh2Mjc8nHmWXRhs4fW5pRDibpZFNcHSBDsc2YSu6yOxZOoTHF1gHJ61RsguwcL4QWxQDPG/5punBRx/ekbPwOw5+N0WuK2i37o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599220677; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nxCJmlqCM2KK1HscYdbl6KXzBTcKfKoVZJH+KnHY/DA=; b=ImJOOje3VGXP3cT9CzljemQiDnlSxWXlHjE2j62XMCBnF+pmrVGmHJbgWjU8iNn3cH/gXDmfv3JMO5VEPLk+tDXZ0s75sdD2Yu71BzFYfNUHCF3XFzKX7lsiauHdxn1rZLMgPRYYpbfA9hlsK4/l6tMARWAwSwkozN7cw7lRdRM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599220677000173.94601521398806; Fri, 4 Sep 2020 04:57:57 -0700 (PDT) Received: from localhost ([::1]:52548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEALs-000713-4d for importer@patchew.org; Fri, 04 Sep 2020 07:57:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEA6x-0001BD-Nc for qemu-devel@nongnu.org; Fri, 04 Sep 2020 07:42:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33065 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kEA6v-0005JP-Rg for qemu-devel@nongnu.org; Fri, 04 Sep 2020 07:42:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-Agg0RxJLPeGbNKcOUCxSeA-1; Fri, 04 Sep 2020 07:42:28 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AD11109109D; Fri, 4 Sep 2020 11:41:48 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id BED861002D4C; Fri, 4 Sep 2020 11:41:47 +0000 (UTC) X-MC-Unique: Agg0RxJLPeGbNKcOUCxSeA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 44/46] fuzz: Add support for custom fuzzing library Date: Fri, 4 Sep 2020 07:41:20 -0400 Message-Id: <20200904114122.31307-45-pbonzini@redhat.com> In-Reply-To: <20200904114122.31307-1-pbonzini@redhat.com> References: <20200904114122.31307-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=pbonzini@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/04 03:58:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov On oss-fuzz, we must use the LIB_FUZZING_ENGINE and CFLAGS environment variables, rather than -fsanitize=3Dfuzzer. With this change, when LIB_FUZZING_ENGINE is set, the --enable-fuzzing configure option will use that environment variable during the linking stage, rather than -fsanitize=3Dfuzzer Signed-off-by: Alexander Bulekov Message-Id: <20200902173652.307222-3-alxndr@bu.edu> Signed-off-by: Paolo Bonzini --- configure | 12 ++++++++++-- tests/qtest/fuzz/meson.build | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure b/configure index c71bceb8e8..d3495e107f 100755 --- a/configure +++ b/configure @@ -6023,7 +6023,7 @@ fi =20 ########################################## # checks for fuzzer -if test "$fuzzing" =3D "yes" ; then +if test "$fuzzing" =3D "yes" && test -z "${LIB_FUZZING_ENGINE+xxx}"; then write_c_fuzzer_skeleton if compile_prog "$CPU_CFLAGS -Werror -fsanitize=3Dfuzzer" ""; then have_fuzzer=3Dyes @@ -7291,7 +7291,14 @@ if test "$have_mlockall" =3D "yes" ; then echo "HAVE_MLOCKALL=3Dy" >> $config_host_mak fi if test "$fuzzing" =3D "yes" ; then - QEMU_CFLAGS=3D"$QEMU_CFLAGS -fsanitize=3Dfuzzer-no-link" + # If LIB_FUZZING_ENGINE is set, assume we are running on OSS-Fuzz, and t= he + # needed CFLAGS have already been provided + if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then + QEMU_CFLAGS=3D"$QEMU_CFLAGS -fsanitize=3Dfuzzer-no-link" + FUZZ_EXE_LDFLAGS=3D"-fsanitize=3Dfuzzer" + else + FUZZ_EXE_LDFLAGS=3D"$LIB_FUZZING_ENGINE" + fi fi =20 if test "$plugins" =3D "yes" ; then @@ -7392,6 +7399,7 @@ fi if test "$fuzzing" !=3D "no"; then echo "CONFIG_FUZZ=3Dy" >> $config_host_mak fi +echo "FUZZ_EXE_LDFLAGS=3D$FUZZ_EXE_LDFLAGS" >> $config_host_mak =20 if test "$edk2_blobs" =3D "yes" ; then echo "DECOMPRESS_EDK2_BLOBS=3Dy" >> $config_host_mak diff --git a/tests/qtest/fuzz/meson.build b/tests/qtest/fuzz/meson.build index bcc393828e..b31ace7d5a 100644 --- a/tests/qtest/fuzz/meson.build +++ b/tests/qtest/fuzz/meson.build @@ -7,8 +7,8 @@ specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: fi= les('virtio_net_fuzz. specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_SCSI', if_true: files('virtio_sc= si_fuzz.c')) =20 fork_fuzz =3D declare_dependency( - link_args: ['-fsanitize=3Dfuzzer', - '-Wl,-wrap,qtest_inb', + link_args: config_host['FUZZ_EXE_LDFLAGS'].split() + + ['-Wl,-wrap,qtest_inb', '-Wl,-wrap,qtest_inw', '-Wl,-wrap,qtest_inl', '-Wl,-wrap,qtest_outb', --=20 2.26.2