Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fd validity and basic bound checks on fd_advise #4555

Merged
merged 4 commits into from
Apr 15, 2024

Conversation

yagehu
Copy link
Contributor

@yagehu yagehu commented Apr 11, 2024

This commit fixes fd_advise unconditionally returning ok (0) on all inputs. The details are discussed in issue #4554.

Description

#4554 discusses the motivation. This is a behavior divergence between Wasmer and all other Wasm runtimes.

fixes #4554

@theduke theduke force-pushed the yagehu/fd-advise-check branch from 20260b8 to 5c55ebc Compare April 13, 2024 05:05
@theduke
Copy link
Contributor

theduke commented Apr 13, 2024

@yagehu once again, many thanks!

I pushed a commit that adds a test validating the behaviour.

The invalid file descriptor error is as expected, but the overflow still returns a 0, could you check why?
(if not we will follow up)

To run the tests:

  • compile the release binary
  • cd tests/wasi-fyi; ./test.sh

@yagehu
Copy link
Contributor Author

yagehu commented Apr 14, 2024

@theduke Thanks for demonstrating the fyi test! I was having a hard time finding the right test suite to add to.

Since filesize is spec'd as u64, I adjusted the extern "C" signature accordingly and now it indeed errors as expected. Previously, i64::MAX added to itself would not overflow an u64.

yagehu and others added 4 commits April 15, 2024 10:08
This commit fixes `fd_advise` unconditionally returning ok (0) on all
inputs.  The details are discussed in issue wasmerio#4554.
It now runs on platforms where bash is not in /usr/bin, like NixOS
@theduke theduke force-pushed the yagehu/fd-advise-check branch from 870d044 to 53f45ee Compare April 15, 2024 08:08
@theduke theduke merged commit a28b1f1 into wasmerio:master Apr 15, 2024
59 checks passed
@yagehu yagehu deleted the yagehu/fd-advise-check branch April 16, 2024 04:21
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.

fd_advise on invalid file descriptors report ok
2 participants