• Robert Sesek's avatar
    Fix a Mach port dead-name leak in mojo::core::ChannelMac. · 4bb9235b
    Robert Sesek authored
    If a channel sends a message to what turns out to be a dead-name port,
    before the channel processes the kernel's dead-name notification, the
    channel would leak the dead-name right. This is because the dead-name
    notification message contains a port right that must be destroyed, and
    that right is not transferred as a normal message descriptor. Therefore,
    the right is not automatically released when the message remains in the
    kernel message queue and the associated receive right is destroyed.
    
    To fix this, if a channel fails to send a message because it is to an
    invalid destination (namely, a dead-name), do not immediately report the
    error. Instead, wait for the channel to process the dead-name
    notification so that the port right can be appropriately disposed.
    
    Bug: 1041682
    Change-Id: I99ffdea096670ef1e133f62ae269292b1d7e290a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013524Reviewed-by: default avatarKen Rockot <rockot@google.com>
    Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
    Commit-Queue: Robert Sesek <rsesek@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#734670}
    4bb9235b
channel_mac.cc 26.6 KB