nodejs / nodejs/uvwasi

`fd_fdstat_get` returns invalid `fs_flags`

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
270
Forks
60
PR merge metrics
No merged PRs in 30d

Description

According to https://github.com/nodejs/uvwasi/blob/6eeddbae277693bc022e59e54649ec13eed478c7/src/uvwasi.c#L885, fd_fdstat_get would return fs_flags directly from fcntl() call on a POSIX host. However, there's no translation logic to generate the fd flags that conform to https://github.com/WebAssembly/wasi-libc/blob/a05277a6803d99dc5f8d5c250a02cf37ff90882a/libc-bottom-half/headers/public/wasi/api.h#L896, so it's highly likely that an invalid fs_flags is passed to wasm code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/uvwasi.c at the fd_fdstat_get implementation around line 885 and compare its fs_flags handling with the WASI definitions in wasi/api.h around line 896. Verify the POSIX fcntl result against the WASI flag values; done means fd_fdstat_get returns flags conforming to the WASI API rather than the raw host value.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.