qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] cbf97d: qapi: Fix visit_type_STRUCT() not to


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] cbf97d: qapi: Fix visit_type_STRUCT() not to fail for null...
Date: Tue, 21 Jul 2020 09:01:52 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: cbf97d5b799f4bc47b9e825100d1a98d3cf77c80
      
https://github.com/qemu/qemu/commit/cbf97d5b799f4bc47b9e825100d1a98d3cf77c80
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-07-21 (Tue, 21 Jul 2020)

  Changed paths:
    M scripts/qapi/visit.py

  Log Message:
  -----------
  qapi: Fix visit_type_STRUCT() not to fail for null object

To make deallocating partially constructed objects work, the
visit_type_STRUCT() need to succeed without doing anything when passed
a null object.

Commit cdd2b228b9 "qapi: Smooth visitor error checking in generated
code" broke that.  To reproduce, run tests/test-qobject-input-visitor
with AddressSanitizer:

    ==4353==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 16 byte(s) in 1 object(s) allocated from:
        #0 0x7f192d0c5d28 in __interceptor_calloc 
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
        #1 0x7f192cd21b10 in g_malloc0 
(/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51b10)
        #2 0x556725f6bbee in visit_next_list qapi/qapi-visit-core.c:86
        #3 0x556725f49e15 in visit_type_UserDefOneList 
tests/test-qapi-visit.c:474
        #4 0x556725f4489b in test_visitor_in_fail_struct_in_list 
tests/test-qobject-input-visitor.c:1086
        #5 0x7f192cd42f29  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72f29)

    SUMMARY: AddressSanitizer: 16 byte(s) leaked in 1 allocation(s).

Test case /visitor/input/fail/struct-in-list feeds a list with a bad
element to the QObject input visitor.  Visiting that element duly
fails, and aborts the visit with the list only partially constructed:
the faulty object is null.  Cleaning up the partially constructed list
visits that null object, fails, and aborts the visit before the list
node gets freed.

Fix the the generated visit_type_STRUCT() to succeed for null objects.

Fixes: cdd2b228b973d2a29edf7696ef6e8b08ec329019
Reported-by: Li Qiang <liq3ea@163.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200716150617.4027356-1-armbru@redhat.com>
Tested-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>


  Commit: 8856755eb8075ca6f3dab51c2791c210ebfe6550
      
https://github.com/qemu/qemu/commit/8856755eb8075ca6f3dab51c2791c210ebfe6550
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-07-21 (Tue, 21 Jul 2020)

  Changed paths:
    M scripts/qapi/visit.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-07-21' into 
staging

QAPI patches patches for 2020-07-21

# gpg: Signature made Tue 21 Jul 2020 14:05:05 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2020-07-21:
  qapi: Fix visit_type_STRUCT() not to fail for null object

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/98d897eb4b6f...8856755eb807



reply via email to

[Prev in Thread] Current Thread [Next in Thread]