Skip to content

fix(wasip1): fd_renumber panic in the host#11276

Merged
rvolosatovs merged 6 commits into
bytecodealliance:mainfrom
rvolosatovs:fix/p1-fd-renumber-panic
Jul 18, 2025
Merged

fix(wasip1): fd_renumber panic in the host#11276
rvolosatovs merged 6 commits into
bytecodealliance:mainfrom
rvolosatovs:fix/p1-fd-renumber-panic

Conversation

@rvolosatovs
Copy link
Copy Markdown
Member

The implementation assumed that only the runtime could ever issue FDs,
however that's not the case in p1, where guests can choose arbitrary
FDs to use (e.g. via `fd_renumber`).

Due to incorrect accounting, guests could "mark" arbitrary FDs as "free"
and trigger a panic in the host by requesting a new FD.

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Since `remove` is now only used once, remove it.

As a sideffect, this makes the implementation more explicit .

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
prtest:full

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs requested review from a team as code owners July 18, 2025 11:34
@rvolosatovs rvolosatovs requested review from alexcrichton and removed request for a team July 18, 2025 11:34
@rvolosatovs rvolosatovs enabled auto-merge July 18, 2025 11:34
@github-actions github-actions Bot added wasi Issues pertaining to WASI wasmtime:docs Issues related to Wasmtime's documentation labels Jul 18, 2025
@rvolosatovs rvolosatovs added this pull request to the merge queue Jul 18, 2025
Merged via the queue into bytecodealliance:main with commit 0c93530 Jul 18, 2025
165 checks passed
@rvolosatovs rvolosatovs deleted the fix/p1-fd-renumber-panic branch July 18, 2025 17:04
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
* fix(wasip1): prevent duplicate FD usage

The implementation assumed that only the runtime could ever issue FDs,
however that's not the case in p1, where guests can choose arbitrary
FDs to use (e.g. via `fd_renumber`).

Due to incorrect accounting, guests could "mark" arbitrary FDs as "free"
and trigger a panic in the host by requesting a new FD.

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* test(wasip1): expand `fd_renumber` test

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* doc: add release notes

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* test(wasip1): ignore `fd_renumber` tests when using adapter

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* refactor(wasip1): do not modify descriptors on `fd_renumber(n, n)`

Since `remove` is now only used once, remove it.

As a sideffect, this makes the implementation more explicit .

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* doc: reference the CVE

prtest:full

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

---------

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI wasmtime:docs Issues related to Wasmtime's documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants