From patchwork Mon Jan 20 05:55:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Bulekov X-Patchwork-Id: 11341067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03E6617EA for ; Mon, 20 Jan 2020 06:13:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE1062077C for ; Mon, 20 Jan 2020 06:13:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=bushare.onmicrosoft.com header.i=@bushare.onmicrosoft.com header.b="e5anO+0i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE1062077C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bu.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itQJm-0004Cp-Np for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Jan 2020 01:13:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35389) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itQ1j-0007Ks-83 for qemu-devel@nongnu.org; Mon, 20 Jan 2020 00:55:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itQ1h-0006UK-54 for qemu-devel@nongnu.org; Mon, 20 Jan 2020 00:55:07 -0500 Received: from mail-bn7nam10on2106.outbound.protection.outlook.com ([40.107.92.106]:1376 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1itQ1h-0006Tr-0W for qemu-devel@nongnu.org; Mon, 20 Jan 2020 00:55:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y092sJNmoxdgCWsouClObyaCoG2/Z9ZE0xnW9xetubVe4nUsWbDH/sOlf2mIOe4grVqCOANn2qKHR4bEBM6gy3h8VcRQMdbqy31ScJZxudGKAVrM3372r0QELHHJxvNHo/WzCEdy5pEjFWZMcGz5kmW28v0KvXr6SuMPo4Nik4/vmQlwb9TxToQbg30ia/LrUghiCVFOWzEpyUomxwufZ1Rz4kXoBlqSDjNglmKUvZpIlXk5FgSNEsfC+szUhTkqn7+q0nMEzcStRvN1wmXafbF+7sMyp7rk5prKgJWRpVIl0wA0w2bjEWatNyQgNCmEVivk1gH+rOMkB7k8vEY47w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dvNYeeaXgAhc60bU8SP/MWFwQDDsLlrZP1iRKlujo9A=; b=a4/UdlntJoDcFJJ0qEy5N/4xq0dvMhwOy8/x+s5cSphIyb7uJ1L6ygMlZUSE94g6XHxhrIMBy9cqd+pfJu3zci1b2IXD7ul5gzqrlWsO7tgSQi/he9fcoMh/Z++MUQ6xjLxkW0MywpcYmji2Jnqu5hj4m7lnevD0ruN6qihCKC6pZ/HmC90zh7Ex96G3fJ52R/CNbcxbRyyyDFxJUOB812KleuEe3lZIUT7tMdTFzkUFgfyRKmxArvlYJVHvl1Y8AnzPgH5hvHv9WTvQ4lsD9labSNl4vApzagSoDCdl0Zp9PzquBhFPCFRtdbPPlXgmq7IEJtzketQ1jAA+dnUh5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bu.edu; dmarc=pass action=none header.from=bu.edu; dkim=pass header.d=bu.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bushare.onmicrosoft.com; s=selector2-bushare-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dvNYeeaXgAhc60bU8SP/MWFwQDDsLlrZP1iRKlujo9A=; b=e5anO+0iKEhazDS6GENl+VG/Y/b8Dpn0TMXG9dPVdM1ZbZJgK2wBnsC89RsIOq4ClkZjEEShjJoQ9kmtBQ1kXDlgu6Hp+JpTex0dDDJBAvsOPXoj7eV9l+3jcxt+F9BpoT5HwH6+WXRBR5T+jJSmY8wFRF9+u6wJEo7Xn3TQ+I0= Received: from SN6PR03MB3871.namprd03.prod.outlook.com (52.135.102.32) by SN6PR03MB4399.namprd03.prod.outlook.com (20.178.6.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23; Mon, 20 Jan 2020 05:55:04 +0000 Received: from SN6PR03MB3871.namprd03.prod.outlook.com ([fe80::9c11:10cd:6e97:bbe8]) by SN6PR03MB3871.namprd03.prod.outlook.com ([fe80::9c11:10cd:6e97:bbe8%7]) with mapi id 15.20.2644.024; Mon, 20 Jan 2020 05:55:04 +0000 Received: from mozz.bu.edu (128.197.127.33) by MN2PR20CA0032.namprd20.prod.outlook.com (2603:10b6:208:e8::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20 via Frontend Transport; Mon, 20 Jan 2020 05:55:02 +0000 From: "Bulekov, Alexander" To: "qemu-devel@nongnu.org" Subject: [PATCH v7 16/20] fuzz: add configure flag --enable-fuzzing Thread-Topic: [PATCH v7 16/20] fuzz: add configure flag --enable-fuzzing Thread-Index: AQHVz1YogdWBjjfeR0OaAS+bGjs0Eg== Date: Mon, 20 Jan 2020 05:55:03 +0000 Message-ID: <20200120055410.22322-22-alxndr@bu.edu> References: <20200120055410.22322-1-alxndr@bu.edu> In-Reply-To: <20200120055410.22322-1-alxndr@bu.edu> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.23.0 x-originating-ip: [128.197.127.33] x-clientproxiedby: MN2PR20CA0032.namprd20.prod.outlook.com (2603:10b6:208:e8::45) To SN6PR03MB3871.namprd03.prod.outlook.com (2603:10b6:805:6d::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=alxndr@bu.edu; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5a1273b8-fc3d-45c2-e5a4-08d79d6d4af9 x-ms-traffictypediagnostic: SN6PR03MB4399: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:962; x-forefront-prvs: 0288CD37D9 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(136003)(366004)(39860400002)(346002)(376002)(396003)(189003)(199004)(5660300002)(956004)(2616005)(8936002)(86362001)(6916009)(6486002)(7696005)(1076003)(52116002)(316002)(71200400001)(16526019)(186003)(786003)(478600001)(2906002)(26005)(81166006)(66946007)(66476007)(64756008)(36756003)(8676002)(75432002)(81156014)(66446008)(4326008)(66556008)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR03MB4399; H:SN6PR03MB3871.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: bu.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: iqvuJ03dwg/6pbqNG6QUueOOZmYISa8nAUS9KXQlECexZ3NQhecJoQmyhDmc7pSGM6W5iBC+e4nShYhXsvT/C9ly7sJkgOcdERab6jGKP3f0SyMGsJY54ETcbhdtNPuX9kR2nBxEL7vCQkNkBoL42MPmhw6YZmq4usf+XNs8E3GH8Qcyw1qcXnNktNRAwu8w5cH9FH7UEeIsIb7FgkCFym0tw2AZu3E87tTJJYO4QAK7oR/wE1CU5DT9JM7+3nBO1f4uYrTr7eGMj04kuUTHN2xO968M5NZqre851WvVKuTeH4yS97wmTmtallvTPMz2FWsdG8mJUe3kGFD9zeC5ydvenLfWAJah84t65sWvFY/rYIjfoM5ycxBtGXSSMsYryZRZteE0f4Liertcsxje+noC/tNCv+u+ttsYrpWUFnDaqGJuJG8fdTs9cdR1uSE7 Content-ID: MIME-Version: 1.0 X-OriginatorOrg: bu.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 5a1273b8-fc3d-45c2-e5a4-08d79d6d4af9 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2020 05:55:03.5329 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d57d32cc-c121-488f-b07b-dfe705680c71 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZoiBYnTKXzXBE28/khl9wdN9oW+lnJAO2wIyMBiSkkKumgY3jNE/xPWMJER5SmGK X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4399 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.92.106 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: "pbonzini@redhat.com" , "bsd@redhat.com" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "stefanha@redhat.com" , "Bulekov, Alexander" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alexander Bulekov Reviewed-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé --- configure | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/configure b/configure index 08c3a1c1f0..17aa5d02ee 100755 --- a/configure +++ b/configure @@ -504,6 +504,7 @@ debug_mutex="no" libpmem="" default_devices="yes" plugins="no" +fuzzing="no" supported_cpu="no" supported_os="no" @@ -634,6 +635,15 @@ int main(void) { return 0; } EOF } +write_c_fuzzer_skeleton() { + cat > $TMPC < +#include +int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); +int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } +EOF +} + if check_define __linux__ ; then targetos="Linux" elif check_define _WIN32 ; then @@ -1540,6 +1550,10 @@ for opt do ;; --disable-containers) use_containers="no" ;; + --enable-fuzzing) fuzzing=yes + ;; + --disable-fuzzing) fuzzing=no + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -5992,6 +6006,15 @@ EOF fi fi +########################################## +# checks for fuzzer +if test "$fuzzing" = "yes" ; then + write_c_fuzzer_skeleton + if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address,fuzzer" ""; then + have_fuzzer=yes + fi +fi + ########################################## # check for libpmem @@ -6576,6 +6599,7 @@ echo "libpmem support $libpmem" echo "libudev $libudev" echo "default devices $default_devices" echo "plugin support $plugins" +echo "fuzzing support $fuzzing" if test "$supported_cpu" = "no"; then echo @@ -7400,6 +7424,16 @@ fi if test "$sheepdog" = "yes" ; then echo "CONFIG_SHEEPDOG=y" >> $config_host_mak fi +if test "$fuzzing" = "yes" ; then + if test "$have_fuzzer" = "yes"; then + FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" + FUZZ_CFLAGS=" -fsanitize=address,fuzzer" + CFLAGS=" -fsanitize=address,fuzzer" + else + error_exit "Your compiler doesn't support -fsanitize=address,fuzzer" + exit 1 + fi +fi if test "$plugins" = "yes" ; then echo "CONFIG_PLUGIN=y" >> $config_host_mak @@ -7502,6 +7536,11 @@ if test "$libudev" != "no"; then echo "CONFIG_LIBUDEV=y" >> $config_host_mak echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak fi +if test "$fuzzing" != "no"; then + echo "CONFIG_FUZZ=y" >> $config_host_mak + echo "FUZZ_CFLAGS=$FUZZ_CFLAGS" >> $config_host_mak + echo "FUZZ_LDFLAGS=$FUZZ_LDFLAGS" >> $config_host_mak +fi if test "$edk2_blobs" = "yes" ; then echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak