From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKwvD-0005Gt-7b for qemu-devel@nongnu.org; Thu, 30 Jul 2015 19:07:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKwv8-0004Dj-TC for qemu-devel@nongnu.org; Thu, 30 Jul 2015 19:07:31 -0400 Received: from resqmta-po-06v.sys.comcast.net ([2001:558:fe16:19:96:114:154:165]:34978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKwv8-0004DG-Je for qemu-devel@nongnu.org; Thu, 30 Jul 2015 19:07:26 -0400 From: Eric Blake Date: Thu, 30 Jul 2015 17:07:17 -0600 Message-Id: <1438297637-26789-1-git-send-email-eblake@redhat.com> In-Reply-To: <1435782155-31412-13-git-send-email-armbru@redhat.com> References: <1435782155-31412-13-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [RFC PATCH 12.6/47] qapi: Document shortcoming with union 'data' branch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Markus Armbruster , Michael Roth Add a FIXME to remind us to fully audit whether removing the 'void *data' branch of each qapi union type can be done safely. Signed-off-by: Eric Blake --- Another potential doc FIXME patch, this time based on 7/47 (https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg06101.html) scripts/qapi-types.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index c6c2786..b3434b9 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -217,6 +217,14 @@ struct %(name)s ''', discriminator_type_name=c_name(discriminator_type_name)) + # FIXME: What purpose does data serve, besides preventing a union that + # has a branch named 'data'? We use it in qapi-visit.py to decide + # whether to bypass the switch statement if visiting the discriminator + # failed; but since we 0-initialize structs, and cannot tell what + # branch of the union is in use if the discriminator is invalid, there + # should not be any data leaks even without a data pointer. Or, if + # 'data' is merely added to guarantee we don't have an empty union, + # shouldn't we enforce that at .json parse time? ret += mcgen(''' union { void *data; -- 2.4.3