From nobody Mon Feb 9 23:03:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=1612821118; cv=none; d=zohomail.com; s=zohoarc; b=h0QTuNMaBJKie6xMQsqcQN8ndq5PMB+JwOusqm16tsvnNn5Z4lR6SehQLGTJT93DxipBDn1tfny5N5HuOJPcWaR+d8SR1aCpPp3TkS4hIM/omzA3MUqVqdaxkcDCLm/H3ZJDW+7dmgCU4xK60PnSNI+NhG/SqjEGRKqNlVxq3Bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612821118; h=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=6i9W6OOUOf+/H2AgjkKfRW+CSfY5qPrCTrtVFBIN+NA=; b=K0h6sZstPyCAkuSafC3htJvDOy1jOjOjVdv5BtFBT+bsfTQm1rCaM8Ye3bpXvo2kup3AIf/a18yhzdu6FKfZq5CPyoJbn4GhHHofWMtaPeKR/IEErO6naQmg8p8JDUWR2KPmxWGaYlrxZIIPf1aUR90+0OBwUy7wpm0UJCBIFAE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1612821118856318.82143742642063; Mon, 8 Feb 2021 13:51:58 -0800 (PST) Received: from localhost ([::1]:41252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9ERp-0006l8-Nv for importer@patchew.org; Mon, 08 Feb 2021 16:51:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9BCJ-0002sZ-NT for qemu-devel@nongnu.org; Mon, 08 Feb 2021 13:23:43 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:40447) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9BCF-00063L-QY for qemu-devel@nongnu.org; Mon, 08 Feb 2021 13:23:41 -0500 Received: by mail-wm1-x32f.google.com with SMTP id o24so42222wmh.5 for ; Mon, 08 Feb 2021 10:23:39 -0800 (PST) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x22sm19670wmc.25.2021.02.08.10.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 10:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6i9W6OOUOf+/H2AgjkKfRW+CSfY5qPrCTrtVFBIN+NA=; b=bGRLDat7YmehzyXmbYcs2xjOIumBX+sJhUbKkeqa7nAvQLiec9mow4C3GUID+beRbj n0EbTcOTzY8YWJIy4xhoGldU701ZakaaYi+8y6Tiu1umYmmrpd0mt2fFDs6CY29ytWbL ryDOh57gEITDwxzav3Hp7kTBD0LStC0bhrbFYtkNm0uKrtgrbHthNOxt3tdjZbmOOkSs dJOJ/njfMwoxr7S30Mret1WxAKKQW/QWpLlc1uQM5DFePy/ucDYhvZgJUqa8bOXGGsUq eT7S2GhnubHwFLN6giefMAcQcodTO5YHpCRBaO1bzOyjEVwypRpBEadT9m4QsrfNhlbr 3dAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6i9W6OOUOf+/H2AgjkKfRW+CSfY5qPrCTrtVFBIN+NA=; b=mFKia7eZHcSBlqXwJswz7RQyRIccacTZA2KnvWrDfXDqLsvDr9Ah310KGtP/o1qtCV UM0a32S2A3EhSJ9L1YQEWYbP9Dj4glk8Cw7C80rb3Dby22UHqi7/cb8mRUbAwkmH/8bg 2KLhky55rN9Pr/q0Nqmjh4DFvo4AtRwClByggA0Zqc4E1EdiJVtzuhSbpHvBQG/IamtG DphF9m+/PdHMnMIbllWMsV8Sq+++JDXAJOX1BCAgt/5KrGpHUGim3qvyVP17pZuk8n8A rW7R1aNLa+LWeAuq0EHTdMnYJibGG+yTyOZO6ZPwSsDscVsmG1iQzwxR12VrBvFlbhPf 4Rlw== X-Gm-Message-State: AOAM531qsIuTS5zAMgYKEsnwwuKnNHGQWVRxx5SAFvXFIo+Lwnbh5hWU xsqnKVELLLevptUwMM4TsaNjqwojkYnO6A== X-Google-Smtp-Source: ABdhPJyLgnpnkurvyBh/PKAgub1APy2s7L0KkzZHSeDvnNOdXuFGseI3yhaTzXADHKREp3RHvv7GEQ== X-Received: by 2002:a1c:7f83:: with SMTP id a125mr35645wmd.141.1612808618486; Mon, 08 Feb 2021 10:23:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/46] fuzz: enable dynamic args for generic-fuzz configs Date: Mon, 8 Feb 2021 19:22:50 +0100 Message-Id: <20210208182331.58897-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210208182331.58897-1-pbonzini@redhat.com> References: <20210208182331.58897-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::32f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov For some device configurations, it is useful to configure some resources, and adjust QEMU arguments at runtime, prior to fuzzing. This patch adds an "argfunc" to generic the generic_fuzz_config. When specified, it is responsible for configuring the resources and returning a string containing the corresponding QEMU arguments. This can be useful for targets that rely on e.g.: * a temporary qcow2 image * a temporary directory * an unused TCP port used to bind the VNC server Signed-off-by: Alexander Bulekov Reviewed-by: Thomas Huth Message-Id: <20210117230924.449676-2-alxndr@bu.edu> --- tests/qtest/fuzz/generic_fuzz.c | 10 +++++++++- tests/qtest/fuzz/generic_fuzz_configs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuz= z.c index deb74f15be..ee8c17a04c 100644 --- a/tests/qtest/fuzz/generic_fuzz.c +++ b/tests/qtest/fuzz/generic_fuzz.c @@ -933,12 +933,20 @@ static GString *generic_fuzz_cmdline(FuzzTarget *t) =20 static GString *generic_fuzz_predefined_config_cmdline(FuzzTarget *t) { + gchar *args; const generic_fuzz_config *config; g_assert(t->opaque); =20 config =3D t->opaque; setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1); - setenv("QEMU_FUZZ_ARGS", config->args, 1); + if (config->argfunc) { + args =3D config->argfunc(); + setenv("QEMU_FUZZ_ARGS", args, 1); + g_free(args); + } else { + g_assert_nonnull(config->args); + setenv("QEMU_FUZZ_ARGS", config->args, 1); + } setenv("QEMU_FUZZ_OBJECTS", config->objects, 1); return generic_fuzz_cmdline(t); } diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/gen= eric_fuzz_configs.h index aa4c03f1ae..51e69c6e42 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -16,6 +16,7 @@ =20 typedef struct generic_fuzz_config { const char *name, *args, *objects; + gchar* (*argfunc)(void); /* Result must be freeable by g_free() */ } generic_fuzz_config; =20 const generic_fuzz_config predefined_configs[] =3D { --=20 2.29.2