Commit Graph

2052 Commits

Author SHA1 Message Date
Jeremy White
f44a63b8ec Flush display commands before validating the surface.
This fixes a display glitch in xspice which is caused when
a surface create is queued, but then a direct call to update
the area is issued.  Unless we flush the queue, the surface
does not exist, and we fail.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2015-12-14 12:44:58 +01:00
Frediano Ziglio
aa09f04717 dcc: do not cause problem with multiple threads.
With multiple cards configured you can have multiple workers running in
different thread.
With such configuration static variables not syncronized could lead
to undefined behavior.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-11 18:56:54 +01:00
Marc-André Lureau
2862f0820d smartcard: include libcacard.h if possible
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2015-12-11 18:49:10 +01:00
Marc-André Lureau
4b82701b36 Add travis CI file
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2015-12-11 18:48:58 +01:00
Christophe Fergeau
ced752ac24 Update spice-common
shortlog for the spice-common changes this brings in:

Christophe Fergeau (3):
      build-sys: Add missing # to comment
      ssl-verify: Handle NULL return from g_inet_address_new_from_string()
      ssl-verify: Don't leak GInetAddress

Francois Gouget (3):
      build-sys: Add the SPICE_WARNING() and SPICE_PRINT_MESSAGES m4 macros
      build-sys: Add SPICE_CHECK_GSTREAMER()
      build-sys: Add SPICE_CHECK_GSTREAMER_ELEMENTS()

Lukas Venhoda (1):
      canvas_base: Remove redundant switch case block

Marc-André Lureau (2):
      Fix make distcheck
      Use new libcacard.h if possible
2015-12-11 18:48:13 +01:00
Christophe Fergeau
bfa5e5ce40 build-sys: Adjust to new spice-common spice-deps.m4
This commit also updates the spice-common submodule

Christophe Fergeau (7):
      Add marshaller test case
      build-sys: Use ${PKG_CONFIG} rather than pkg-config
      build-sys: Rework SPICE_CHECK_* m4 macros
      build-sys: Add gio-2.0 to SPICE_CHECK_GLIB2
      build-sys: Fix error in SPICE_CHECK_LZ4 description
      build-sys: Set automake conditional in SPICE_CHECK_SMARTCARD
      build-sys: Rename SUPPORT_GL to HAVE_GL

Javier Celaya (1):
      Fix linearization of several marshallers with one item

Lukas Venhoda (3):
      ssl-verify: Only check addr length when using IP addr
      m4: Require glib version >= 2.22
      ssl-verify: Changed IPv4 hostname to IPv6
2015-12-11 18:42:18 +01:00
Frediano Ziglio
337108469d remove small leak in MJPEG code
cinfo.dest is allocated in spice_jpeg_mem_dest but never freed.
Note that jpeg_destroy_compress does not free this field as is
supposed to be a buffer provided by jpeg caller.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-11 18:41:58 +01:00
Christophe Fergeau
7c5e5b02ba Add missing license headers 2015-12-11 18:41:19 +01:00
Christophe Fergeau
c0639738b4 syntax-check: Exclude png files from sc_prohibit_empty_lines_at_EOF 2015-12-11 18:41:19 +01:00
Christophe Fergeau
6564806e4f syntax-check: Clean-up exception rules
Some files no longer exists, some exceptions are no longer needed, ...
2015-12-11 18:41:19 +01:00
Christophe Fergeau
ecb2428adb syntax-check: Remove unused #include <strings.h> 2015-12-11 18:41:19 +01:00
Christophe Fergeau
80c3b866ff syntax-check: Add missing #include <config.h> 2015-12-11 18:41:09 +01:00
Christophe Fergeau
bb165ac3ab syntax-check: Don't use tabs for indentation 2015-12-11 18:39:49 +01:00
Christophe Fergeau
5228cd2a31 syntax-check: Exclude red_replay_qxl.c from sc_cast_of_argument_to_free
red_replay_qxl.c stores some pointers QXLPHYSICAL data members (ie
uint64_t), and then needs to free them, so the cast is required.
2015-12-11 18:39:49 +01:00
Christophe Fergeau
0ef10ddfda syntax-check: Ignore .png files in sc_trailing_blank test 2015-12-11 18:39:49 +01:00
Christophe Fergeau
2739738c9d syntax-check: manual: Remove duplicate word 2015-12-11 18:39:49 +01:00
Christophe Fergeau
e5c606998d syntax-check: Add missing AUTHORS 2015-12-11 18:39:49 +01:00
snir sheriber
b3898b4861 fix spelling mistakes in comments (reseting to resetting & dummym to dummy)
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-11 18:39:31 +01:00
Jeremy White
9e88d66565 Update the .gitignore files for the new manual,
for a few newly generated tests, and for the spice-server.h.
2015-12-11 18:39:27 +01:00
Frediano Ziglio
e60a3beb3c Simplify pointer computation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-12 14:11:22 +01:00
Christophe Fergeau
5d0649b8f0 build-sys: Remove client check from configure.ac
configure.ac is checking for pyparsing availability if
client/generated_marshallers.cpp is missing. The client/ code is gone, and
the python modules checks are done in spice-common/configure.ac
nowadays, so we can get rid of this check.
2015-10-07 18:26:00 +02:00
Frediano Ziglio
9e75019e65 build-sys: bump libtool version information
As one interface was added bump the version and put a comment to avoid
too much updates.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 17:09:16 +02:00
Christophe Fergeau
ee1beff2ab Mention the 2 recently fixed CVEs in NEWS 2015-10-06 17:09:15 +02:00
Frediano Ziglio
6e3547f8b1 Prevent leak if size from red_get_data_chunks don't match in red_get_image
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
b3be589ab3 Prevent data_size to be set independently from data
There was not check for data_size field so one could set data to
a small set of data and data_size much bigger than size of data
leading to buffer overflow.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
2b6695f122 Avoid race condition copying segments in red_get_path
The guest can attempt to increase the number of segments while
spice-server is reading them.
Make sure we don't copy more then the allocated segments.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
2693e0497e Make sure we can read QXLPathSeg structures
start pointer points to a QXLPathSeg structure.
Before reading from the structure, make sure the structure is contained
in the memory range checked.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
a447c4f2ac Fix some possible overflows in red_get_string for 32 bit
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
7d69184037 Prevent DoS from guest trying to allocate too much data on host for chunks
Limit number of chunks to a given amount to avoid guest trying to
allocate too much memory. Using circular or nested chunks lists
guest could try to allocate huge amounts of memory.
Considering the list can be infinite and guest can change data this
also prevents strange security attacks from guest.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
f3605979ce Prevent memory leak if red_get_data_chunks_ptr fails
Free linked list if client tries to do nasty things

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
3738478ed7 Fix race condition in red_get_data_chunks_ptr
Do not read multiple times data from guest as this can be changed by
other guest vcpus. This causes races and security problems if these
data are used for buffer allocation or checks.

Actually, the 'data' member can't change during read as it is just a
pointer to a fixed array contained in qxl. However, this change will
make it clear that there can be no race condition.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
caec52dc77 Fix integer overflow computing glyph_size in red_get_string
If bpp is int the formula can lead to weird overflows. width and height
are uint16_t so the formula is:

  size_t = u16 * (u16 * int + const_int) / const_int;

so it became

  size_t = (int) u16 * ((int) u16 * int + const_int) / const_int;

However the (int) u16 * (int) u16 can then became negative to overflow.
Under 64 bit architectures size_t is 64 and int usually 32 so converting
this negative 32 bit number to a unsigned 64 bit lead to a very big
number as the signed is extended and then converted to unsigned.
Using unsigned arithmetic prevent extending the sign.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:11 +01:00
Frediano Ziglio
dfaedec789 Fix race condition in red_get_string
Do not read multiple time an array size that can be changed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
9235c84e0f Fix race in red_get_image
Do not read multiple times data from guest as this could be changed
by other vcpu threads.
This causes races and security problems if these data are used for
buffer allocation or checks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
3dfd1a0828 Fix race condition on red_get_clip_rects
Do not read multiple time an array size that can be changed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
0f58e9da56 Prevent 32 bit integer overflow in bitmap_consistent
The overflow may lead to buffer overflow as the row size computed from
width (bitmap->x) can be bigger than the size in bytes (bitmap->stride).
This can make spice-server accept the invalid sizes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
68a742aaa8 Fix buffer reading overflow
Not security risk as just for read.
However, this could be used to attempt integer overflows in the
following lines.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
1eb93baa3c Check properly surface to be created
Check format is valid.
Check stride is at least the size of required bytes for a row.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
ac5f64a80a Fix some integer overflow causing large memory allocations
Prevent integer overflow when computing image sizes.
Image index computations are done using 32 bit so this can cause easily
security issues. MAX_DATA_CHUNK is larger than the virtual
card limit, so this is not going to cause change in behaviours.
Comparing size calculation results with MAX_DATA_CHUNK will allow us to
catch overflows.
Prevent guest from allocating large amount of memory.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
0205a6ce63 Define a constant to limit data from guest.
This limit will prevent guest trying to do nasty things and DoS to host.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:11:10 +01:00
Frediano Ziglio
097c638b12 worker: avoid double free or double create of surfaces
A driver can overwrite surface state creating a surface with the same
id of a previous one.
Also can try to destroy surfaces that are not created.
Both requests cause invalid internal states that could lead to crashes
or memory corruptions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-06 11:07:15 +01:00
Frediano Ziglio
dd558bb833 worker: validate correctly surfaces
Do not just give warning and continue to use an invalid index into
an array.

Resolves: CVE-2015-5260

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-06 11:07:15 +01:00
Marc-André Lureau
f2ea57335e worker: make it clear it returns from process when no cmd
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-05 14:45:16 +01:00
Marc-André Lureau
5e80266cb9 server: remove useless includes
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-02 10:13:45 +01:00
Christophe Fergeau
2cf810e99e manual: Fix Arnon last name
It's "Gilboa", not "Giloba"
2015-10-01 17:56:43 +02:00
Christophe Fergeau
3d16f8c0f0 manual: Add section about debugging
This details the basics for now, but can be detailed in the future.
2015-10-01 17:56:43 +02:00
Christophe Fergeau
f0aeb9db00 Update NEWS 2015-10-01 17:56:43 +02:00
Marc-André Lureau
bb969255c9 worker: count in drawable_new() 2015-09-29 18:59:54 +01:00
Jonathon Jongsma
61d458119e PALLET -> PALETTE
Use the correct spelling for the enumeration
2015-09-29 18:59:54 +01:00
Christophe Fergeau
5eaf659aa3 tests: Fix -Werror=format-zero-length build failure
replay.c: In function 'replay_channel_event':
replay.c:226:16: error: zero-length gnu_printf format string
[-Werror=format-zero-length]
     g_printerr("");
2015-09-29 18:59:54 +01:00