Stream: git-wasmtime

Topic: wasmtime / PR #5035 Run piped modules


view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2022 at 11:08):

cr0sh opened PR #5035 from run-piped-modules to main:

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

This is not discussed in the issue tracker, but on this Zulip thread.

Previously load_module opened a file on path to check if the module is precompiled, then closes before constructing the Module from it. This is fine on normal files, but on piped files(like /dev/stdin), is problematic as the header read is not visible on the next open.

So, this set of commits change the procedure to 1) try to mmap the whole file from the path. 2) If it fails(implying the file is something special), read the whole file into the buffer so we can safely read the header and reuse the buffer again on the subsequent Module::new.

The Zulip thread contains an additional concern by me, about implicitly allowing accsesing /dev/tty on - inputs, which is not considered here.


Last updated: Nov 22 2024 at 17:03 UTC