-
Notifications
You must be signed in to change notification settings - Fork 2
fix: vm fatal errors #21
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
base: v0.2-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,9 @@ impl AsyncCustomFD { | |
|
|
||
| /// Create a new AsyncCustomFD from a raw fd, taking ownership | ||
| /// Sets the fd to non-blocking mode automatically | ||
| /// | ||
| /// # Safety | ||
| /// `fd` must be a valid open file descriptor that no one else closes or owns | ||
| pub unsafe fn from_raw_fd(fd: std::os::fd::RawFd) -> std::io::Result<Self> { | ||
| set_fd_nonblocking(fd)?; | ||
| let owned = std::os::fd::OwnedFd::from_raw_fd(fd); | ||
|
|
@@ -218,6 +221,9 @@ impl FdPairStream { | |
| /// Create a new FdPairStream from raw file descriptors | ||
| /// source_fd is used for reading, sink_fd is used for writing | ||
| /// Takes ownership and sets both to non-blocking mode | ||
| /// | ||
| /// # Safety | ||
| /// Both fds must be valid open file descriptors that no one else closes or owns | ||
|
Comment on lines
+224
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n -C 8 'FdPairStream::from_raw_fds|from_raw_fds\s*\(' executor --glob '*.rs'Repository: genlayerlabs/genvm-executor Length of output: 1478 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
sed -n '1,280p' executor/crates/common/src/io.rsRepository: genlayerlabs/genvm-executor Length of output: 8745 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
src = Path("executor/crates/common/src/io.rs").read_text()
needle = "unsafe fn from_raw_fds("
idx = src.index(needle)
end = src.index("pub struct FdPairStream", idx)
chunk = src[:end]
checks = {
"contains_own_raw_fds": "std::os::fd::OwnedFd::from_raw_fd(source_fd)" in chunk and "std::os::fd::OwnedFd::from_raw_fd(sink_fd)" in chunk,
"no_source_sink_inequality": "source_fd != sink_fd" not in chunk and "source_fd == sink_fd" not in chunk and "must not be the same" not in chunk.lower() and "distinct" not in chunk and "double-close" not in chunk.lower(),
"document_safety_unsafe": "# Safety" in chunk and "Both fds must be valid open file descriptors that no one else closes or owns" in chunk,
}
for k, v in checks.items():
print(f"{k}: {v}")
PYRepository: genlayerlabs/genvm-executor Length of output: 270 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
src = Path("executor/crates/common/src/io.rs").read_text()
# Extract FdPairStream safe doc and from_raw_fds body/preceding safety section only.
body = re.search(r"(impl FdPairStream \{[\s\S]*?\n\})", src)
if not body:
raise SystemExit("FdPairStream impl not found")
sect = body.group(1)
print("contains_from_raw_fds:", "unsafe fn from_raw_fds(" in sect)
print("builds_two_owned_fds:", "OwnedFd::from_raw_fd(source_fd)" in sect and "OwnedFd::from_raw_fd(sink_fd)" in sect)
print("checks_source_sink_inequality:", bool(re.match(r".* source_fd != sink_fd .*", sect, re.S)))
print("uses_same_raw_fd_in_both_constructors:", re.search(r"OwnedFd::from_raw_fd\(source_fd\).*OwnedFd::from_raw_fd\(sink_fd\)|OwnedFd::from_raw_fd\(sink_fd\).*OwnedFd::from_raw_fd\(source_fd\)", sect))
needle = "unsafe fn from_raw_fds("
idx = sect.index(needle)
prev = sect[:idx]
after = sect[idx:sect.find("impl tokio::io::AsyncRead", idx)]
# Safety sentence(s) are immediately before pub unsafe fn; find last # Safety block in that prefix.
last_safety_start = prev.rfind("# Safety")
safety = prev[last_safety_start:] if last_safety_start >= 0 else ""
print("current_safety_text:")
print(safety.strip())
PYRepository: genlayerlabs/genvm-executor Length of output: 424 Require distinct raw descriptors.
🤖 Prompt for AI Agents |
||
| pub unsafe fn from_raw_fds( | ||
| source_fd: std::os::fd::RawFd, | ||
| sink_fd: std::os::fd::RawFd, | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| // This file is auto-generated. Do not edit! | ||||||
|
|
||||||
| #![allow(dead_code, clippy::redundant_static_lifetimes)] | ||||||
| #![allow(dead_code, clippy::all)] | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n -C 2 'clippy::all|clippy::redundant_static_lifetimes' executor/crates/sdk-rs --glob '*.rs'Repository: genlayerlabs/genvm-executor Length of output: 498 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf 'Tracked files under abi:\n'
git ls-files executor/crates/sdk-rs/src/abi | sed -n '1,80p'
printf '\nconsts.rs first 40 lines:\n'
cat -n executor/crates/sdk-rs/src/abi/consts.rs | sed -n '1,40p'
printf '\nGenerator references to abi/consts.rs or consts generation:\n'
rg -n 'consts\.rs|abi::consts|abi/consts|generator|generate' executor/crates/sdk-rs --glob '*.rs' --glob '*.rs.in' --glob '*.toml' | sed -n '1,160p'Repository: genlayerlabs/genvm-executor Length of output: 2135 Keep
Proposed fix-#![allow(dead_code, clippy::all)]
+#![allow(dead_code, clippy::redundant_static_lifetimes)]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| use serde::{Deserialize, Serialize}; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Cache failed evaluations separately from
InProgress.When
deferred()returns an ordinaryEvalError, these lines leave the thunk inThunkState::InProgress. The nextforce()then reportsinfinite recursion while forcing a lazy value, even when no recursion occurred. The original error is lost, and the binding becomes permanently unusable.Add a terminal failed state that preserves the original error. Do not use
InProgressas the error cache.🤖 Prompt for AI Agents