Skip to content

qapi: fix crash in dealloc visitor for union types

Michael Roth qemu-devel 3 versions – Applied

Status from this message: Applied to the qmp branch, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 2 repliesApplied
  2. v24 patches 4 repliesSuperseded
  3. v13 patches 12 repliesSuperseded

Changes in v3 from the cover letter

* fixed up commit msg in patch #2 (Eric)
* rebased on latest master

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/4qapi: add visit_start_union and visit_end_unioninclude/qapi/visitor-impl.h include/qapi/visitor.h qapi/qapi-visit-core.c +1 more+25 -00 replies
2/4qapi: dealloc visitor, implement visit_start_unionqapi/qapi-dealloc-visitor.c+26 -00 replies
3/4tests: add QMP input visitor test for unions with no discriminatortests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-input-strict.c+30 -00 replies
4/4qemu-iotests: Test missing "driver" key for blockdev-addtests/qemu-iotests/087 tests/qemu-iotests/087.out+30 -00 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchPaolo BonziniEric Blake
1/4R-b R-b
2/4R-b R-b
3/4R-b R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/4] qapi: fix crash in dealloc visitor for union types

This series introduces visit_start_union and visit_end_union as a way of allowing visitors to trigger generated code to bail out on visiting union fields if the visitor implementation deems doing so to be unsafe.

See patch 1 for the circumstances that cause the segfault in the dealloc visitor.

This is a spin-off of a patch submitted by Fam Zheng earlier. See the thread for additional background on why we're taking this approach:

http://thread.gmane.org/gmane.comp.emulators.qemu/296090

v3:
* fixed up commit msg in patch #2 (Eric)
* rebased on latest master

v2:
* added comments to clarify true/false visit_start_union vs. errp in dealloc visitor implementation (Eric)
* fixed a line that was >80 characters (Eric)
* fixed extra period in patch 2 commit msg (Eric)
* added comments to note reasons why the interface is useable for dealloc visitor, but may require extra QAPI groundwork and interface parameters to be useful for other types of visitors
* included Fam's qemu-iotest test case to exercise bug fix in a user-triggerable scenario.

 include/qapi/visitor-impl.h             |  2 ++
 include/qapi/visitor.h                  |  2 ++
 qapi/qapi-dealloc-visitor.c             | 26 +++++++++++++++++++++++
 qapi/qapi-visit-core.c                  | 15 +++++++++++++
 scripts/qapi-visit.py                   |  6 ++++++
 tests/qapi-schema/qapi-schema-test.json | 10 +++++++++
 tests/qapi-schema/qapi-schema-test.out  |  3 +++
 tests/qemu-iotests/087                  | 17 +++++++++++++++
 tests/qemu-iotests/087.out              | 13 ++++++++++++
 tests/test-qmp-input-strict.c           | 17 +++++++++++++++
 10 files changed, 111 insertions(+)