diff --git a/0001-server-red_memslots-drop-two-unused-functions.patch b/0001-server-red_memslots-drop-two-unused-functions.patch new file mode 100644 index 0000000..baa0195 --- /dev/null +++ b/0001-server-red_memslots-drop-two-unused-functions.patch @@ -0,0 +1,65 @@ +From c90d42e2acb6655508e37d42925dc6062d75f479 Mon Sep 17 00:00:00 2001 +From: Alon Levy +Date: Wed, 21 Mar 2012 17:55:23 +0200 +Subject: [PATCH 1/4] server/red_memslots: drop two unused functions + +cb_get_virt and cb_validate_virt have disappeared a long time ago, +not needed since: + +commit 5ac88aa79fa6445f96e5419d8bf4fce81da63b90 +Author: Gerd Hoffmann +Date: Thu Jul 1 17:55:33 2010 +0200 + + Properly parse QXLImage to the new-world SpiceImage + + SpiceImage now replaces RedImage and has all image types in it. + All image data are now chunked (and as such not copied when demarshalling). +--- + server/red_memslots.c | 14 -------------- + server/red_memslots.h | 5 ----- + 2 files changed, 19 deletions(-) + +diff --git a/server/red_memslots.c b/server/red_memslots.c +index d98f38c..5057218 100644 +--- a/server/red_memslots.c ++++ b/server/red_memslots.c +@@ -127,20 +127,6 @@ unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_si + return h_virt; + } + +-void *cb_get_virt(void *opaque, unsigned long addr, +- uint32_t add_size, uint32_t group_id) +-{ +- return (void *)get_virt((RedMemSlotInfo *)opaque, addr, add_size, group_id); +-} +- +-void cb_validate_virt(void *opaque, +- unsigned long virt, unsigned long from_addr, +- uint32_t add_size, uint32_t group_id) +-{ +- int slot_id = get_memslot_id((RedMemSlotInfo *)opaque, from_addr); +- validate_virt((RedMemSlotInfo *)opaque, virt, slot_id, add_size, group_id); +-} +- + void *validate_chunk (RedMemSlotInfo *info, QXLPHYSICAL data, uint32_t group_id, uint32_t *data_size_out, QXLPHYSICAL *next_out) + { + QXLDataChunk *chunk; +diff --git a/server/red_memslots.h b/server/red_memslots.h +index 18d5208..7aea0a3 100644 +--- a/server/red_memslots.h ++++ b/server/red_memslots.h +@@ -60,11 +60,6 @@ unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_si + int group_id); + + void *validate_chunk (RedMemSlotInfo *info, QXLPHYSICAL data, uint32_t group_id, uint32_t *data_size_out, QXLPHYSICAL *next_out); +-void *cb_get_virt(void *opaque, unsigned long addr, +- uint32_t add_size, uint32_t group_id); +-void cb_validate_virt(void *opaque, +- unsigned long virt, unsigned long from_addr, +- uint32_t add_size, uint32_t group_id); + void red_memslot_info_init(RedMemSlotInfo *info, + uint32_t num_groups, uint32_t num_slots, + uint8_t generation_bits, +-- +1.7.10 + diff --git a/0002-server-red_memslots-use-QXLPHYSICAL-for-addresses.patch b/0002-server-red_memslots-use-QXLPHYSICAL-for-addresses.patch new file mode 100644 index 0000000..5012815 --- /dev/null +++ b/0002-server-red_memslots-use-QXLPHYSICAL-for-addresses.patch @@ -0,0 +1,47 @@ +From 9ee43c37ce8dc028695d81728ac6da88bb79b653 Mon Sep 17 00:00:00 2001 +From: Alon Levy +Date: Wed, 21 Mar 2012 17:57:32 +0200 +Subject: [PATCH 2/4] server/red_memslots: use QXLPHYSICAL for addresses + +Cannot assume unsigned long == QXLPHYSICAL, not true for 32 bit +architectures. +--- + server/red_memslots.c | 2 +- + server/red_memslots.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/server/red_memslots.c b/server/red_memslots.c +index 5057218..8c8f3cc 100644 +--- a/server/red_memslots.c ++++ b/server/red_memslots.c +@@ -91,7 +91,7 @@ void validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id, + } + } + +-unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_size, ++unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size, + int group_id) + { + int slot_id; +diff --git a/server/red_memslots.h b/server/red_memslots.h +index 7aea0a3..75754d0 100644 +--- a/server/red_memslots.h ++++ b/server/red_memslots.h +@@ -43,12 +43,12 @@ typedef struct RedMemSlotInfo { + unsigned long memslot_clean_virt_mask; + } RedMemSlotInfo; + +-static inline int get_memslot_id(RedMemSlotInfo *info, unsigned long addr) ++static inline int get_memslot_id(RedMemSlotInfo *info, uint64_t addr) + { + return addr >> info->memslot_id_shift; + } + +-static inline int get_generation(RedMemSlotInfo *info, unsigned long addr) ++static inline int get_generation(RedMemSlotInfo *info, uint64_t addr) + { + return (addr >> info->memslot_gen_shift) & info->memslot_gen_mask; + } +-- +1.7.10 + diff --git a/0003-server-red_worker-fix-for-case-where-ASSERT-is-compi.patch b/0003-server-red_worker-fix-for-case-where-ASSERT-is-compi.patch new file mode 100644 index 0000000..bed5c6e --- /dev/null +++ b/0003-server-red_worker-fix-for-case-where-ASSERT-is-compi.patch @@ -0,0 +1,28 @@ +From f13ca1277418ed91d009a8db0faf36fbd1c0a7e0 Mon Sep 17 00:00:00 2001 +From: Alon Levy +Date: Tue, 20 Mar 2012 18:59:21 +0200 +Subject: [PATCH 3/4] server/red_worker: fix for case where ASSERT is compiled + out + +--- + server/red_worker.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/server/red_worker.c b/server/red_worker.c +index 80fa825..8a4315d 100644 +--- a/server/red_worker.c ++++ b/server/red_worker.c +@@ -8379,9 +8379,8 @@ static void red_display_marshall_stream_clip(RedChannelClient *rcc, + { + DisplayChannelClient *dcc = RCC_TO_DCC(rcc); + StreamAgent *agent = item->stream_agent; +- Stream *stream = agent->stream; + +- ASSERT(stream); ++ ASSERT(agent->stream); + + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP, &item->base); + SpiceMsgDisplayStreamClip stream_clip; +-- +1.7.10 + diff --git a/0004-server-red_memslots-don-t-assume-64-bit-environment.patch b/0004-server-red_memslots-don-t-assume-64-bit-environment.patch new file mode 100644 index 0000000..7d222aa --- /dev/null +++ b/0004-server-red_memslots-don-t-assume-64-bit-environment.patch @@ -0,0 +1,83 @@ +From 3d0448314812457e027e513c2d0dc163c421914a Mon Sep 17 00:00:00 2001 +From: Alon Levy +Date: Tue, 20 Mar 2012 19:00:49 +0200 +Subject: [PATCH 4/4] server/red_memslots: don't assume 64 bit environment + +assumption that unsigned long == QXLPHYSICAL causes get_virt to compute +the wrong slot. Fix by replacing addr variables to be of type +QXLPHYSICAL. +--- + server/red_memslots.c | 13 ++++++++----- + server/red_memslots.h | 4 ++-- + 2 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/server/red_memslots.c b/server/red_memslots.c +index 8c8f3cc..249b241 100644 +--- a/server/red_memslots.c ++++ b/server/red_memslots.c +@@ -19,10 +19,12 @@ + #include + #endif + ++#include ++ + #include "red_common.h" + #include "red_memslots.h" + +-static unsigned long __get_clean_virt(RedMemSlotInfo *info, unsigned long addr) ++static unsigned long __get_clean_virt(RedMemSlotInfo *info, QXLPHYSICAL addr) + { + return addr & info->memslot_clean_virt_mask; + } +@@ -46,7 +48,7 @@ static void print_memslots(RedMemSlotInfo *info) + } + } + +-unsigned long get_virt_delta(RedMemSlotInfo *info, unsigned long addr, int group_id) ++unsigned long get_virt_delta(RedMemSlotInfo *info, QXLPHYSICAL addr, int group_id) + { + MemSlot *slot; + int slot_id; +@@ -107,7 +109,7 @@ unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size + slot_id = get_memslot_id(info, addr); + if (slot_id > info->num_memslots) { + print_memslots(info); +- PANIC("slot_id too big, addr=%lx", addr); ++ PANIC("slot_id too big, addr=%" PRIx64, addr); + } + + slot = &info->mem_slots[group_id][slot_id]; +@@ -165,10 +167,11 @@ void red_memslot_info_init(RedMemSlotInfo *info, + info->mem_slots[i] = spice_new0(MemSlot, num_slots); + } + ++ /* TODO: use QXLPHYSICAL_BITS */ + info->memslot_id_shift = 64 - info->mem_slot_bits; + info->memslot_gen_shift = 64 - (info->mem_slot_bits + info->generation_bits); +- info->memslot_gen_mask = ~((unsigned long)-1 << info->generation_bits); +- info->memslot_clean_virt_mask = (((unsigned long)(-1)) >> ++ info->memslot_gen_mask = ~((QXLPHYSICAL)-1 << info->generation_bits); ++ info->memslot_clean_virt_mask = (((QXLPHYSICAL)(-1)) >> + (info->mem_slot_bits + info->generation_bits)); + } + +diff --git a/server/red_memslots.h b/server/red_memslots.h +index 75754d0..d50587f 100644 +--- a/server/red_memslots.h ++++ b/server/red_memslots.h +@@ -53,10 +53,10 @@ static inline int get_generation(RedMemSlotInfo *info, uint64_t addr) + return (addr >> info->memslot_gen_shift) & info->memslot_gen_mask; + } + +-unsigned long get_virt_delta(RedMemSlotInfo *info, unsigned long addr, int group_id); ++unsigned long get_virt_delta(RedMemSlotInfo *info, QXLPHYSICAL addr, int group_id); + void validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id, + uint32_t add_size, uint32_t group_id); +-unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_size, ++unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size, + int group_id); + + void *validate_chunk (RedMemSlotInfo *info, QXLPHYSICAL data, uint32_t group_id, uint32_t *data_size_out, QXLPHYSICAL *next_out); +-- +1.7.10 + diff --git a/spice.spec b/spice.spec index 406c87c..7bf466e 100644 --- a/spice.spec +++ b/spice.spec @@ -1,12 +1,16 @@ Name: spice Version: 0.10.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Implements the SPICE protocol Group: User Interface/Desktops License: LGPLv2+ URL: http://www.spice-space.org/ Source0: http://www.spice-space.org/download/releases/%{name}-%{version}.tar.bz2 Source1: spice-xpi-client-spicec +Patch0: 0001-server-red_memslots-drop-two-unused-functions.patch +Patch1: 0002-server-red_memslots-use-QXLPHYSICAL-for-addresses.patch +Patch2: 0003-server-red_worker-fix-for-case-where-ASSERT-is-compi.patch +Patch3: 0004-server-red_memslots-don-t-assume-64-bit-environment.patch # https://bugzilla.redhat.com/show_bug.cgi?id=613529 ExclusiveArch: i686 x86_64 @@ -67,6 +71,10 @@ using spice-server, you will need to install spice-server-devel. %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %configure --enable-gui --enable-smartcard @@ -110,6 +118,9 @@ fi %{_libdir}/pkgconfig/spice-server.pc %changelog +* Tue Apr 24 2012 Alon Levy +- Add 32 bit fixes from git master. (#815717) + * Tue Feb 28 2012 Fedora Release Engineering - 0.10.1-2 - Rebuilt for c++ ABI breakage