[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/29] enforce use of G_GNUC_PRINTF attributes
From: |
Paolo Bonzini |
Subject: |
[PULL 14/29] enforce use of G_GNUC_PRINTF attributes |
Date: |
Tue, 10 Jan 2023 17:02:18 +0100 |
From: Daniel P. Berrangé <berrange@redhat.com>
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é <berrange@redhat.com>
Message-Id: <20221219130205.687815-7-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure b/configure
index 6f5e77a71361..203b957a045f 100755
--- a/configure
+++ b/configure
@@ -1183,6 +1183,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
--
2.38.1
- [PULL 00/29] Misc patches for 2023-01-10, Paolo Bonzini, 2023/01/10
- [PULL 01/29] configure: fix GLIB_VERSION for cross-compilation, Paolo Bonzini, 2023/01/10
- [PULL 04/29] KVM: keep track of running ioctls, Paolo Bonzini, 2023/01/10
- [PULL 05/29] kvm: Atomic memslot updates, Paolo Bonzini, 2023/01/10
- [PULL 03/29] accel: introduce accelerator blocker API, Paolo Bonzini, 2023/01/10
- [PULL 02/29] i386: Emit correct error code for 64-bit IDT entry, Paolo Bonzini, 2023/01/10
- [PULL 10/29] hw/xen: use G_GNUC_PRINTF/SCANF for various functions, Paolo Bonzini, 2023/01/10
- [PULL 14/29] enforce use of G_GNUC_PRINTF attributes,
Paolo Bonzini <=
- [PULL 07/29] chardev: clean up chardev-parallel.c, Paolo Bonzini, 2023/01/10
- [PULL 15/29] hw/display: avoid creating empty loadable modules, Paolo Bonzini, 2023/01/10
- [PULL 11/29] tools/virtiofsd: add G_GNUC_PRINTF for logging functions, Paolo Bonzini, 2023/01/10
- [PULL 17/29] libvhost-user: Replace typeof with __typeof__, Paolo Bonzini, 2023/01/10
- [PULL 24/29] libvduse: Fix assignment in vring_set_avail_event, Paolo Bonzini, 2023/01/10
- [PULL 22/29] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU, Paolo Bonzini, 2023/01/10
- [PULL 21/29] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant, Paolo Bonzini, 2023/01/10
- [PULL 06/29] target/i386: Remove compilation errors when -Werror=maybe-uninitialized, Paolo Bonzini, 2023/01/10