From nobody Sat Nov 15 15:39:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595319254; cv=none; d=zohomail.com; s=zohoarc; b=Ql8ih0pDHpz+VwK/cY+n58YXxvjeoHBUjwIGZ3yYwD0gZJmVS9DHvnz55v8sTeVXuljSQRjBxL1xzOCmMimFaOO/FGsAWqlUNYRbP6iZuE3/rJ5VU7mkfJ1UbEMIoHfhhPgCChiZuf/NZIKodTMF4MQdvUK8GtTvt0JTdIfq990= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595319254; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Ed8qjShg83j6iJdRGGW66/wVId0nejMjJmWAPtjIA/c=; b=GH1faJE+NijYA6aycik+VpR3x3Rj+ErKNK63e8GpPY/m0eqbScPZgcY0jssFknnJROkGL232zk/c8EKd8RdBnmyHzHwGvb//ZPeNWl5xKxei1wNNMEzNkb0eRL0DDanZGOmorpmEU9dtdA7krdNqjrr1B3svgzqXlvJa2jS84Zs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595319254619757.5141656768457; Tue, 21 Jul 2020 01:14:14 -0700 (PDT) Received: from localhost ([::1]:48634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxnPh-0004Qh-6q for importer@patchew.org; Tue, 21 Jul 2020 04:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxnMn-0007hO-Ip for qemu-devel@nongnu.org; Tue, 21 Jul 2020 04:11:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33248 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 1jxnMl-0004Kq-Oa for qemu-devel@nongnu.org; Tue, 21 Jul 2020 04:11:13 -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-198-0VIbiRXROm23p4R5se3Edw-1; Tue, 21 Jul 2020 04:11:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E5F9107ACCA; Tue, 21 Jul 2020 08:11:07 +0000 (UTC) Received: from thuth.com (ovpn-112-102.ams2.redhat.com [10.36.112.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 137CA2DE68; Tue, 21 Jul 2020 08:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595319071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=Ed8qjShg83j6iJdRGGW66/wVId0nejMjJmWAPtjIA/c=; b=ZYKMCBUCDtX75AMjCv+zTSjkEftzti+V5wfOK+MPLm6dtWanqfFa29xeoa43jCnVIdfRXh tT8Mnb5UMtQV7AgS+9+N+2Sb7iLJaI62TyML2KNdzQYJt9SpM4ZnZKndI2MfrJPhnpWFgo NDm5wy9aXTg2QgdPm6wi8xLZrWTElRc= X-MC-Unique: 0VIbiRXROm23p4R5se3Edw-1 From: Thomas Huth To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 06/10] docs/fuzz: add information about useful libFuzzer flags Date: Tue, 21 Jul 2020 10:10:51 +0200 Message-Id: <20200721081055.14073-7-thuth@redhat.com> In-Reply-To: <20200721081055.14073-1-thuth@redhat.com> References: <20200721081055.14073-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=205.139.110.120; envelope-from=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 01:30:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov Signed-off-by: Alexander Bulekov Message-Id: <20200706195534.14962-4-alxndr@bu.edu> Signed-off-by: Thomas Huth --- docs/devel/fuzzing.txt | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/devel/fuzzing.txt b/docs/devel/fuzzing.txt index 12bf6aa0ca..6d18115239 100644 --- a/docs/devel/fuzzing.txt +++ b/docs/devel/fuzzing.txt @@ -48,6 +48,43 @@ Information about these is available by passing -help=3D1 Now the only thing left to do is wait for the fuzzer to trigger potential crashes. =20 +=3D=3D Useful libFuzzer flags =3D=3D + +As mentioned above, libFuzzer accepts some arguments. Passing -help=3D1 wi= ll list +the available arguments. In particular, these arguments might be helpful: + +$CORPUS_DIR/ : Specify a directory as the last argument to libFuzzer. libF= uzzer +stores each "interesting" input in this corpus directory. The next time yo= u run +libFuzzer, it will read all of the inputs from the corpus, and continue fu= zzing +from there. You can also specify multiple directories. libFuzzer loads exi= sting +inputs from all specified directories, but will only write new ones to the +first one specified. + +-max_len=3D4096 : specify the maximum byte-length of the inputs libFuzzer = will +generate. + +-close_fd_mask=3D{1,2,3} : close, stderr, or both. Useful for targets that +trigger many debug/error messages, or create output on the serial console. + +-jobs=3D4 -workers=3D4 : These arguments configure libFuzzer to run 4 fuzz= ers in +parallel (4 fuzzing jobs in 4 worker processes). Alternatively, with only +-jobs=3DN, libFuzzer automatically spawns a number of workers less than or= equal +to half the available CPU cores. Replace 4 with a number appropriate for y= our +machine. Make sure to specify a $CORPUS_DIR, which will allow the parallel +fuzzers to share information about the interesting inputs they find. + +-use_value_profile=3D1 : For each comparison operation, libFuzzer computes=20 +(caller_pc&4095) | (popcnt(Arg1 ^ Arg2) << 12) and places this in the cove= rage +table. Useful for targets with "magic" constants. If Arg1 came from the fu= zzer's +input and Arg2 is a magic constant, then each time the Hamming distance +between Arg1 and Arg2 decreases, libFuzzer adds the input to the corpus. + +-shrink=3D1 : Tries to make elements of the corpus "smaller". Might lead to +better coverage performance, depending on the target. + +Note that libFuzzer's exact behavior will depend on the version of +clang and libFuzzer used to build the device fuzzers. + =3D=3D Adding a new fuzzer =3D=3D Coverage over virtual devices can be improved by adding additional fuzzers. Fuzzers are kept in tests/qtest/fuzz/ and should be added to --=20 2.18.1