Bug 1893

Summary: [PATCH] ICE doesn't deal with replies robustly
Product: xorg Reporter: Daniel Stone <daniel>
Component: Lib/ICEAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
patch and stuff none

Description Daniel Stone 2004-11-22 10:27:08 UTC
This one's sort of difficult to explain, so I'll just quote the patch:
  When two hosts communicate over an ICE connection and use
  different major opcodes for a subprotocol, it is impossible
  to use message replies.

  Let HOST-A and HOST-B be two hosts which communicate over an
  ICE connection and use a subprotocol PROT.  Both have
  obtained an opcode for PROT, HOST-A got the opcode 1 from
  `IceRegisterForProtocolSetup' and HOST-B got the opcode 2
  from `IceRegisterForProtocolReply' (he uses several
  protocols simultaneously, so the value is not 1).

  Now HOST-A sents a message wich requires a reply.  In order
  to do so he sets up an `IceReplyWaitInfo' and calls
  `IceProcessMessages':

      IceReplyWaitInfo  reply_info;
      Bool  reply_ready;

      reply_info.sequence_of_request = IceLastSentSequenceNumber (ice_conn);
      reply_info.major_opcode_of_request = opcode;
      reply_info.minor_opcode_of_request = PROT_Question; 
      reply_info.reply = reply;

      do { 
          IceProcessMessagesStatus  process_status;

          process_status = IceProcessMessages (ice_conn,
                                               &reply_info, &reply_ready);
          ... 
      } while (! reply_ready);

  The `reply_info.major_opcode_of_request' field contains the
  value 1, now.

  Next, HOST-B's reply arrives while HOST-A is executing the
  function `IceProcessMessages'.  Within this function, the
  `reply_wait' is registered via the command

      _IceAddReplyWait (iceConn, replyWait);

  This makes ICE wait for something with major opcode 1.  But
  the variable `header' has `header->majorOpcode == 2',
  because HOST-B sent it this way.  So the following call

          useThisReplyWait = _IceSearchReplyWaits (iceConn, header->majorOpcode);

  (also from `IceProcessMessages') does not find my
  `reply_wait' because ICE searchs for the major opcode 2, not
  1!  I think this is a bug in the ICE library.
Comment 1 Daniel Stone 2004-11-22 10:27:33 UTC
Created attachment 1334 [details] [review]
patch and stuff
Comment 2 Daniel Stone 2004-11-23 11:01:06 UTC
Comment on attachment 1334 [details] [review]
patch and stuff

make roland less angry
Comment 3 Adam Jackson 2005-10-23 13:12:30 UTC
applied to head, thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.