Bug 653779 - [RFE] VNC server ignore shared-flag during client init
Summary: [RFE] VNC server ignore shared-flag during client init
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.1
Hardware: Unspecified
OS: All
Target Milestone: beta
: 6.1
Assignee: Gerd Hoffmann
QA Contact: Virtualization Bugs
: 733676 (view as bug list)
Depends On:
Blocks: 580954
TreeView+ depends on / blocked
Reported: 2010-11-16 06:04 UTC by YangFeng
Modified: 2015-04-20 00:26 UTC (History)
11 users (show)

Fixed In Version: qemu-kvm-
Doc Type: Enhancement
Doc Text:
No Documentation Needed
Clone Of:
Last Closed: 2012-06-20 11:32:37 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0746 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2012-06-19 19:31:48 UTC

Description YangFeng 2010-11-16 06:04:03 UTC
Description of problem:
During testing, I found that VNC server ignore 'shared-flag' during client init. 

shared-flag is defined in The RFB Protocol:

6.3.1 ClientInit
 No. of bytes    Type    [Value]   Description
 1                                 shared-flag
Shared-flag is non-zero (true) if the server should try to share the desktop by leaving
other clients connected, zero (false) if it should give exclusive access to this client by
disconnecting all other clients.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Start a VM with VNC.
2. Connect to guest through VNC.
3. Start another VNC connection to guest with Shared-flag is zero.
Actual results:
Two VNC connection share the desktop.

Expected results:
The first VNC connection should be disconnected.

Additional info:

Comment 2 YangFeng 2010-11-16 06:21:29 UTC
qemu-kvm version: qemu-kvm-

Comment 3 Gerd Hoffmann 2010-11-16 14:11:24 UTC
[ cut + paste from email discussing this ]

While I agree that it can be a DOS attack, I still think it could be worth
implementing it, but only in connection with CLI args to allow admin to
control its behaviour.

Considering VirtualBox's RDP server IIUC they have the following behaviour

  - Default to only allow 1 single client connection at a time

     - If 'replaceUser' flag is set
         New clients kills existing client
     - Else
         New clients are dropped

  - If multipleUser flag is set many clients can connect concurrently

The 'shared-flag' at a protocol level is only really useful in the
multiuser scenario. It seems to be wanting a 'forceShared' CLI
flag to allow the protocol level 'shared-flag' to be ignored.

Oh, and of course 'shared-flag' would only ever be considered after
authentication has completed.


Comment 7 Gerd Hoffmann 2011-09-12 08:11:11 UTC
*** Bug 733676 has been marked as a duplicate of this bug. ***

Comment 11 Gerd Hoffmann 2011-09-12 16:13:07 UTC
spice simply can't handle multiple parallel connections (yet), thats why a new (main channel) connect disconnects any other spice client.  In the future spice will support shared sessions though, then this will change.

Management of shared sessions isn't ideal for VNC, that is what this RFE bug is about.  vnc clients can indicate whenever they want connect to a shared session, but qemu simply ignores that today.  When user (2) connects *without* the shared flag set while user (1) is still connected qemu should do one of two things:

  (a) refuse user (2) to connect.
  (b) disconnect user (1).

The plan is to implement an option for the vnc server where one can pick whenever qemu should do (a) or (b) or current behavior (for backward compatibility).

Comment 13 Gerd Hoffmann 2011-11-25 12:22:56 UTC

Comment 19 Shaolong Hu 2012-03-15 07:23:04 UTC
On qemu-kvm-,

1.boot guest with "-vnc :10,allow-exclusive"
client1 connects w/o -shared && client2 connects w -shared --> client2 fails
client1 and clinet2 connect both w -shared --> share correctly
client1 connects w -shared && client2 connects w/o -shared --> client1 closes

I think this is correct.

2.boot guest with "-vnc :10,force-shared"

client1 and clinet2 connect both w -shared --> share correctly
client1 connects w -shared && client2 connects w/o -shared --> client1 closes
client1 connects w/o -shared --> connect correctly

This is incorrect?

3.ignore is the same with force-shared

Comment 20 Gerd Hoffmann 2012-03-16 07:06:34 UTC
Syntax is "-vnc :10,share=force-shared".

Comment 21 Shaolong Hu 2012-03-16 09:25:52 UTC
Ok, it works well :/

1.-vnc :10,share=allow-exclusive

  shared connection requires all client with "-shared", a single client without "-shared" will break all other connection.

2.-vnc :10,share=force-shared

  connection without "-shared" fails, with "-shared" connection shares correctly.

3.-vnc :10,share=ignore

  the same behaviour before the patch.


Comment 23 Michal Novotny 2012-05-03 17:03:41 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    New Contents:
No Documentation Needed

Comment 24 errata-xmlrpc 2012-06-20 11:32:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.