lind overlay for the Rust libc crate - #1378
Draft
rishabhBudhouliya wants to merge 1 commit into
Draft
rishabhBudhouliya wants to merge 1 commit into
rishabhBudhouliya wants to merge 1 commit into
Conversation
Yaxuan-w
reviewed
Sep 14, 2026
Member
There was a problem hiding this comment.
Seems this file is a git diff result? What's the purpose of this file?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rust programs built for lind use the
wasm32-wasip1target. The Rust libc crate picks its wasi module for that target, which describes wasi-libc. However, lind links the binary against lind-glibc. Struct layouts, open flags and errno values don't match causing syscall failures.Some observed behavior when trying to run in-toto in lind-wasm:
I was wondering why grates never have this problem and it turns out they do file I/O through raw 3i calls. The imfs grate has a workaround comment for the same bug. Would be interesting to hear more about how the grates designed around this issue.
Related issues
Testing
scripts/rust/make_lind_libc.sh copies libc 0.2.189 from the cargo registry into build/lind-libc and applies scripts/rust/lind-libc-wasi.patch. The patch changes one file, src/wasi/mod.rs: the stat and dirent layouts as measured under lind.
A crate uses it with: cargo --config 'patch.crates-io.libc.path="build/lind-libc"'
Compatibility and security impact
Checklist