From: Markus Armbruster <armbru@redhat.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: Li Qiang <liq3ea@163.com>, Qemu Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH for-5.1] qapi: Fix visit_type_STRUCT() not to fail for null object
Date: Tue, 21 Jul 2020 14:39:37 +0200 [thread overview]
Message-ID: <871rl582k6.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAKXe6S+BKQtmPfciz5f5NoWnw=PT-wgB1t447=eFgPCjsONkKQ@mail.gmail.com> (Li Qiang's message of "Fri, 17 Jul 2020 00:20:37 +0800")
Li Qiang <liq3ea@gmail.com> writes:
> Markus Armbruster <armbru@redhat.com> 于2020年7月16日周四 下午11:07写道:
>>
>> 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>
>
> Oh, I also sent this too.
> Not matter, just ignore my patch.
>
> Tested-by: Li Qiang <liq3ea@gmail.com>
> Reviewed-by: Li Qiang <liq3ea@gmail.com>
Thanks!
Queued for 5.1.
prev parent reply other threads:[~2020-07-21 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 15:06 [PATCH for-5.1] qapi: Fix visit_type_STRUCT() not to fail for null object Markus Armbruster
2020-07-16 16:04 ` no-reply
2020-07-16 16:20 ` Li Qiang
2020-07-21 12:39 ` Markus Armbruster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rl582k6.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=liq3ea@163.com \
--cc=liq3ea@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.