summaryrefslogtreecommitdiffstats
path: root/server
Commit message (Collapse)AuthorAgeFilesLines
* ppc: Fix glz magic endianessChristophe Fergeau2015-04-101-1/+2
| | | | | This is a modified version of a patch initially by Erlon R. Cruz <erlon.cruz@br.flextronics.com>
* ppc: Fixing endianness for channel messagesChristophe Fergeau2015-04-101-10/+10
| | | | | This is a modified version of a patch initially from Erlon R. Cruz <erlon.cruz@br.flextronics.com>
* ppc: Fix endianness handling in initial SPICE connectionChristophe Fergeau2015-04-102-17/+46
| | | | | | | | | | | | This commit fixes enough endianness issues that it's possible to connect to a spice-server/qemu running on a big-endian box with a client running on a little-endian machine. I haven't tested more than getting to the bios/bootloader and typing a bit on the keyboard as I did not manage to boot a distro afterwards :( This is based on patches send by Erlon R. Cruz <erlon.cruz@br.flextronics.com>
* Do not compress bitmaps on UNIX socketFabiano Fidêncio2015-02-251-1/+2
| | | | On UNIX socket do not perform unnecessary image compression
* tests: Fix build on HurdFabiano Fidêncio2015-02-241-0/+4
| | | | | | | As PATH_MAX is not defined on Hurd, let's check for it and define whenever it is necessary. https://bugs.freedesktop.org/show_bug.cgi?id=74313
* char-device: spice_char_device_write_to_device: protect against recursionUri Lublin2015-02-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes Spice's smart card support and is related to commit 697f3214fd16adcd524456003619f7f44ddd031b. Reported-by: Swapna Krishnan <skrishna@redhat.com> Recursion is now possible starting with spice_char_device_write_to_device going through spice_char_device_wakeup (after going through qemu), calling again to spice_char_device_write_to_device. The protecting code is the same as the one protecting the read path. This function call loop makes the program to abort with the following messages: usb-ccid: chardev: unexpected message of type 3000000 qemu: qemu_mutex_lock: Resource deadlock avoided Backtrace: (gdb) bt * #0 0x00007ffff3fc78c7 in raise () from /lib64/libc.so.6 * #1 0x00007ffff3fc952a in abort () from /lib64/libc.so.6 * #2 0x0000555555969a95 in error_exit (err=35, * msg=0x5555559f8c90 <__func__.5119> "qemu_mutex_lock") * at util/qemu-thread-posix.c:48 * #3 0x0000555555969b82 in qemu_mutex_lock (mutex=0x5555562c4d60) * at util/qemu-thread-posix.c:79 * #4 0x0000555555714771 in qemu_chr_fe_write (s=0x5555562c4d60, * buf=0x7fffffffd2a0 "", len=12) at qemu-char.c:219 * #5 0x000055555586be49 in ccid_card_vscard_send_msg (s=0x5555565c5f80, * type=VSC_Error, reader_id=0, payload=0x7fffffffd2e0 "", length=4) * at hw/usb/ccid-card-passthru.c:75 * #6 0x000055555586bf00 in ccid_card_vscard_send_error (s=0x5555565c5f80, * reader_id=0, code=VSC_GENERAL_ERROR) at * hw/usb/ccid-card-passthru.c:91 * #7 0x000055555586c559 in ccid_card_vscard_handle_message ( * card=0x5555565c5f80, scr_msg_header=0x5555565c6008) * at hw/usb/ccid-card-passthru.c:254 * #8 0x000055555586c72f in ccid_card_vscard_read (opaque=0x5555565c5f80, * buf=0x5555565034b0 "", size=12) at hw/usb/ccid-card-passthru.c:289 * #9 0x00005555557149db in qemu_chr_be_write (s=0x5555562c4d60, * buf=0x5555565034b0 "", len=12) at qemu-char.c:305 * #10 0x000055555571cde5 in vmc_write (sin=0x5555562c4e78, * buf=0x5555565034b0 "", len=12) at spice-qemu-char.c:41 * #11 0x00007ffff4fa86aa in spice_char_device_write_to_device ( * dev=0x55555657f210) at char_device.c:462 * #12 0x00007ffff4fa9b48 in spice_char_device_wakeup (dev=0x55555657f210) * at char_device.c:862 * #13 0x00007ffff4ff7658 in spice_server_char_device_wakeup * (sin=0x5555562c4e78) at reds.c:2955 * #14 0x000055555571d1d2 in spice_chr_write (chr=0x5555562c4d60, * buf=0x7fffffffd560 "", len=12) at spice-qemu-char.c:189 * #15 0x0000555555714789 in qemu_chr_fe_write (s=0x5555562c4d60, * buf=0x7fffffffd560 "", len=12) at qemu-char.c:220 * #16 0x000055555586be49 in ccid_card_vscard_send_msg (s=0x5555565c5f80, * type=VSC_Error, reader_id=0, payload=0x7fffffffd5a0 "", length=4) * at hw/usb/ccid-card-passthru.c:75 * #17 0x000055555586bf00 in ccid_card_vscard_send_error * (s=0x5555565c5f80, * reader_id=0, code=VSC_SUCCESS) at hw/usb/ccid-card-passthru.c:91 * #18 0x000055555586c4fc in ccid_card_vscard_handle_message ( * card=0x5555565c5f80, scr_msg_header=0x5555565c6008) * at hw/usb/ccid-card-passthru.c:242 * #19 0x000055555586c72f in ccid_card_vscard_read (opaque=0x5555565c5f80, * buf=0x5555565034b0 "", size=12) at hw/usb/ccid-card-passthru.c:289 * #20 0x00005555557149db in qemu_chr_be_write (s=0x5555562c4d60, * buf=0x5555565034b0 "", len=12) at qemu-char.c:305 * #21 0x000055555571cde5 in vmc_write (sin=0x5555562c4e78, * buf=0x5555565034b0 "", len=12) at spice-qemu-char.c:41 * #22 0x00007ffff4fa86aa in spice_char_device_write_to_device ( * dev=0x55555657f210) at char_device.c:462 * #23 0x00007ffff4fa8d37 in spice_char_device_write_buffer_add ( * dev=0x55555657f210, write_buf=0x555556501f70) at char_device.c:597 * #24 0x00007ffff501142d in smartcard_channel_write_to_reader ( * write_buf=0x555556501f70) at smartcard.c:669 * #25 0x00007ffff501034c in smartcard_char_device_notify_reader_add ( * st=0x55555657ef00) at smartcard.c:335 * #26 0x00007ffff50112b3 in smartcard_add_reader (scc=0x555556493ee0, * name=0x5555565023cc "E-Gate 0 0") at smartcard.c:642 * #27 0x00007ffff50118d2 in smartcard_channel_handle_message ( * rcc=0x555556493ee0, type=101, size=22, msg=0x5555565023c0 "\003") * at smartcard.c:757 * #28 0x00007ffff4fbc168 in red_peer_handle_incoming * (stream=0x555556588250, handler=0x555556497ff0) at red_channel.c:308 * #29 0x00007ffff4fbc231 in red_channel_client_receive * (rcc=0x555556493ee0) at red_channel.c:326 * #30 0x00007ffff4fc0019 in red_channel_client_event (fd=59, event=1, * data=0x555556493ee0) at red_channel.c:1574 * #31 0x00005555558b6076 in watch_read (opaque=0x5555565002f0) * at ui/spice-core.c:101 * #32 0x00005555558e8d48 in qemu_iohandler_poll (pollfds=0x5555562b7630, * ret=2) at iohandler.c:143 * #33 0x00005555558e89a4 in main_loop_wait (nonblocking=0) at * main-loop.c:495 * #34 0x00005555557219b0 in main_loop () at vl.c:1794 * #35 0x0000555555729257 in main (argc=40, argv=0x7fffffffddc8, * envp=0x7fffffffdf10) at vl.c:4350
* LZ4: Send the original format with the compressed dataJavier Celaya2015-02-033-6/+7
|
* LZ4: Do not reverse bottom-up imagesJavier Celaya2015-02-033-24/+14
| | | | | | Reversing the bottom-up images in the server is not needed since Pixman, in the client, is able to deal with them. As a result, the previous code was more complex and wrong. This commit fixes and cleans it.
* LZ4: Fix encoder output sizeJavier Celaya2015-02-031-1/+2
|
* LZ4: Limit LZ4 to RGB formatsJavier Celaya2015-02-031-0/+2
| | | | | | | Currently, the LZ4 encoding only (partially) supports RGB images, so we must check the image format before using it. In the future, indexed formats may be implemented too, but their use is usually very small compared to RGB.
* Remove spice-experimentalMarc-André Lureau2015-01-154-61/+0
| | | | | Remove unneded symbols that nobody should be using anyway. ABI is modified with this patch, but the library version is not bumped.
* Do not perform network tests on UNIX socketMarc-André Lureau2015-01-152-2/+4
| | | | | By default, stream latency is 0 and bandwidth is infinite. On UNIX socket do not perform unnecessary testing and keep those values.
* reds-stream: add reds_stream_get_family() functionMarc-André Lureau2015-01-152-0/+11
|
* reds: add Unix socket supportMarc-André Lureau2015-01-152-6/+33
| | | | | Learn to listen on a Unix address. In this case, the connection is plain only (non-tls).
* inputs: Remove unneeded variableChristophe Fergeau2014-12-151-9/+8
| | | | | | | | inputs_channel_handle_parsed() is casting its void * argument to a uint8_t * buf before recasting this 'buf' variable to different other types. This intermediate 'buf' variable is not needed, especially as we can then benefit from implicit casts from void * to the type we need.
* inputs: Split overlong lineChristophe Fergeau2014-12-151-1/+2
| | | | Cosmetic change.
* inputs: Fix key_up/key_down mismatchChristophe Fergeau2014-12-151-5/+5
| | | | | | When handling a KEY_UP message, the various variables were called 'key_down', and they were called 'key_up' when handling KEY_DOWN messages. This commit makes the naming consistent.
* Remove unused SPICE_CANVAS_INTERNALChristophe Fergeau2014-12-034-8/+0
|
* Add LZ4 compression support.Javier Celaya2014-12-025-6/+343
| | | | | | | | - Add lz4 encoder to compress an image of type LZ4 (see spice_common). - Add code in red_worker to use LZ4 when it is enabled, and the client supports it through its display capability, or fallback to LZ. - Add enable_lz4 switch in the configure script. Show LZ4 support at the end.
* build-sys: fix out-of-tree build of testsMarc-André Lureau2014-11-291-0/+1
| | | | | | | | | | | | Fixes the following build error: In file included from /home/elmarco/src/spice-new/src/spice/server/tests/test_display_base.h:4:0, from /home/elmarco/src/spice-new/src/spice/server/tests/test_display_no_ssl.c:11: /home/elmarco/src/spice-new/src/spice/server/spice.h:23:27: fatal error: spice-version.h: No such file or directory #include "spice-version.h" ^
* Add explicit spice-core.h includeMarc-André Lureau2014-11-271-1/+1
| | | | Several functions use core interfaces, add and explicit include.
* Move spice_server_get_num_clients() declarationMarc-André Lureau2014-11-272-3/+2
| | | | This function is not related to migration.
* Rename mm_timer/mm_timeMarc-André Lureau2014-11-274-13/+13
| | | | As suggested by Christophe on the mailing list.
* Remove guest side video time-stampingMarc-André Lureau2014-11-276-26/+2
| | | | | | | | | | | | | | | | | The multimedia time is defined by the server side monotonic time [1], but the drawing time-stamp is done in guest side, so it requires synchronization between host and guest. This is expensive, when no audio is playing, there is a ~30x/sec wakeup to update the qxl device mmtime, and it requires marking dirty the rom region. Instead, the video timestamping can be done more efficiently on server side, without visible drawbacks. [1] a better timestamp could be the audio time, since audio players are usually sync with audio time) Related to: https://bugzilla.redhat.com/show_bug.cgi?id=912763
* build-sys: generate spice-version.hMarc-André Lureau2014-11-271-1/+1
| | | | | | | Editing the hexadecimal value of spice-version and keeping it in sync with actual release is a bit tedious. Let's generate it automatically (although handling of bumps will need temporarily static versions, when 0.12 -> 1.0 for example)
* Split spice.hMarc-André Lureau2014-11-2710-574/+806
| | | | Make it easier to read the Spice server API.
* spice.h: remove redundant declarationsMarc-André Lureau2014-11-271-5/+1
| | | | Those are already declared in <spice/qxl_dev.h>.
* Validate RedDrawable before allocating drawableMarc-André Lureau2014-11-251-11/+12
| | | | | | | Avoid unnecessary allocation (and possibly leaking) if the RedDrawable is not valid. Related to: rhbz#1135372
* chardev: remove write pollingMarc-André Lureau2014-11-252-11/+34
| | | | | | | | | | | | In an effort to reduce the wakeups per second, get rid of the "write_to_dev" timer when the implementation supports SPICE_CHAR_DEVICE_NOTIFY_WRITABLE. When this flag is set, the frontend instance is responsible for calling spice_char_device_wakeup() when the device is ready to perform IO. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=912763
* Don't set SpiceLinkReply::pub_key if client advertises SASL capChristophe Fergeau2014-11-241-23/+38
| | | | | | | | | | | | | | | | | If the client advertises the SASL cap, it means it guarantees it will be able to use SASL if the server supports, and that it does not need a valid SpiceLinkReply::pub_key field when using SASL. When the client cap is set, we thus don't need to create a RSA public key if SASL is enabled server side. The reason for needing client guarantees about not looking at the pub_key field is that its presence and size is hardcoded in the protocol, but in some hardened setups (using fips mode), generating a RSA 1024 bit key as expected is forbidden and fails. With this new capability, the server knows the client will be able to handle SASL if needed, and can skip the generation of the key altogether. This means that on the setups described above, SASL authentication has to be used.
* Introduce red_link_info_test_capability()Christophe Fergeau2014-11-241-3/+18
| | | | | This just hides a bit of pointer arithmetic away from reds_send_link_ack. This helper will be used in the next commits.
* Add const to test_capability first argumentChristophe Fergeau2014-11-242-2/+2
| | | | We don't modify the capabilities content, so it can be marked as const.
* server: fix crash when restarting VM with old clientMarc-André Lureau2014-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The server will reset the vdagent char device when the client does not implement SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS. This will nullify dev->sin and the following crash will be reached on restart: #0 0x00007fb05aa264a1 in spice_char_device_write_to_device (dev=dev@entry=0x7fb066ae5d30) at char_device.c:443 #1 0x00007fb05aa27137 in spice_char_device_write_to_device (dev=0x7fb066ae5d30) at char_device.c:436 #2 spice_char_device_start (dev=0x7fb066ae5d30) at char_device.c:798 #3 0x00007fb05aa6a981 in spice_server_vm_start (s=<optimized out>) at reds.c:3795 #4 0x00007fb0644b7f89 in qdev_reset_one (dev=<optimized out>, opaque=<optimized out>) at hw/core/qdev.c:241 #5 0x00007fb0644b7918 in qbus_walk_children (bus=0x7fb06661e870, pre_devfn=0x0, pre_busfn=0x0, post_devfn=0x7fb0644b7f80 <qdev_reset_one>, post_busfn=0x7fb0644b6350 <qbus_reset_one>, opaque=0x0) at hw/core/qdev.c:422 #6 0x00007fb0644b7848 in qdev_walk_children (dev=0x7fb0665f47a0, pre_devfn=0x0, pre_busfn=0x0, post_devfn=0x7fb0644b7f80 <qdev_reset_one>, post_busfn=0x7fb0644b6350 <qbus_reset_one>, opaque=0x0) at hw/core/qdev.c:456 #7 0x00007fb0644b7918 in qbus_walk_children (bus=0x7fb06647cde0, pre_devfn=0x0, pre_busfn=0x0, post_devfn=0x7fb0644b7f80 <qdev_reset_one>, post_busfn=0x7fb0644b6350 <qbus_reset_one>, opaque=0x0) at hw/core/qdev.c:422 #8 0x00007fb0644399fd in qemu_devices_reset () at vl.c:1830 After restart, qemu will reset the device instance (sin) when virtio port is opened: #0 spice_char_device_state_reset_dev_instance (state=0x7fe4873876d0, sin=sin@entry=0x7fe486fb0c68) at char_device.c:667 #1 0x00007fe47b277516 in attach_to_red_agent (sin=0x7fe486fb0c68) at reds.c:2838 #2 spice_server_char_device_add_interface (sin=0x7fe486fb0c68, s=0x7fe486fb2e60) at reds.c:2962 #3 spice_server_add_interface (s=0x7fe486fb2e60, sin=0x7fe486fb0c68) at reds.c:3104 #4 0x00007fe484c69e57 in vmc_register_interface (scd=0x7fe486fb0c60) at spice-qemu-char.c:123 #5 0x00007fe484ce96b4 in set_guest_connected (port=<optimized out>, guest_connected=1) at hw/char/virtio-console.c:89 #6 0x00007fe484ba70ed in handle_control_message (len=8, buf=0x7fe486fbdf70, vser=0x7fe48739ae98) at /usr/src/debug/qemu-2.1.0/hw/char/virtio-serial-bus.c:382 Let's ignore the call to spice_char_device_{write,read}_to_device() when dev->sin is NULL, similary to other conditions, such as dev->running. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1145919
* migration: Don't assert() if MIGRATE_DATA comes before attaching the agentUri Lublin2014-10-141-11/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During seamless migration, after switching host, if a client was connected during the migration, it will have data to send back to the new qemu/spice-server instance. This is handled through MIGRATE_DATA messages. SPICE char devices use such MIGRATE_DATA messages to restore their state. However, the MIGRATE_DATA message can arrive any time after the new qemu instance has started, this can happen before or after the SPICE char devices have been created. In order to handle this, if the migrate data arrives early, it's stored in reds->agent_state.mig_data, and attach_to_red_agent() will restore the agent state as appropriate. Unfortunately this does not work as expected, for main channel (agent messages). If attach_to_red_agent() is called before the MIGRATE_DATA message reaches the server, all goes well, but if MIGRATE_DATA reaches the server before attach_to_red_agent() gets called, then some assert() gets triggered in spice_char_device_state_restore(): ((null):32507): Spice-ERROR **: char_device.c:937:spice_char_device_state_restore: assertion `dev->num_clients == 1 && dev->wait_for_migrate_data' failed Thread 3 (Thread 0x7f406b543700 (LWP 32543)): Thread 2 (Thread 0x7f40697ff700 (LWP 32586)): Thread 1 (Thread 0x7f4079b45a40 (LWP 32507)): When restoring state, a client must already be added to the spice-char-device. What happens is that a client is not being added to the char-device when when MIGRATE_DATA arrives first, which leaves both dev->num_clients and dev->wait_for_migrate_data value at 0. This commit changes the logic in spice_server_char_device_add_interface(), such that if there is migrate data pending in reds->agent_state.mig_data but no client was added to the spice-char-device yet, then first the client is added to the device by calling spice_char_device_client_add(), and only then the state is restored. === How to Reproduce To reproduce, add delays to the migration connection between qmeu-kvm on the source host (SRC) and on the destination (DST). Specifically I added a man in the middle DLY host between migration ports from SRC to DST. +-----+ +-----+ +-----+ | SRC |--> | DLY | --> | DST | +-----+ +-----+ +-----+ DLY listens on port P1 (e.g. 4444) and DST listens on port PINCOMING (e.g. 4444, from qemu-kvm '-incoming' command line option) Precondition: make sure port P1 on DLY is accessible in iptables. Option 1: use ssh tcp port forwarding On DLY host run ssh: ssh DLY:P1:DST:PINCOMING DST Then use the following migration command (on qemu-kvm monitor): client_migrate_info spice DST PSPICE migrate -d tcp:DLY:P1 Option 2: Use a simple proxy program that forwards packets from SRC to DST while adding some delays. The program runs on DLY, listens to port D1, upon accept connects to DST:PINCOMING and forward all packets from DLY:D1 to DST:PINCOMING. Then use the same migrate command as in option 1: client_migrate_info spice DST PSPICE migrate -d tcp:DLY:P1 === How to Reproduce Ends This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1035184 Based-on-a-patch-by: Christophe Fergeau <cfergeau@redhat.com>
* Validate surface bounding box before using itChristophe Fergeau2014-09-181-0/+31
| | | | | | | | | It's possible for a buggy guest driver to pass invalid bounding box dimensions in QXL commands, which would then cause spice-server to segfault. This patch checks the size of the bounding box of the QXL command right after it has been parsed. This fixes rhbz#1135372
* Fix 'abberiviations' typo in commentChristophe Fergeau2014-09-181-1/+1
|
* Fix indentation in red_get_opaque_ptrChristophe Fergeau2014-09-181-1/+1
| | | | This removes one extra space
* server/tests/Makefile.am: White-space cleanupChristophe Fergeau2014-09-181-12/+12
| | | | Make sure the \ at the end of lines are nicely aligned
* Fix -Wunused-functionFabiano Fidêncio2014-09-122-73/+0
|
* Fix -Wmissing-field-initializersFabiano Fidêncio2014-09-125-37/+31
|
* Fix -WnonnullFabiano Fidêncio2014-09-121-1/+2
|
* Fix -WformatFabiano Fidêncio2014-09-121-1/+1
|
* Fix -WswitchFabiano Fidêncio2014-09-121-0/+2
|
* Fix -WsignFabiano Fidêncio2014-09-122-3/+3
|
* Fix -Wunused-valueFabiano Fidêncio2014-09-121-1/+1
|
* Fix -Wunused-parameterFabiano Fidêncio2014-09-127-31/+58
|
* server: Don't dump the bitmap when the format is invalidFabiano Fidêncio2014-09-121-0/+1
| | | | | | Caught by covscan: spice/server/spice_bitmap_utils.c:54: var_decl: Declaring variable "n_pixel_bits" without initializer. spice/server/spice_bitmap_utils.c:106: uninit_use: Using uninitialized value "n_pixel_bits".
* clean-up: remove unused functionMarc-André Lureau2014-09-082-6/+0
|
* build-sys: check for spicy-screenshotMarc-André Lureau2014-09-081-3/+3
|
* reds: lookup corresponding channel idMarc-André Lureau2014-09-081-1/+2
| | | | | | | | | | In reds_send_link_ack(), lookup the channel with the same id as the link message. The bug was found during code review a while ago. A reproducer bug was later reported: https://bugzilla.redhat.com/show_bug.cgi?id=1058625