Taylor Brandstetter
7b69a44c8b
Fix ABA problem when iterating epoll events.
...
Original patch contributed by andrey.semashev@gmail.com .
In PhysicalSocketServer::WaitEpoll(), the loop verifies that the
signalled dispatcher is in dispatchers_ set. It does so by looking up
the dispatcher pointer in the set. This is vulnerable to the ABA
problem because one dispatcher may be removed and destroyed and another
created and added with the same address before epoll reports an event
for the old dispatcher. The same issue exists for other Wait
implementations, if a dispatcher is removed and a new one added with
the same socket handle is the old.
This is avoided by using a 64-bit key for looking up the dispatcher
in the set. The key is set from a running counter which gets incremented
when a dispatcher is added to the set, so even if the same dispatcher
pointer is added, removed and added again, the key value will be
different.
This changes the storage of dispatchers_ from a set to a flat_hash_map,
which uses a bit more memory but has faster lookup (O(1) as opposed to
O(log n)).
Bug: webrtc:11124
Change-Id: I6d206e1a367b58ba971edca9b48af7664384b797
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181027
Commit-Queue: Taylor <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32019}
2020-08-31 20:26:37 +00:00
..
2020-07-17 09:19:50 +00:00
2020-08-10 10:59:17 +00:00
2019-11-27 12:52:48 +00:00
2020-07-08 20:38:54 +00:00
2020-06-08 12:59:40 +00:00
2020-02-18 16:09:50 +00:00
2020-05-26 20:27:34 +00:00
2020-07-15 10:32:20 +00:00
2020-07-16 13:52:28 +00:00
2020-06-08 12:59:40 +00:00
2020-01-21 12:13:11 +00:00
2020-01-21 12:13:11 +00:00
2020-04-02 09:54:27 +00:00
2019-07-08 13:45:15 +00:00
2018-06-19 14:00:39 +00:00
2020-07-16 13:52:28 +00:00
2020-07-08 10:46:20 +00:00
2020-07-08 10:46:20 +00:00
2020-03-02 11:36:58 +00:00
2020-01-28 19:16:18 +00:00
2019-02-20 16:02:59 +00:00
2019-10-15 09:07:44 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-02-03 21:19:57 +00:00
2020-02-03 21:19:57 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:05:20 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-11-27 19:34:54 +00:00
2019-11-27 19:34:54 +00:00
2020-07-08 11:41:20 +00:00
2020-07-08 11:41:20 +00:00
2019-07-03 13:30:01 +00:00
2020-03-02 20:55:28 +00:00
2020-03-02 20:55:28 +00:00
2020-03-02 20:55:28 +00:00
2019-01-11 17:11:39 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2020-05-26 20:27:34 +00:00
2020-05-29 11:42:06 +00:00
2020-08-31 20:26:37 +00:00
2019-11-15 11:48:42 +00:00
2019-11-15 11:48:42 +00:00
2019-11-15 11:48:42 +00:00
2019-07-08 13:45:15 +00:00
2019-03-31 11:55:09 +00:00
2019-01-11 17:11:39 +00:00
2019-01-25 20:29:58 +00:00
2019-01-25 20:29:58 +00:00
2020-05-26 20:27:34 +00:00
2019-11-28 17:51:00 +00:00
2020-06-12 14:12:54 +00:00
2018-06-19 14:00:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-26 09:48:07 +00:00
2019-09-26 09:48:07 +00:00
2019-10-15 09:07:44 +00:00
2020-01-15 13:36:58 +00:00
2019-01-11 17:11:39 +00:00
2017-09-15 05:02:56 +00:00
2018-11-28 18:25:07 +00:00
2019-05-15 23:54:07 +00:00
2018-05-21 19:35:08 +00:00
2019-05-10 07:07:19 +00:00
2019-05-10 07:07:19 +00:00
2018-11-28 18:25:07 +00:00
2018-02-28 19:58:24 +00:00
2019-10-15 09:07:44 +00:00
2018-06-19 14:00:39 +00:00
2020-06-04 09:55:12 +00:00
2018-06-19 14:00:39 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2018-06-19 14:00:39 +00:00
2018-11-28 18:25:07 +00:00
2019-04-11 16:35:18 +00:00
2019-04-11 16:35:18 +00:00
2020-02-10 12:21:17 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-03-02 10:18:01 +00:00
2019-07-08 13:45:15 +00:00
2020-04-16 14:21:41 +00:00
2020-04-16 14:21:41 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-08-08 08:29:18 +00:00
2018-06-19 14:00:39 +00:00
2018-12-17 17:33:06 +00:00
2020-02-10 12:21:17 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-10-15 09:07:44 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:05:20 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2017-09-15 05:02:56 +00:00
2019-04-24 20:57:20 +00:00
2020-03-02 11:36:58 +00:00
2020-03-02 11:36:58 +00:00
2019-01-25 20:29:58 +00:00
2019-12-03 19:43:12 +00:00
2019-12-03 19:43:12 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-01-14 14:47:48 +00:00
2020-07-16 13:52:28 +00:00
2020-07-08 16:20:17 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-10-25 12:07:32 +00:00
2019-10-25 12:07:32 +00:00
2018-11-28 18:25:07 +00:00
2019-07-08 13:45:15 +00:00
2017-09-15 05:02:56 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-01-13 13:53:20 +00:00
2019-12-02 09:47:34 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2020-01-10 19:03:12 +00:00
2020-01-10 19:03:12 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-17 15:47:29 +00:00
2020-03-02 11:36:58 +00:00
2020-03-02 11:36:58 +00:00
2020-05-26 20:07:14 +00:00
2020-05-26 20:07:14 +00:00
2020-04-02 07:48:36 +00:00
2020-04-02 07:48:36 +00:00
2020-08-13 20:50:23 +00:00
2020-08-13 20:50:23 +00:00
2020-08-01 00:36:27 +00:00
2020-08-20 21:46:18 +00:00
2020-03-24 11:48:42 +00:00
2020-03-24 11:48:42 +00:00
2020-03-30 13:02:46 +00:00
2020-08-20 21:46:18 +00:00
2020-08-20 21:46:18 +00:00
2020-08-07 10:07:43 +00:00
2020-01-08 14:12:08 +00:00
2019-07-08 13:45:15 +00:00
2020-05-06 20:19:49 +00:00
2019-01-11 17:11:39 +00:00
2020-07-08 20:38:54 +00:00
2020-05-14 19:33:26 +00:00
2020-04-14 11:00:49 +00:00
2020-04-14 11:00:49 +00:00
2019-09-17 15:47:29 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-04-16 20:56:25 +00:00
2020-04-16 20:56:25 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-08-05 21:17:26 +00:00
2020-03-21 18:53:46 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2018-04-06 01:01:48 +00:00
2020-08-25 16:11:22 +00:00
2020-08-25 09:56:39 +00:00
2020-08-25 09:56:39 +00:00
2020-02-19 14:05:46 +00:00
2020-08-31 20:26:37 +00:00
2020-08-31 20:26:37 +00:00
2020-08-31 20:26:37 +00:00
2020-05-17 17:22:01 +00:00
2019-03-04 12:42:10 +00:00
2019-05-03 08:35:42 +00:00
2019-07-08 13:45:15 +00:00
2019-05-06 07:34:09 +00:00
2019-02-16 11:11:45 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-09-17 15:47:29 +00:00
2019-03-28 13:33:30 +00:00
2019-07-08 13:45:15 +00:00
2017-09-15 05:02:56 +00:00
2018-10-23 11:32:56 +00:00
2019-07-08 13:45:15 +00:00
2017-11-22 11:21:47 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2020-01-15 13:46:38 +00:00
2020-05-25 12:14:44 +00:00
2020-05-25 12:14:44 +00:00
2020-01-15 13:46:38 +00:00
2020-01-15 13:46:38 +00:00
2020-01-15 13:46:38 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-11-26 14:05:20 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-04-15 09:30:07 +00:00
2020-03-21 18:53:46 +00:00
2019-10-15 09:07:44 +00:00
2020-03-21 18:53:46 +00:00
2020-03-21 18:53:46 +00:00
2019-10-15 09:07:44 +00:00
2018-11-28 18:25:07 +00:00
2018-11-26 19:20:27 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2020-05-28 07:52:53 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-04-09 17:18:20 +00:00
2019-01-11 17:11:39 +00:00
2019-12-10 08:32:10 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2020-01-03 18:42:32 +00:00
2019-10-15 09:07:44 +00:00
2019-01-11 17:11:39 +00:00
2020-01-10 19:03:12 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2020-08-31 20:26:37 +00:00
2020-08-31 20:26:37 +00:00
2019-07-08 13:45:15 +00:00
2020-01-07 09:54:44 +00:00
2020-05-14 19:33:26 +00:00
2019-01-11 17:11:39 +00:00
2020-04-14 11:00:49 +00:00
2019-09-17 15:47:29 +00:00
2019-10-15 09:07:44 +00:00
2019-09-17 15:47:29 +00:00
2019-10-15 09:07:44 +00:00
2020-03-21 18:53:46 +00:00
2020-04-16 14:21:41 +00:00
2020-04-16 20:56:25 +00:00
2020-04-24 20:40:45 +00:00
2020-03-21 18:53:46 +00:00
2020-03-21 18:53:46 +00:00
2020-04-16 14:21:41 +00:00
2020-01-08 14:12:08 +00:00
2020-07-16 13:52:28 +00:00
2019-07-08 13:45:15 +00:00
2019-08-29 14:16:23 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2018-10-23 11:32:56 +00:00
2019-07-30 19:35:37 +00:00
2019-02-15 01:22:54 +00:00
2019-07-30 19:35:37 +00:00
2018-06-19 14:00:39 +00:00
2017-09-15 05:02:56 +00:00
2020-05-26 20:27:34 +00:00
2019-08-20 12:18:28 +00:00
2019-03-19 18:11:52 +00:00
2020-05-04 13:47:35 +00:00
2020-03-18 16:06:09 +00:00
2019-02-20 17:08:53 +00:00
2020-07-08 20:38:54 +00:00
2019-02-12 10:58:36 +00:00
2020-07-08 20:38:54 +00:00
2019-02-21 14:36:07 +00:00
2019-03-26 14:42:49 +00:00
2020-07-08 20:38:54 +00:00
2019-02-21 09:33:42 +00:00
2019-04-10 10:27:07 +00:00
2019-09-17 15:47:29 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-17 15:47:29 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2017-11-01 13:23:26 +00:00
2019-07-08 13:45:15 +00:00
2019-04-08 16:58:07 +00:00
2020-01-20 14:07:16 +00:00
2020-07-13 13:14:34 +00:00
2020-07-17 09:19:50 +00:00
2020-08-03 11:24:17 +00:00
2020-02-10 12:21:17 +00:00
2020-07-01 17:21:02 +00:00
2020-01-28 19:16:18 +00:00
2020-03-10 17:22:54 +00:00
2020-03-10 17:22:54 +00:00
2020-03-10 17:22:54 +00:00
2019-11-28 15:58:24 +00:00
2018-06-19 14:00:39 +00:00
2019-07-08 13:45:15 +00:00
2019-02-09 00:55:14 +00:00
2019-02-09 00:55:14 +00:00
2020-07-17 09:19:50 +00:00
2020-07-17 09:19:50 +00:00
2020-01-08 14:12:08 +00:00
2019-10-15 09:17:36 +00:00
2019-04-09 12:28:04 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-10-22 16:15:56 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-05-22 10:32:25 +00:00
2018-11-28 18:25:07 +00:00
2018-03-07 22:06:20 +00:00
2019-07-08 13:45:15 +00:00