[roll] Roll fuchsia [zircon] Acquire dispatcher references under lock in port_cancel_key

The PortDispatcher::CancelKey operation removes observers from the
port dispatcher's list of observers and unregisters the observers from
the dispatcher associated with each observer. Registered observers do
not hold references on the dispatcher instances that they point to.
Instead, dispatchers are cleared from the observer list on the
dispatcher and the port dispatcher under their respective locks. The
dispatcher pointer in the registered observer list acts as a weak
pointer guarded by the port dispatcher lock. The invariant is that
the port dispatcher lock guards the validity of all dispatcher pointers
in registered observers.

The dispatcher lock is held while the port dispatcher lock is acquired
in some codepaths and so deregistration has to match this lock ordering.
This causes an issue in the CancelKey codepath which first identifies
observers to cancel while holding the port dispatcher lock and then
iterates over the list to deregister the observers from their
dispatcher. This loop has to drop and then re-acquire the port
dispatcher lock in order to call into the dispatcher. If there are
multiple canceled observers, on the second iteration and beyond the
dispatcher references in the local canceled observer list may be
invalid. In other words, another thread may have acquired the port
dispatcher lock and canceled all registered observers referring to a
particular dispatcher.

To ensure that all dispatcher references in the canceled observer list
are valid throughout the operation this upgrades each weak pointer to a
strong reference by manually incrementing the reference count on each
dispatcher while holding the port dispatcher lock and moving observers
to a local list for further processing.

Original-Fixed: 504783349
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1594305
Original-Revision: 413924514ad93118c433dfaabf921cf5ec2a656e
GitOrigin-RevId: ffe33d9f8691f413af4ebe8a727652b6baac3d8b
Change-Id: I8c87a4c6afe1ac7507306e1cf8cdb5daf59639be
1 file changed
tree: f7c701e218407e96b37dd9773ce24d05b83d6de5
  1. ctf/
  2. git-hooks/
  3. infra/
  4. third_party/
  5. cobalt
  6. flower
  7. jiri.lock
  8. MILESTONE
  9. minimal
  10. prebuilts
  11. README.md
  12. stem
  13. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.