9ae3a8
From 8c58dddfb0bdd43600840ff14b03b42bacfea18c Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Tue, 5 Nov 2013 14:08:56 +0100
9ae3a8
Subject: [PATCH 43/87] qapi-types.py: Fix enum struct sizes on i686
9ae3a8
9ae3a8
RH-Author: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Message-id: <1383660558-32096-3-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 55381
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 02/24] qapi-types.py: Fix enum struct sizes on i686
9ae3a8
Bugzilla: 978402
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
From: Cole Robinson <crobinso@redhat.com>
9ae3a8
9ae3a8
Unlike other list types, enum wasn't adding any padding, which caused
9ae3a8
a mismatch between the generated struct size and GenericList struct
9ae3a8
size. More details in a678e26cbe89f7a27cbce794c2c2784571ee9d21
9ae3a8
9ae3a8
This crashed qemu if calling qmp query-tpm-types for example, which
9ae3a8
upsets libvirt capabilities probing. Reproducer on i686:
9ae3a8
9ae3a8
(sleep 5; printf '{"execute":"qmp_capabilities"}\n{"execute":"query-tpm-types"}\n') | ./i386-softmmu/qemu-system-i386 -S -nodefaults -nographic -M none -qmp stdio
9ae3a8
9ae3a8
https://bugs.launchpad.net/qemu/+bug/1219207
9ae3a8
9ae3a8
Cc: qemu-stable@nongnu.org
9ae3a8
Signed-off-by: Cole Robinson <crobinso@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Tested-by: Richard W.M. Jones <rjones@redhat.com>
9ae3a8
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
(cherry picked from commit 02dc4bf5684d3fb46786fab2ecff98214b1df9fe)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 scripts/qapi-types.py | 5 ++++-
9ae3a8
 1 file changed, 4 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 scripts/qapi-types.py |    5 ++++-
9ae3a8
 1 files changed, 4 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
9ae3a8
index e9bd638..8680160 100644
9ae3a8
--- a/scripts/qapi-types.py
9ae3a8
+++ b/scripts/qapi-types.py
9ae3a8
@@ -45,7 +45,10 @@ def generate_fwd_enum_struct(name, members):
9ae3a8
     return mcgen('''
9ae3a8
 typedef struct %(name)sList
9ae3a8
 {
9ae3a8
-    %(name)s value;
9ae3a8
+    union {
9ae3a8
+        %(name)s value;
9ae3a8
+        uint64_t padding;
9ae3a8
+    };
9ae3a8
     struct %(name)sList *next;
9ae3a8
 } %(name)sList;
9ae3a8
 ''',
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8