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