[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/33] qapi: Document shortcoming with union 'data' b
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 15/33] qapi: Document shortcoming with union 'data' branch |
Date: |
Fri, 4 Sep 2015 16:21:22 +0200 |
From: Eric Blake <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
scripts/qapi-types.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 82141cd..8444f98 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -219,6 +219,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 { /* union tag is @%(c_name)s */
void *data;
--
2.4.3
- [Qemu-devel] [PULL 00/33] qapi: Another round of fixes and cleanups, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 04/33] qapi-event: Clean up how name of enum QAPIEvent is made, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 05/33] qapi: Reject -p arguments that break qapi-event.py, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 03/33] qapi: Simplify guardname(), Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 01/33] qapi: Clarify docs on including the same file multiple times, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 11/33] qapi-visit: Fix two name arguments passed to visitors, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 07/33] qapi: Fix generated code when flat union has member 'kind', Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 14/33] qapi: Document that input visitor semantics are prone to leaks, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 13/33] tests/qapi-schema: Document events with base don't work, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 15/33] qapi: Document shortcoming with union 'data' branch,
Markus Armbruster <=
- [Qemu-devel] [PULL 06/33] qapi: Drop unused and useless parameters and variables, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 23/33] qapi-commands: Inline gen_marshal_output_call(), Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 27/33] qapi: Drop one of two "simple union must not have base" checks, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 25/33] qapi-commands: Drop useless initialization, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 02/33] qapi: Clean up cgen() and mcgen(), Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 22/33] qapi-commands: Fix gen_err_check(e) for e and e != 'local_err', Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 08/33] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 12/33] tests/qapi-schema: Document alternate's enum lacks visit function, Markus Armbruster, 2015/09/04