Skip to content

wasi-preview1: invalidate dirent cache on fd_renumber - #15468

Queued
MeGaurav4 wants to merge 1 commit into
bytecodealliance:mainfrom
MeGaurav4:fix/fd-renumber-dirent-cache
Queued

MeGaurav4 wants to merge 1 commit into
bytecodealliance:mainfrom
MeGaurav4:fix/fd-renumber-dirent-cache

Conversation

@MeGaurav4

Copy link
Copy Markdown

Renumbering a descriptor left the adapter's global dirent_cache attached to the old descriptor. A later fd_readdir on the target could resume the stale stream and return entries from the wrong directory. The cache is now dropped when either renumber endpoint matches the cached descriptor, with a regression case in the p1_renumber test program.

Closes #15327

Verification

  • cargo check -p wasi-preview1-component-adapter: passes
  • cargo check -p test-programs --bin p1_renumber --target wasm32-wasip1: passes
  • cargo fmt --check: clean
  • Full integration suite not run locally (wasmtime runtime build not available in this environment)

Renumbering a descriptor did not update the global dirent cache, so a
later fd_readdir on the target could resume the old directory's stream
and return entries from the wrong directory. Drop the cached stream
when either endpoint matches the cached descriptor, and add a p1 test
that reproduces the stale-stream case.

Closes bytecodealliance#15327.
@MeGaurav4
MeGaurav4 requested review from a team as code owners November 27, 2026 05:04
@MeGaurav4
MeGaurav4 requested review from pchickey and rvolosatovs and removed request for a team November 27, 2026 05:04

@rvolosatovs rvolosatovs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@rvolosatovs
rvolosatovs added this pull request to the merge queue Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wasi-preview1-component-adapter: fd_renumber can associate a cached directory stream with the wrong descriptor

2 participants