kobako 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.githooks/linux-tests.sh +29 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +125 -0
- data/Cargo.lock +457 -494
- data/README.md +2 -3
- data/ROADMAP.md +0 -1
- data/crates/kobako-runtime/CHANGELOG.md +90 -0
- data/crates/kobako-runtime/Cargo.toml +14 -15
- data/crates/kobako-runtime/README.md +1 -1
- data/crates/kobako-runtime/src/cred.rs +32 -20
- data/crates/kobako-runtime/src/filesystem/bind/fid.rs +300 -22
- data/crates/kobako-runtime/src/filesystem/bind/lookup.rs +56 -22
- data/crates/kobako-runtime/src/filesystem/bind/unicode.rs +109 -0
- data/crates/kobako-runtime/src/filesystem/bind/walk.rs +33 -14
- data/crates/kobako-runtime/src/filesystem/bind.rs +393 -220
- data/crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs +2 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack.rs +9 -10
- data/crates/kobako-runtime/src/filesystem/overlay.rs +277 -46
- data/crates/kobako-runtime/src/filesystem/rdir.rs +8 -27
- data/crates/kobako-runtime/src/filesystem/testing.rs +31 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs.rs +47 -13
- data/crates/kobako-runtime/src/filesystem.rs +2 -0
- data/crates/kobako-runtime/src/fork.rs +239 -16
- data/crates/kobako-runtime/src/limits.rs +17 -41
- data/crates/kobako-runtime/src/locking/seqlock.rs +29 -3
- data/crates/kobako-runtime/src/locking.rs +508 -113
- data/crates/kobako-runtime/src/memcg.rs +83 -160
- data/crates/kobako-runtime/src/mount.rs +0 -30
- data/crates/kobako-runtime/src/net/connections.rs +53 -13
- data/crates/kobako-runtime/src/net/egress.rs +44 -24
- data/crates/kobako-runtime/src/net/http.rs +888 -456
- data/crates/kobako-runtime/src/net/lookup.rs +150 -50
- data/crates/kobako-runtime/src/net/namespace.rs +97 -95
- data/crates/kobako-runtime/src/net/reactor.rs +298 -203
- data/crates/kobako-runtime/src/net/resolv/darwin.rs +8 -3
- data/crates/kobako-runtime/src/net/resolv/stub/tests.rs +50 -0
- data/crates/kobako-runtime/src/net/resolv/stub.rs +29 -23
- data/crates/kobako-runtime/src/net/resolv/windows.rs +14 -44
- data/crates/kobako-runtime/src/net/resolv.rs +39 -15
- data/crates/kobako-runtime/src/net/skbuff.rs +109 -0
- data/crates/kobako-runtime/src/net/socket.rs +51 -52
- data/crates/kobako-runtime/src/net/task.rs +223 -0
- data/crates/kobako-runtime/src/net/tcp.rs +410 -158
- data/crates/kobako-runtime/src/net/tls.rs +65 -3
- data/crates/kobako-runtime/src/net/transport.rs +72 -47
- data/crates/kobako-runtime/src/net/udp.rs +231 -129
- data/crates/kobako-runtime/src/net.rs +3 -0
- data/crates/kobako-runtime/src/sched.rs +244 -58
- data/crates/kobako-runtime/src/security.rs +27 -16
- data/crates/kobako-runtime/src/vfs/dentry.rs +80 -41
- data/crates/kobako-runtime/src/vfs/file.rs +52 -53
- data/crates/kobako-runtime/src/vfs/kern_path.rs +24 -11
- data/crates/kobako-runtime/src/vfs/namei.rs +399 -184
- data/crates/kobako-runtime/src/vfs/namespace.rs +123 -40
- data/crates/kobako-runtime/src/vfs/stat.rs +105 -16
- data/crates/kobako-runtime/src/vfs.rs +1 -0
- data/crates/kobako-runtime/src/wait.rs +75 -50
- data/crates/kobako-transport/CHANGELOG.md +7 -0
- data/crates/kobako-transport/Cargo.toml +1 -1
- data/crates/kobako-transport/README.md +1 -1
- data/crates/kobako-wasmtime/CHANGELOG.md +47 -0
- data/crates/kobako-wasmtime/Cargo.toml +27 -6
- data/crates/kobako-wasmtime/README.md +3 -3
- data/crates/kobako-wasmtime/src/abi.rs +2 -1
- data/crates/kobako-wasmtime/src/ambient.rs +11 -2
- data/crates/kobako-wasmtime/src/cache/unix.rs +95 -0
- data/crates/kobako-wasmtime/src/cache/windows.rs +359 -0
- data/crates/kobako-wasmtime/src/cache.rs +88 -103
- data/crates/kobako-wasmtime/src/driver.rs +40 -27
- data/crates/kobako-wasmtime/src/invocation.rs +21 -7
- data/crates/kobako-wasmtime/src/lib.rs +2 -0
- data/crates/kobako-wasmtime/src/limiter.rs +78 -25
- data/crates/kobako-wasmtime/src/preview1/descriptors.rs +13 -17
- data/crates/kobako-wasmtime/src/preview1/differential/mount.rs +4 -5
- data/crates/kobako-wasmtime/src/preview1/differential.rs +1 -1
- data/crates/kobako-wasmtime/src/preview1/fd.rs +23 -19
- data/crates/kobako-wasmtime/src/preview1/mount_view.rs +130 -197
- data/crates/kobako-wasmtime/src/preview1/path.rs +3 -3
- data/crates/kobako-wasmtime/src/preview1/poll.rs +28 -22
- data/crates/kobako-wasmtime/src/preview1/random.rs +125 -0
- data/crates/kobako-wasmtime/src/preview1/testing.rs +31 -0
- data/crates/kobako-wasmtime/src/preview1.rs +85 -9
- data/crates/kobako-wasmtime/src/preview2/filesystem.rs +2 -2
- data/crates/kobako-wasmtime/src/preview2/host.rs +609 -249
- data/crates/kobako-wasmtime/src/preview2/http.rs +299 -215
- data/crates/kobako-wasmtime/src/preview2/io.rs +17 -4
- data/crates/kobako-wasmtime/src/preview2/table.rs +24 -72
- data/crates/kobako-wasmtime/src/trap.rs +68 -23
- data/crates/kobako-wasmtime/src/waits.rs +59 -0
- data/crates/kobako-wasmtime/src/wasi.rs +91 -10
- data/crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx +13 -0
- data/data/kobako.wasm +0 -0
- data/ext/kobako/Cargo.toml +6 -2
- data/ext/kobako/src/escape.rs +332 -26
- data/ext/kobako/src/filesystem/grants.rs +5 -7
- data/ext/kobako/src/filesystem/ruby.rs +10 -3
- data/ext/kobako/src/filesystem.rs +47 -8
- data/ext/kobako/src/fork.rs +72 -0
- data/ext/kobako/src/gvl.rs +499 -76
- data/ext/kobako/src/handoff.rs +490 -0
- data/ext/kobako/src/lib.rs +10 -0
- data/ext/kobako/src/network.rs +5 -3
- data/ext/kobako/src/pinned_value.rs +28 -15
- data/ext/kobako/src/runtime/bridge.rs +32 -25
- data/ext/kobako/src/runtime.rs +74 -43
- data/lib/kobako/catalog/handles.rb +9 -5
- data/lib/kobako/codec/decoder.rb +1 -1
- data/lib/kobako/codec/state.rb +2 -18
- data/lib/kobako/codec/value_budget.rb +4 -4
- data/lib/kobako/codec.rb +5 -6
- data/lib/kobako/errors.rb +4 -7
- data/lib/kobako/filesystem.rb +1 -1
- data/lib/kobako/fork.rb +42 -0
- data/lib/kobako/handle.rb +1 -2
- data/lib/kobako/sandbox.rb +17 -36
- data/lib/kobako/sandbox_options.rb +7 -9
- data/lib/kobako/usage.rb +4 -2
- data/lib/kobako/version.rb +1 -1
- data/lib/kobako.rb +2 -2
- data/sig/kobako/catalog/handles.rbs +2 -0
- data/sig/kobako/codec/state.rbs +0 -4
- data/sig/kobako/codec/value_budget.rbs +1 -1
- data/sig/kobako/codec.rbs +2 -2
- data/sig/kobako/errors.rbs +0 -3
- data/sig/kobako/fork.rbs +17 -0
- data/sig/kobako/runtime.rbs +2 -2
- data/sig/kobako/sandbox.rbs +3 -12
- data/sig/kobako/sandbox_options.rbs +0 -2
- metadata +15 -4
- data/lib/kobako/pool.rb +0 -162
- data/sig/core/thread.rbs +0 -6
- data/sig/kobako/pool.rbs +0 -46
|
@@ -6,24 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
use cap_std::fs::Dir;
|
|
8
8
|
|
|
9
|
+
use super::fid::FIDS;
|
|
9
10
|
use super::{open_dir_nofollow, Errno};
|
|
10
11
|
|
|
11
12
|
/// The directory `names` reach beneath `dir`, a link on the way refused as
|
|
12
13
|
/// a loop, walked in one call as 9p's `Twalk` walks several names. A path past
|
|
13
14
|
/// what the host takes in one call is no name it refuses, so it goes name by
|
|
14
|
-
/// name, where only a name too long for the host is refused.
|
|
15
|
+
/// name, where only a name too long for the host is refused. However deep,
|
|
16
|
+
/// a walk holds at most two descriptors of its own at once.
|
|
15
17
|
pub(super) fn walk(dir: &Dir, names: &[String]) -> Result<Dir, Errno> {
|
|
16
|
-
match kernel::walk(dir, names) {
|
|
18
|
+
FIDS.open(|| match kernel::walk(dir, names) {
|
|
17
19
|
None | Some(Err(Errno::InvalidFilename)) => by_name(dir, names),
|
|
18
20
|
Some(opened) => opened,
|
|
19
|
-
}
|
|
21
|
+
})
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
/// Each name opened in turn, the way every host can
|
|
24
|
+
/// Each name opened in turn, the way every host can, a run that is to stop
|
|
25
|
+
/// stopping between two.
|
|
23
26
|
fn by_name(dir: &Dir, names: &[String]) -> Result<Dir, Errno> {
|
|
24
27
|
let (first, rest) = names.split_first().ok_or(Errno::InvalidInput)?;
|
|
25
28
|
rest.iter()
|
|
26
29
|
.try_fold(open_dir_nofollow(dir, first)?, |dir, name| {
|
|
30
|
+
crate::sched::stop_if_fatal()?;
|
|
27
31
|
open_dir_nofollow(&dir, name)
|
|
28
32
|
})
|
|
29
33
|
}
|
|
@@ -174,8 +178,7 @@ mod tests {
|
|
|
174
178
|
let _ = fs::remove_dir_all(&path);
|
|
175
179
|
fs::create_dir_all(path.join("a/b/c")).expect("the tree must be made");
|
|
176
180
|
fs::write(path.join("a/file"), "x").expect("the file must be made");
|
|
177
|
-
|
|
178
|
-
std::os::unix::fs::symlink("b", path.join("a/link")).expect("the link must be made");
|
|
181
|
+
crate::filesystem::testing::symlink("b", path.join("a/link"));
|
|
179
182
|
Self(path)
|
|
180
183
|
}
|
|
181
184
|
|
|
@@ -203,17 +206,36 @@ mod tests {
|
|
|
203
206
|
open(dir, &names(path)).map(drop)
|
|
204
207
|
}
|
|
205
208
|
|
|
209
|
+
// @behavior FS-236
|
|
210
|
+
#[test]
|
|
211
|
+
fn a_walk_by_name_past_its_runs_deadline_answers_eintr() {
|
|
212
|
+
let tree = Tree::new("by-name-deadline");
|
|
213
|
+
let dir = tree.dir();
|
|
214
|
+
let walked = crate::sched::run_task(Some(std::time::Instant::now()), || {
|
|
215
|
+
answer(by_name, &dir, "a/b/c")
|
|
216
|
+
});
|
|
217
|
+
assert_eq!(
|
|
218
|
+
walked,
|
|
219
|
+
Err(Errno::Interrupted),
|
|
220
|
+
"a Bind walking a/b/c a name at a time in a run past its deadline must answer EINTR \
|
|
221
|
+
before it opens the next name"
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
206
225
|
// The host's kernel path and the one-name-at-a-time path must answer
|
|
207
226
|
// alike, since which one runs depends on the host.
|
|
208
227
|
#[test]
|
|
209
228
|
fn the_kernel_and_each_name_answer_alike() {
|
|
210
229
|
let tree = Tree::new("alike");
|
|
211
230
|
let dir = tree.dir();
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
231
|
+
for path in [
|
|
232
|
+
"a/b/c",
|
|
233
|
+
"a/missing/c",
|
|
234
|
+
"a/file/c",
|
|
235
|
+
"a/file",
|
|
236
|
+
"a/link/c",
|
|
237
|
+
"a/link",
|
|
238
|
+
] {
|
|
217
239
|
assert_eq!(
|
|
218
240
|
answer(walk, &dir, path),
|
|
219
241
|
answer(by_name, &dir, path),
|
|
@@ -225,9 +247,6 @@ mod tests {
|
|
|
225
247
|
|
|
226
248
|
#[test]
|
|
227
249
|
fn a_link_on_the_way_is_a_loop() {
|
|
228
|
-
if !cfg!(unix) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
250
|
let tree = Tree::new("link");
|
|
232
251
|
assert_eq!(
|
|
233
252
|
answer(walk, &tree.dir(), "a/link/c"),
|