Stream: git-wasmtime

Topic: wasmtime / PR #14729 wasi: don't follow a trailing-slash ...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:18):

alexcrichton opened PR #14729 from alexcrichton:fix-rename-trailing-slash to bytecodealliance:main:

rename stripped a trailing slash from the source to find its parent directory and then re-appended it to the unresolved leaf before calling renameat. macOS and FreeBSD follow a symlink named with a trailing slash, so renaming up/, where up is a relative symlink to ../outside, moved a directory from outside the sandbox into it.

Now a trailing slash on either path requires the source to be a directory, on every platform. Linux never follows a symlink named with a trailing slash in renameat and fails with ENOTDIR instead, so there the slash is re-appended to the source whenever either path had one, and the kernel checks it atomically with the rename. Elsewhere, the source is checked without following symlinks and renamed by the plain names, so a symlink can't be followed out of the preopen. That check isn't atomic with the rename, but whatever replaces the source in between is still renamed by its plain name. Anything else fails with ENOTDIR, so a trailing slash on the destination no longer lets a file or symlink be renamed either.

Windows previously stripped the slashes and never re-appended them, so rename("file\\", "new") and rename("file", "new\\") succeeded there. They now fail with ERROR_DIRECTORY, consistent with Unix.

The p1, p2 and p3 tests preopen a sandbox directory next to an outside directory, rename a trailing-slash symlink to ../outside from inside the sandbox, and check that outside stays in place. They also rename a real directory with trailing slashes, which must keep working. The p2 test absorbs p2_path_rename_dir_trailing_slashes, which covered those directory renames.

Part of https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-m9f7-9w4p-gv38

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:18):

alexcrichton requested rvolosatovs for a review on PR #14729.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:18):

alexcrichton requested wasmtime-wasi-reviewers for a review on PR #14729.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:18):

alexcrichton requested pchickey for a review on PR #14729.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:18):

alexcrichton requested wasmtime-core-reviewers for a review on PR #14729.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:40):

:thumbs_up: rvolosatovs submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 15:41):

rvolosatovs added PR #14729 wasi: don't follow a trailing-slash symlink in rename to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 16:04):

:check: rvolosatovs merged PR #14729.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 14 2026 at 16:04):

rvolosatovs removed PR #14729 wasi: don't follow a trailing-slash symlink in rename from the merge queue


Last updated: Oct 31 2026 at 23:03 UTC