Repository: bytecodealliance/wasmtime
Pull request #7386 (2023-10-26 21:26:51)

Fix a possible panic in clock subscription
Change an `a - b` expression to `a.saturating_sub(b)` to handle the case when a clock is subscribed to an instance/duration in the past.

<!--
Please make sure you include the following information:

- If this work has been discussed elsewhere, please include a link to that
  conversation. If it was discussed in an issue, just mention "issue #...".

- Explain why this change is needed. If the details are in an issue already,
  this can be brief.

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->



Patch:
diff --git a/Cargo.lock b/Cargo.lock
index bc06be362..6423b5d0c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2262,9 +2262,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
 
 [[package]]
 name = "rustix"
-version = "0.38.14"
+version = "0.38.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f"
+checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
 dependencies = [
  "bitflags 2.4.1",
  "errno",
diff --git a/crates/wasi-http/wit/deps/filesystem/types.wit b/crates/wasi-http/wit/deps/filesystem/types.wit
index 81dcde908..37700332b 100644
--- a/crates/wasi-http/wit/deps/filesystem/types.wit
+++ b/crates/wasi-http/wit/deps/filesystem/types.wit
@@ -650,105 +650,6 @@ interface types {
             modes: modes,
         ) -> result<_, error-code>;
 
-        /// Request a shared advisory lock for an open file.
-        ///
-        /// This requests a *shared* lock; more than one shared lock can be held for
-        /// a file at the same time.
-        ///
-        /// If the open file has an exclusive lock, this function downgrades the lock
-        /// to a shared lock. If it has a shared lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified how shared locks interact with locks acquired by
-        /// non-WASI programs.
-        ///
-        /// This function blocks until the lock can be acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_SH)` in Unix.
-        lock-shared: func() -> result<_, error-code>;
-
-        /// Request an exclusive advisory lock for an open file.
-        ///
-        /// This requests an *exclusive* lock; no other locks may be held for the
-        /// file while an exclusive lock is held.
-        ///
-        /// If the open file has a shared lock and there are no exclusive locks held
-        /// for the file, this function upgrades the lock to an exclusive lock. If the
-        /// open file already has an exclusive lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified whether this function succeeds if the file descriptor
-        /// is not opened for writing. It is unspecified how exclusive locks interact
-        /// with locks acquired by non-WASI programs.
-        ///
-        /// This function blocks until the lock can be acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_EX)` in Unix.
-        lock-exclusive: func() -> result<_, error-code>;
-
-        /// Request a shared advisory lock for an open file.
-        ///
-        /// This requests a *shared* lock; more than one shared lock can be held for
-        /// a file at the same time.
-        ///
-        /// If the open file has an exclusive lock, this function downgrades the lock
-        /// to a shared lock. If it has a shared lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified how shared locks interact with locks acquired by
-        /// non-WASI programs.
-        ///
-        /// This function returns `error-code::would-block` if the lock cannot be
-        /// acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_SH | LOCK_NB)` in Unix.
-        try-lock-shared: func() -> result<_, error-code>;
-
-        /// Request an exclusive advisory lock for an open file.
-        ///
-        /// This requests an *exclusive* lock; no other locks may be held for the
-        /// file while an exclusive lock is held.
-        ///
-        /// If the open file has a shared lock and there are no exclusive locks held
-        /// for the file, this function upgrades the lock to an exclusive lock. If the
-        /// open file already has an exclusive lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified whether this function succeeds if the file descriptor
-        /// is not opened for writing. It is unspecified how exclusive locks interact
-        /// with locks acquired by non-WASI programs.
-        ///
-        /// This function returns `error-code::would-block` if the lock cannot be
-        /// acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_EX | LOCK_NB)` in Unix.
-        try-lock-exclusive: func() -> result<_, error-code>;
-
-        /// Release a shared or exclusive lock on an open file.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_UN)` in Unix.
-        unlock: func() -> result<_, error-code>;
-
         /// Test whether two descriptors refer to the same filesystem object.
         ///
         /// In POSIX, this corresponds to testing whether the two descriptors have the
diff --git a/crates/wasi/src/preview2/host/clocks.rs b/crates/wasi/src/preview2/host/clocks.rs
index 1a07013d8..688780edb 100644
--- a/crates/wasi/src/preview2/host/clocks.rs
+++ b/crates/wasi/src/preview2/host/clocks.rs
@@ -55,7 +55,7 @@ impl<T: WasiView> monotonic_clock::Host for T {
     fn subscribe(&mut self, when: Instant, absolute: bool) -> anyhow::Result<Resource<Pollable>> {
         let clock_now = self.ctx().monotonic_clock.now();
         let duration = if absolute {
-            Duration::from_nanos(when - clock_now)
+            Duration::from_nanos(when.saturating_sub(clock_now))
         } else {
             Duration::from_nanos(when)
         };
diff --git a/crates/wasi/src/preview2/host/filesystem.rs b/crates/wasi/src/preview2/host/filesystem.rs
index e762a5466..f011d69e2 100644
--- a/crates/wasi/src/preview2/host/filesystem.rs
+++ b/crates/wasi/src/preview2/host/filesystem.rs
@@ -728,26 +728,6 @@ impl<T: WasiView> HostDescriptor for T {
         todo!("filesystem change_directory_permissions_at is not implemented")
     }
 
-    async fn lock_shared(&mut self, _fd: Resource<types::Descriptor>) -> FsResult<()> {
-        todo!("filesystem lock_shared is not implemented")
-    }
-
-    async fn lock_exclusive(&mut self, _fd: Resource<types::Descriptor>) -> FsResult<()> {
-        todo!("filesystem lock_exclusive is not implemented")
-    }
-
-    async fn try_lock_shared(&mut self, _fd: Resource<types::Descriptor>) -> FsResult<()> {
-        todo!("filesystem try_lock_shared is not implemented")
-    }
-
-    async fn try_lock_exclusive(&mut self, _fd: Resource<types::Descriptor>) -> FsResult<()> {
-        todo!("filesystem try_lock_exclusive is not implemented")
-    }
-
-    async fn unlock(&mut self, _fd: Resource<types::Descriptor>) -> FsResult<()> {
-        todo!("filesystem unlock is not implemented")
-    }
-
     fn read_via_stream(
         &mut self,
         fd: Resource<types::Descriptor>,
diff --git a/crates/wasi/src/preview2/host/filesystem/sync.rs b/crates/wasi/src/preview2/host/filesystem/sync.rs
index 545f7f022..28a9b77f5 100644
--- a/crates/wasi/src/preview2/host/filesystem/sync.rs
+++ b/crates/wasi/src/preview2/host/filesystem/sync.rs
@@ -301,26 +301,6 @@ impl<T: async_filesystem::HostDescriptor> sync_filesystem::HostDescriptor for T
         })
     }
 
-    fn lock_shared(&mut self, fd: Resource<sync_filesystem::Descriptor>) -> FsResult<()> {
-        in_tokio(async { async_filesystem::HostDescriptor::lock_shared(self, fd).await })
-    }
-
-    fn lock_exclusive(&mut self, fd: Resource<sync_filesystem::Descriptor>) -> FsResult<()> {
-        in_tokio(async { async_filesystem::HostDescriptor::lock_exclusive(self, fd).await })
-    }
-
-    fn try_lock_shared(&mut self, fd: Resource<sync_filesystem::Descriptor>) -> FsResult<()> {
-        in_tokio(async { async_filesystem::HostDescriptor::try_lock_shared(self, fd).await })
-    }
-
-    fn try_lock_exclusive(&mut self, fd: Resource<sync_filesystem::Descriptor>) -> FsResult<()> {
-        in_tokio(async { async_filesystem::HostDescriptor::try_lock_exclusive(self, fd).await })
-    }
-
-    fn unlock(&mut self, fd: Resource<sync_filesystem::Descriptor>) -> FsResult<()> {
-        in_tokio(async { async_filesystem::HostDescriptor::unlock(self, fd).await })
-    }
-
     fn read_via_stream(
         &mut self,
         fd: Resource<sync_filesystem::Descriptor>,
diff --git a/crates/wasi/wit/deps/filesystem/types.wit b/crates/wasi/wit/deps/filesystem/types.wit
index 81dcde908..37700332b 100644
--- a/crates/wasi/wit/deps/filesystem/types.wit
+++ b/crates/wasi/wit/deps/filesystem/types.wit
@@ -650,105 +650,6 @@ interface types {
             modes: modes,
         ) -> result<_, error-code>;
 
-        /// Request a shared advisory lock for an open file.
-        ///
-        /// This requests a *shared* lock; more than one shared lock can be held for
-        /// a file at the same time.
-        ///
-        /// If the open file has an exclusive lock, this function downgrades the lock
-        /// to a shared lock. If it has a shared lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified how shared locks interact with locks acquired by
-        /// non-WASI programs.
-        ///
-        /// This function blocks until the lock can be acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_SH)` in Unix.
-        lock-shared: func() -> result<_, error-code>;
-
-        /// Request an exclusive advisory lock for an open file.
-        ///
-        /// This requests an *exclusive* lock; no other locks may be held for the
-        /// file while an exclusive lock is held.
-        ///
-        /// If the open file has a shared lock and there are no exclusive locks held
-        /// for the file, this function upgrades the lock to an exclusive lock. If the
-        /// open file already has an exclusive lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified whether this function succeeds if the file descriptor
-        /// is not opened for writing. It is unspecified how exclusive locks interact
-        /// with locks acquired by non-WASI programs.
-        ///
-        /// This function blocks until the lock can be acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_EX)` in Unix.
-        lock-exclusive: func() -> result<_, error-code>;
-
-        /// Request a shared advisory lock for an open file.
-        ///
-        /// This requests a *shared* lock; more than one shared lock can be held for
-        /// a file at the same time.
-        ///
-        /// If the open file has an exclusive lock, this function downgrades the lock
-        /// to a shared lock. If it has a shared lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified how shared locks interact with locks acquired by
-        /// non-WASI programs.
-        ///
-        /// This function returns `error-code::would-block` if the lock cannot be
-        /// acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_SH | LOCK_NB)` in Unix.
-        try-lock-shared: func() -> result<_, error-code>;
-
-        /// Request an exclusive advisory lock for an open file.
-        ///
-        /// This requests an *exclusive* lock; no other locks may be held for the
-        /// file while an exclusive lock is held.
-        ///
-        /// If the open file has a shared lock and there are no exclusive locks held
-        /// for the file, this function upgrades the lock to an exclusive lock. If the
-        /// open file already has an exclusive lock, this function has no effect.
-        ///
-        /// This requests an *advisory* lock, meaning that the file could be accessed
-        /// by other programs that don't hold the lock.
-        ///
-        /// It is unspecified whether this function succeeds if the file descriptor
-        /// is not opened for writing. It is unspecified how exclusive locks interact
-        /// with locks acquired by non-WASI programs.
-        ///
-        /// This function returns `error-code::would-block` if the lock cannot be
-        /// acquired.
-        ///
-        /// Not all filesystems support locking; on filesystems which don't support
-        /// locking, this function returns `error-code::unsupported`.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_EX | LOCK_NB)` in Unix.
-        try-lock-exclusive: func() -> result<_, error-code>;
-
-        /// Release a shared or exclusive lock on an open file.
-        ///
-        /// Note: This is similar to `flock(fd, LOCK_UN)` in Unix.
-        unlock: func() -> result<_, error-code>;
-
         /// Test whether two descriptors refer to the same filesystem object.
         ///
         /// In POSIX, this corresponds to testing whether the two descriptors have the
diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock
index f8318ffec..93435881f 100644
--- a/supply-chain/imports.lock
+++ b/supply-chain/imports.lock
@@ -3,195 +3,195 @@
 
 [[unpublished.cranelift]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-bforest]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-codegen]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-codegen-meta]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-codegen-shared]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-control]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-entity]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-frontend]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-interpreter]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-isle]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-jit]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-module]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-native]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-object]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-reader]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-serde]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.cranelift-wasm]]
 version = "0.102.0"
-audited_as = "0.101.1"
+audited_as = "0.101.2"
 
 [[unpublished.wasi-cap-std-sync]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasi-common]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasi-tokio]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-asm-macros]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-cache]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-cli]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-cli-flags]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-component-macro]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-component-util]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-cranelift]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-cranelift-shared]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-environ]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-explorer]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-fiber]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-jit]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-jit-debug]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-jit-icache-coherence]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-runtime]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-types]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wasi]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wasi-http]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wasi-nn]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wasi-threads]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wast]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-winch]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wit-bindgen]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wasmtime-wmemcheck]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wiggle]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wiggle-generate]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wiggle-macro]]
 version = "15.0.0"
-audited_as = "14.0.1"
+audited_as = "14.0.2"
 
 [[unpublished.wiggle-test]]
 version = "0.0.0"
@@ -199,7 +199,7 @@ audited_as = "0.1.0"
 
 [[unpublished.winch-codegen]]
 version = "0.13.0"
-audited_as = "0.12.1"
+audited_as = "0.12.2"
 
 [[publisher.aho-corasick]]
 version = "1.0.2"
@@ -370,104 +370,104 @@ user-login = "epage"
 user-name = "Ed Page"
 
 [[publisher.cranelift]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-bforest]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-codegen]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-codegen-meta]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-codegen-shared]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-control]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-entity]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-frontend]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-interpreter]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-isle]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-jit]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-module]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-native]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-object]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-reader]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-serde]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.cranelift-wasm]]
-version = "0.101.1"
-when = "2023-10-23"
+version = "0.101.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
@@ -640,8 +640,8 @@ user-login = "BurntSushi"
 user-name = "Andrew Gallant"
 
 [[publisher.rustix]]
-version = "0.38.14"
-when = "2023-09-20"
+version = "0.38.21"
+when = "2023-10-26"
 user-id = 6825
 user-login = "sunfishcode"
 user-name = "Dan Gohman"
@@ -722,13 +722,6 @@ user-id = 6825
 user-login = "sunfishcode"
 user-name = "Dan Gohman"
 
-[[publisher.target-lexicon]]
-version = "0.12.12"
-when = "2023-10-19"
-user-id = 6825
-user-login = "sunfishcode"
-user-name = "Dan Gohman"
-
 [[publisher.termcolor]]
 version = "1.1.3"
 when = "2022-03-02"
@@ -786,20 +779,20 @@ user-login = "BurntSushi"
 user-name = "Andrew Gallant"
 
 [[publisher.wasi-cap-std-sync]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasi-common]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasi-tokio]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
@@ -881,152 +874,152 @@ user-login = "alexcrichton"
 user-name = "Alex Crichton"
 
 [[publisher.wasmtime]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-asm-macros]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-cache]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-cli]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-cli-flags]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-component-macro]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-component-util]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-cranelift]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-cranelift-shared]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-environ]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-explorer]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-fiber]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-jit]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-jit-debug]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-jit-icache-coherence]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-runtime]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-types]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wasi]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wasi-http]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wasi-nn]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wasi-threads]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wast]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-winch]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wit-bindgen]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wasmtime-wmemcheck]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
@@ -1045,20 +1038,20 @@ user-login = "alexcrichton"
 user-name = "Alex Crichton"
 
 [[publisher.wiggle]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wiggle-generate]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
 [[publisher.wiggle-macro]]
-version = "14.0.1"
-when = "2023-10-23"
+version = "14.0.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 
@@ -1077,8 +1070,8 @@ user-login = "BurntSushi"
 user-name = "Andrew Gallant"
 
 [[publisher.winch-codegen]]
-version = "0.12.1"
-when = "2023-10-23"
+version = "0.12.2"
+when = "2023-10-26"
 user-id = 73222
 user-login = "wasmtime-publish"
 


Test patch:
diff --git a/crates/test-programs/src/bin/preview2_sleep.rs b/crates/test-programs/src/bin/preview2_sleep.rs
index be8a20cb2..a5f4d76a3 100644
--- a/crates/test-programs/src/bin/preview2_sleep.rs
+++ b/crates/test-programs/src/bin/preview2_sleep.rs
@@ -1,15 +1,27 @@
 use test_programs::wasi::{clocks::monotonic_clock, io::poll};
 
 fn main() {
-    // Sleep ten milliseconds.  Note that we call the relevant host functions directly rather than go through
-    // libstd, since we want to ensure we're calling `monotonic_clock::subscribe` with an `absolute` parameter of
-    // `true`, which libstd won't necessarily do (but which e.g. CPython _will_ do).
-    eprintln!("calling subscribe");
-    let p = monotonic_clock::subscribe(monotonic_clock::now() + 10_000_000, true);
-    dbg!(&p as *const _);
-    let list = &[&p];
-    dbg!(list.as_ptr());
-    eprintln!("calling poll");
-    poll::poll_list(list);
-    eprintln!("done");
+    sleep_10ms();
+    sleep_0ms();
+    sleep_backwards_in_time();
+}
+
+fn sleep_10ms() {
+    let dur = 10_000_000;
+    let p = monotonic_clock::subscribe(monotonic_clock::now() + dur, true);
+    poll::poll_one(&p);
+    let p = monotonic_clock::subscribe(dur, false);
+    poll::poll_one(&p);
+}
+
+fn sleep_0ms() {
+    let p = monotonic_clock::subscribe(monotonic_clock::now(), true);
+    poll::poll_one(&p);
+    let p = monotonic_clock::subscribe(0, false);
+    poll::poll_one(&p);
+}
+
+fn sleep_backwards_in_time() {
+    let p = monotonic_clock::subscribe(monotonic_clock::now() - 1, true);
+    poll::poll_one(&p);
 }