From nobody Fri Sep 5 22:32:30 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=1603708144; cv=none; d=zohomail.com; s=zohoarc; b=dtaZgUe92srjX8t69sPyjhF+ke0jUjzVr7TqLSGdav9H57D6Ba65N7/qIvDheMoqqxeHdg8pz2Oty3muEyGBwZo+06MLddmXYetPevMm23mbefNq1eMBynIG2uPO6L7VU5u23km1z3CNBK5ZPMwe+7kZ0TGklIJX2CHYLhbJg7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603708144; 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=YtpemJyXeENG1iyhpnYrZIyJX9D2vPnFL8PqSIH7ibQ=; b=XtlTwOkZbRBQ1lfPah/VraOqz74B9n4JjG4FnNhe2uDSRvgKz1AnZuxT5X6wFV8ttj2a0iTz7GICnScraRO06cX03DODBoeZfxCLtJxw2RnptGHhTFXfzU2MW79U9n4fxT0WJnvXfqBCsHgYLNf0WUzdQ+NFRKPwDNUzTHYBBSM= 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 160370814442094.44955682667228; Mon, 26 Oct 2020 03:29:04 -0700 (PDT) Received: from localhost ([::1]:43940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kWzkM-0007Mm-Sb for importer@patchew.org; Mon, 26 Oct 2020 06:29:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kWzPL-0002xI-D1 for qemu-devel@nongnu.org; Mon, 26 Oct 2020 06:07:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kWzPA-0006hW-3l for qemu-devel@nongnu.org; Mon, 26 Oct 2020 06:07:19 -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-218-XnQVwli7NduG9h-LypXLCA-1; Mon, 26 Oct 2020 06:06:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 978EC1009E3E; Mon, 26 Oct 2020 10:06:56 +0000 (UTC) Received: from thuth.com (ovpn-112-104.ams2.redhat.com [10.36.112.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8863E8B84F; Mon, 26 Oct 2020 10:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603706821; 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=YtpemJyXeENG1iyhpnYrZIyJX9D2vPnFL8PqSIH7ibQ=; b=NhoL5J5U25IV6rpGvFMaSJcCxkaThFq5gHjkBGoU6Ys0PgRc/CubKj0duXrxM0y5J4Xzes GBPE06uGvW9GzsOqkITPmCOKKau6QU98u4Fb9j9JfPSUK52Cjm6hsLMaQmVMIerSuOX0U8 ruPMgy5Upb+Wz2tHJDhPLIPEwHLE2O4= X-MC-Unique: XnQVwli7NduG9h-LypXLCA-1 From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 13/31] fuzz: Declare DMA Read callback function Date: Mon, 26 Oct 2020 11:06:14 +0100 Message-Id: <20201026100632.212530-14-thuth@redhat.com> In-Reply-To: <20201026100632.212530-1-thuth@redhat.com> References: <20201026100632.212530-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com 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=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/25 21:03:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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 This patch declares the fuzz_dma_read_cb function and uses the preprocessor and linker(weak symbols) to handle these cases: When we build softmmu/all with --enable-fuzzing, there should be no strong symbol defined for fuzz_dma_read_cb, and we link against a weak stub function. When we build softmmu/fuzz with --enable-fuzzing, we link against the strong symbol in generic_fuzz.c When we build softmmu/all without --enable-fuzzing, fuzz_dma_read_cb is an empty, inlined function. As long as we don't call any other functions when building the arguments, there should be no overhead. Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Message-Id: <20201023150746.107063-6-alxndr@bu.edu> Signed-off-by: Thomas Huth --- include/exec/memory.h | 8 ++++++++ softmmu/memory.c | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 93d27bff26..4aaf578ce6 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -47,6 +47,14 @@ void fuzz_dma_read_cb(size_t addr, size_t len, MemoryRegion *mr, bool is_write); +#else +static inline void fuzz_dma_read_cb(size_t addr, + size_t len, + MemoryRegion *mr, + bool is_write) +{ + /* Do Nothing */ +} #endif =20 extern bool global_dirty_log; diff --git a/softmmu/memory.c b/softmmu/memory.c index a5d1641820..cec0e0f743 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -3246,6 +3246,19 @@ void memory_region_init_rom_device(MemoryRegion *mr, vmstate_register_ram(mr, owner_dev); } =20 +/* + * Support softmmu builds with CONFIG_FUZZ using a weak symbol and a stub = for + * the fuzz_dma_read_cb callback + */ +#ifdef CONFIG_FUZZ +void __attribute__((weak)) fuzz_dma_read_cb(size_t addr, + size_t len, + MemoryRegion *mr, + bool is_write) +{ +} +#endif + static const TypeInfo memory_region_info =3D { .parent =3D TYPE_OBJECT, .name =3D TYPE_MEMORY_REGION, --=20 2.18.2