You need to sign in or sign up before continuing.
  • D
    rpc: fix race sending and encoding sasl data · 4e13fb02
    Daniel P. Berrange 提交于
    The virNetSocketWriteSASL method has to encode the buffer it is given and then
    write it to the underlying socket. This write is not guaranteed to send the
    full amount of data that was encoded by SASL. We cache the SASL encoded data so
    that on the next invocation of virNetSocketWriteSASL we carry on sending it.
    
    The subtle problem is that the 'len' value passed into virNetSocketWriteSASL on
    the 2nd call may be larger than the original value. So when we've completed
    sending the SASL encoded data we previously cached, we must return the original
    length we encoded, not the new length.
    
    This flaw means we could potentially have been discarded queued data without
    sending it. This would have exhibited itself as a libvirt client never receiving
    the reply to a method it invokes, async events silently going missing, or worse
    stream data silently getting dropped.
    
    For this to be a problem libvirtd would have to be queued data to send to the
    client, while at the same time the TCP socket send buffer is full (due to a very
    slow client). This is quite unlikely so if this bug was ever triggered by a real
    world user it would be almost impossible to reproduce or diagnose, if indeed it
    was ever noticed at all.
    Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
    Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
    4e13fb02
virnetsocket.c 62.7 KB