Upgrade rust/crates/mio to 0.7.13

Test: make
Change-Id: Idd45070bd86fe18e99bcd9e18f93920923cdf70a
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index d513c37..a4887c5 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "772c692150c711d7bdd72b5c6287072b8914e519"
+    "sha1": "75f41fb304d299dfbc07679d15193e03273c4597"
   }
 }
diff --git a/Android.bp b/Android.bp
index f8e17c2..7d3746f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -46,5 +46,5 @@
 
 // dependent_library ["feature_list"]
 //   cfg-if-1.0.0
-//   libc-0.2.94 "default,std"
+//   libc-0.2.97 "default,std"
 //   log-0.4.14 "std"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 72cb770..4e12fc3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+# 0.7.13
+
+## Fixes
+
+* Fix `Registry::try_clone` invalid usage of `F_DUPFD_CLOEXEC` (#1497,
+  https://github.com/tokio-rs/mio/commit/2883f5c1f35bf1a59682c5ffc4afe6b97d7d6e68).
+
+# 0.7.12 (yanked)
+
+## Fixes
+
+* Set `FD_CLOEXEC` when calling `Registry::try_clone`
+  (https://github.com/tokio-rs/mio/commit/d1617b567ff6bc669d71e367d22e0e93ff7e2e24 for epoll and
+  (https://github.com/tokio-rs/mio/commit/b367a05e408ca90a26383c3aa16d8a16f019dc59 for kqueue).
+
 # 0.7.11
 
 ## Fixes
diff --git a/Cargo.lock b/Cargo.lock
index c91bfb8..8a0bb77 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -40,7 +40,7 @@
 
 [[package]]
 name = "mio"
-version = "0.7.11"
+version = "0.7.13"
 dependencies = [
  "env_logger",
  "libc",
diff --git a/Cargo.toml b/Cargo.toml
index 62090ff..3a103b3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,12 +13,12 @@
 [package]
 edition = "2018"
 name = "mio"
-version = "0.7.11"
+version = "0.7.13"
 authors = ["Carl Lerche <me@carllerche.com>", "Thomas de Zeeuw <thomasdezeeuw@gmail.com>", "Tokio Contributors <team@tokio.rs>"]
 include = ["Cargo.toml", "LICENSE", "README.md", "CHANGELOG.md", "src/**/*.rs", "examples/**/*.rs"]
 description = "Lightweight non-blocking IO"
 homepage = "https://github.com/tokio-rs/mio"
-documentation = "https://docs.rs/mio/0.7.7"
+documentation = "https://docs.rs/mio/0.7.13"
 readme = "README.md"
 keywords = ["io", "async", "non-blocking"]
 categories = ["asynchronous"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index a14d17d..aa2e677 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -6,7 +6,7 @@
 # - Update CHANGELOG.md.
 # - Update doc URL.
 # - Create git tag
-version       = "0.7.11"
+version       = "0.7.13"
 license       = "MIT"
 authors       = [
   "Carl Lerche <me@carllerche.com>",
@@ -14,7 +14,7 @@
   "Tokio Contributors <team@tokio.rs>",
 ]
 description   = "Lightweight non-blocking IO"
-documentation = "https://docs.rs/mio/0.7.7"
+documentation = "https://docs.rs/mio/0.7.13"
 homepage      = "https://github.com/tokio-rs/mio"
 repository    = "https://github.com/tokio-rs/mio"
 readme        = "README.md"
diff --git a/METADATA b/METADATA
index eb89225..79077c2 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/mio/mio-0.7.11.crate"
+    value: "https://static.crates.io/crates/mio/mio-0.7.13.crate"
   }
-  version: "0.7.11"
+  version: "0.7.13"
   license_type: NOTICE
   last_upgrade_date {
     year: 2021
-    month: 4
-    day: 1
+    month: 6
+    day: 21
   }
 }
diff --git a/TEST_MAPPING b/TEST_MAPPING
index fadb544..ba26f45 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,7 +2,16 @@
 {
   "presubmit": [
     {
-      "name": "tokio-test_device_test_tests_macros"
+      "name": "doh_unit_test"
+    },
+    {
+      "name": "futures-util_device_test_src_lib"
+    },
+    {
+      "name": "quiche_device_test_src_lib"
+    },
+    {
+      "name": "tokio-test_device_test_src_lib"
     },
     {
       "name": "tokio-test_device_test_tests_block_on"
@@ -11,13 +20,202 @@
       "name": "tokio-test_device_test_tests_io"
     },
     {
-      "name": "futures-util_device_test_src_lib"
+      "name": "tokio-test_device_test_tests_macros"
     },
     {
-      "name": "tokio-test_device_test_src_lib"
+      "name": "tokio_device_test_tests__require_full"
     },
     {
-      "name": "quiche_device_test_src_lib"
+      "name": "tokio_device_test_tests_buffered"
+    },
+    {
+      "name": "tokio_device_test_tests_io_async_fd"
+    },
+    {
+      "name": "tokio_device_test_tests_io_async_read"
+    },
+    {
+      "name": "tokio_device_test_tests_io_chain"
+    },
+    {
+      "name": "tokio_device_test_tests_io_copy"
+    },
+    {
+      "name": "tokio_device_test_tests_io_copy_bidirectional"
+    },
+    {
+      "name": "tokio_device_test_tests_io_driver"
+    },
+    {
+      "name": "tokio_device_test_tests_io_driver_drop"
+    },
+    {
+      "name": "tokio_device_test_tests_io_lines"
+    },
+    {
+      "name": "tokio_device_test_tests_io_mem_stream"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_buf"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_exact"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_line"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_to_end"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_to_string"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_until"
+    },
+    {
+      "name": "tokio_device_test_tests_io_split"
+    },
+    {
+      "name": "tokio_device_test_tests_io_take"
+    },
+    {
+      "name": "tokio_device_test_tests_io_write"
+    },
+    {
+      "name": "tokio_device_test_tests_io_write_all"
+    },
+    {
+      "name": "tokio_device_test_tests_io_write_buf"
+    },
+    {
+      "name": "tokio_device_test_tests_io_write_int"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_join"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_pin"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_select"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_test"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_try_join"
+    },
+    {
+      "name": "tokio_device_test_tests_net_bind_resource"
+    },
+    {
+      "name": "tokio_device_test_tests_net_lookup_host"
+    },
+    {
+      "name": "tokio_device_test_tests_no_rt"
+    },
+    {
+      "name": "tokio_device_test_tests_process_kill_on_drop"
+    },
+    {
+      "name": "tokio_device_test_tests_rt_basic"
+    },
+    {
+      "name": "tokio_device_test_tests_rt_common"
+    },
+    {
+      "name": "tokio_device_test_tests_rt_threaded"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_barrier"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_broadcast"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_errors"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_mpsc"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_mutex"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_mutex_owned"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_notify"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_oneshot"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_rwlock"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_semaphore"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_semaphore_owned"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_watch"
+    },
+    {
+      "name": "tokio_device_test_tests_task_abort"
+    },
+    {
+      "name": "tokio_device_test_tests_task_blocking"
+    },
+    {
+      "name": "tokio_device_test_tests_task_local"
+    },
+    {
+      "name": "tokio_device_test_tests_task_local_set"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_accept"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_connect"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_echo"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_into_split"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_into_std"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_peek"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_shutdown"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_socket"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_split"
+    },
+    {
+      "name": "tokio_device_test_tests_time_rt"
+    },
+    {
+      "name": "tokio_device_test_tests_udp"
+    },
+    {
+      "name": "tokio_device_test_tests_uds_cred"
+    },
+    {
+      "name": "tokio_device_test_tests_uds_split"
     }
   ]
 }
diff --git a/src/lib.rs b/src/lib.rs
index ad417c2..165a340 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-#![doc(html_root_url = "https://docs.rs/mio/0.7.11")]
+#![doc(html_root_url = "https://docs.rs/mio/0.7.13")]
 #![deny(
     missing_docs,
     missing_debug_implementations,
diff --git a/src/sys/unix/selector/epoll.rs b/src/sys/unix/selector/epoll.rs
index 76ee7f9..38667d6 100644
--- a/src/sys/unix/selector/epoll.rs
+++ b/src/sys/unix/selector/epoll.rs
@@ -41,7 +41,7 @@
     }
 
     pub fn try_clone(&self) -> io::Result<Selector> {
-        syscall!(dup(self.ep)).map(|ep| Selector {
+        syscall!(fcntl(self.ep, libc::F_DUPFD_CLOEXEC, super::LOWEST_FD)).map(|ep| Selector {
             // It's the same selector, so we use the same id.
             #[cfg(debug_assertions)]
             id: self.id,
diff --git a/src/sys/unix/selector/kqueue.rs b/src/sys/unix/selector/kqueue.rs
index 34f5340..b36a537 100644
--- a/src/sys/unix/selector/kqueue.rs
+++ b/src/sys/unix/selector/kqueue.rs
@@ -87,7 +87,7 @@
     }
 
     pub fn try_clone(&self) -> io::Result<Selector> {
-        syscall!(dup(self.kq)).map(|kq| Selector {
+        syscall!(fcntl(self.kq, libc::F_DUPFD_CLOEXEC, super::LOWEST_FD)).map(|kq| Selector {
             // It's the same selector, so we use the same id.
             #[cfg(debug_assertions)]
             id: self.id,
diff --git a/src/sys/unix/selector/mod.rs b/src/sys/unix/selector/mod.rs
index 7525898..b73d645 100644
--- a/src/sys/unix/selector/mod.rs
+++ b/src/sys/unix/selector/mod.rs
@@ -33,3 +33,13 @@
     target_os = "openbsd"
 ))]
 pub(crate) use self::kqueue::{event, Event, Events, Selector};
+
+/// Lowest file descriptor used in `Selector::try_clone`.
+///
+/// # Notes
+///
+/// Usually fds 0, 1 and 2 are standard in, out and error. Some application
+/// blindly assume this to be true, which means using any one of those a select
+/// could result in some interesting and unexpected errors. Avoid that by using
+/// an fd that doesn't have a pre-determined usage.
+const LOWEST_FD: libc::c_int = 3;