Skip to content

enforce use of G_GNUC_PRINTF annotations

Daniel P. Berrangé qemu-arm qemu-devel virtio-fs xen-devel 1 version Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 8 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/6disas: add G_GNUC_PRINTF to gstring_printfdisas.c+1 -01 reply
2/6hw/xen: use G_GNUC_PRINTF/SCANF for various functionshw/xen/xen-bus.c hw/xen/xen_pvdev.c include/hw/xen/xen-bus-helper.h +1 more+8 -31 reply
3/6tools/virtiofsd: add G_GNUC_PRINTF for logging functionstools/virtiofsd/fuse_log.c tools/virtiofsd/fuse_log.h tools/virtiofsd/passthrough_ll.c+6 -21 reply
4/6util/error: add G_GNUC_PRINTF for various functionsutil/error-report.c util/error.c+2 -02 replies
5/6tests: add G_GNUC_PRINTF for various functionstests/qtest/ahci-test.c tests/qtest/arm-cpu-features.c tests/qtest/erst-test.c +11 more+36 -182 replies
6/6enforce use of G_GNUC_PRINTF attributesconfigure+2 -00 replies

Reviews trailers per patch

3 of 6 patches have a Reviewed-by or Acked-by.

PatchAnthony PERARDPhilippe Mathieu-DaudéThomas HuthDr. David Alan Gilbert
1/6
2/6A-b
3/6R-b
4/6R-b R-b
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 0/6] enforce use of G_GNUC_PRINTF annotations

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.

This series adds G_GNUC_PRINTF / G_GNUC_SCANF to allow the code locations that the compilers highlight. Then it adds the above warning flags to the build flags, to catch any future additions of functions that take printf/scanf format strings.

Daniel P. Berrangé (6):
disas: add G_GNUC_PRINTF to gstring_printf hw/xen: use G_GNUC_PRINTF/SCANF for various functions tools/virtiofsd: add G_GNUC_PRINTF for logging functions util/error: add G_GNUC_PRINTF for various functions
tests: add G_GNUC_PRINTF for various functions enforce use of G_GNUC_PRINTF attributes

 configure                         |  2 ++
 disas.c                           |  1 +
 hw/xen/xen-bus.c                  |  1 +
 hw/xen/xen_pvdev.c                |  1 +
 include/hw/xen/xen-bus-helper.h   |  6 ++++--
 include/hw/xen/xen-bus.h          |  3 ++-
 tests/qtest/ahci-test.c           |  3 +++
 tests/qtest/arm-cpu-features.c    |  1 +
 tests/qtest/erst-test.c           |  2 +-
 tests/qtest/ide-test.c            |  3 ++-
 tests/qtest/ivshmem-test.c        |  4 ++--
 tests/qtest/libqmp.c              |  2 +-
 tests/qtest/libqos/libqos-pc.h    |  6 ++++--
 tests/qtest/libqos/libqos-spapr.h |  6 ++++--
 tests/qtest/libqos/libqos.h       |  6 ++++--
 tests/qtest/libqos/virtio-9p.c    |  1 +
 tests/qtest/migration-helpers.h   |  1 +
 tests/qtest/rtas-test.c           |  2 +-
 tests/qtest/usb-hcd-uhci-test.c   |  4 ++--
 tests/unit/test-qmp-cmds.c        | 13 +++++++++----
 tools/virtiofsd/fuse_log.c        |  1 +
 tools/virtiofsd/fuse_log.h        |  6 ++++--
 tools/virtiofsd/passthrough_ll.c  |  1 +
 util/error-report.c               |  1 +
 util/error.c                      |  1 +
 25 files changed, 55 insertions(+), 23 deletions(-)
Signature · 1 line
2.38.1