From patchwork Mon Dec 19 13:02:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 13076559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F4D8C3DA7C for ; Mon, 19 Dec 2022 13:02:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.466034.724877 (Exim 4.92) (envelope-from ) id 1p7Fmj-00075U-4N; Mon, 19 Dec 2022 13:02:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 466034.724877; Mon, 19 Dec 2022 13:02:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p7Fmj-00075I-0s; Mon, 19 Dec 2022 13:02:25 +0000 Received: by outflank-mailman (input) for mailman id 466034; Mon, 19 Dec 2022 13:02:24 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p7Fmh-0006YQ-Vv for xen-devel@lists.xenproject.org; Mon, 19 Dec 2022 13:02:23 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5afc1127-7f9d-11ed-8fd4-01056ac49cbb; Mon, 19 Dec 2022 14:02:14 +0100 (CET) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-DcjDLQb1Pqev8Hw37c1HFA-1; Mon, 19 Dec 2022 08:02:16 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 201E580D11E; Mon, 19 Dec 2022 13:02:11 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78B9B14171B8; Mon, 19 Dec 2022 13:02:10 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5afc1127-7f9d-11ed-8fd4-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671454942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3uNZWGWuQwUgGmH+7L3OtwPhlC39/K0HmCAU4bDa1hs=; b=TC6at/mOdITUr1hEjFaUJjrLP4FvMjYfYYhb8XaKv3IzC0HmSsA2I3of3HsPwRCshy28LV WIcnr9Iywkw6gactAmpptsehXylR51NdX1jJUBGM5CYM9Xx6ZnxGWtWyJiIt0+7f1oiLbx L5K0rdPphxM7DLKHNwrunH70+iiYCsw= X-MC-Unique: DcjDLQb1Pqev8Hw37c1HFA-1 From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , qemu-ppc@nongnu.org, xen-devel@lists.xenproject.org, Laurent Vivier , Markus Armbruster , Daniel Henrique Barboza , virtio-fs@redhat.com, Michael Roth , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-block@nongnu.org, Peter Maydell , qemu-arm@nongnu.org, Paul Durrant , Anthony Perard , David Gibson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , John Snow , Stefan Hajnoczi , Paolo Bonzini , Stefano Stabellini , Gerd Hoffmann , Greg Kurz , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH 6/6] enforce use of G_GNUC_PRINTF attributes Date: Mon, 19 Dec 2022 08:02:05 -0500 Message-Id: <20221219130205.687815-7-berrange@redhat.com> In-Reply-To: <20221219130205.687815-1-berrange@redhat.com> References: <20221219130205.687815-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 We've been very gradually adding G_GNUC_PRINTF annotations to functions over years. This has been useful in detecting certain malformed printf strings, or cases where we pass user data as the printf format which is a potential security flaw. Given the inherant memory corruption danger in use of format strings vs mis-matched variadic arguments, it is worth applying G_GNUC_PRINTF to all functions using printf, even if we know they are safe. The compilers can reasonably reliably identify such places with the -Wsuggest-attribute=format / -Wmissing-format-attribute flags. Signed-off-by: Daniel P. Berrangé --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 26c7bc5154..b9abe19e16 100755 --- a/configure +++ b/configure @@ -1208,6 +1208,8 @@ add_to warn_flags -Wnested-externs add_to warn_flags -Wendif-labels add_to warn_flags -Wexpansion-to-defined add_to warn_flags -Wimplicit-fallthrough=2 +add_to warn_flags -Wsuggest-attribute=format +add_to warn_flags -Wmissing-format-attribute nowarn_flags= add_to nowarn_flags -Wno-initializer-overrides