kobako 0.28.0 → 0.30.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/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +377 -0
- data/Cargo.lock +181 -154
- data/README.md +99 -459
- data/ROADMAP.md +7 -1
- data/SECURITY.md +1 -1
- data/crates/kobako-runtime/CHANGELOG.md +354 -0
- data/crates/kobako-runtime/Cargo.toml +38 -7
- data/crates/kobako-runtime/README.md +17 -8
- data/crates/kobako-runtime/src/dispatch.rs +9 -1
- data/crates/kobako-runtime/src/endpoint/buffer.rs +192 -0
- data/crates/kobako-runtime/src/endpoint/capture.rs +115 -0
- data/crates/kobako-runtime/src/endpoint/dispatch.rs +253 -0
- data/crates/kobako-runtime/src/endpoint/invoke.rs +194 -0
- data/crates/kobako-runtime/src/endpoint/memory_cap.rs +238 -0
- data/crates/kobako-runtime/src/endpoint.rs +166 -0
- data/crates/kobako-runtime/src/filesystem/bind/fid.rs +82 -0
- data/crates/kobako-runtime/src/filesystem/bind/lookup.rs +236 -0
- data/crates/kobako-runtime/src/filesystem/bind/walk.rs +249 -0
- data/crates/kobako-runtime/src/filesystem/bind.rs +2665 -0
- data/crates/kobako-runtime/src/filesystem/overlay/file.rs +89 -0
- data/crates/kobako-runtime/src/filesystem/overlay/inode.rs +106 -0
- data/crates/kobako-runtime/src/filesystem/overlay/path.rs +285 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs +135 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/dir.rs +263 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/namei.rs +135 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/readdir.rs +57 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack.rs +301 -0
- data/crates/kobako-runtime/src/filesystem/overlay.rs +3469 -0
- data/crates/kobako-runtime/src/filesystem/path.rs +21 -0
- data/crates/kobako-runtime/src/filesystem/pipe.rs +221 -0
- data/crates/kobako-runtime/src/filesystem/rdir.rs +101 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/tmpfile.rs +32 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/whiteout.rs +85 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/xattr.rs +22 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs.rs +1985 -0
- data/crates/kobako-runtime/src/filesystem/wrap.rs +224 -0
- data/crates/kobako-runtime/src/filesystem.rs +26 -0
- data/crates/kobako-runtime/src/grant.rs +20 -0
- data/crates/kobako-runtime/src/hashtable.rs +44 -0
- data/crates/kobako-runtime/src/lib.rs +16 -1
- data/crates/kobako-runtime/src/locking/seqlock.rs +66 -0
- data/crates/kobako-runtime/src/locking.rs +218 -0
- data/crates/kobako-runtime/src/mount.rs +105 -0
- data/crates/kobako-runtime/src/profile.rs +140 -4
- data/crates/kobako-runtime/src/runtime.rs +12 -0
- data/crates/kobako-runtime/src/sched.rs +210 -0
- data/crates/kobako-runtime/src/security.rs +696 -0
- data/crates/kobako-runtime/src/snapshot.rs +20 -5
- data/crates/kobako-runtime/src/vfs/attr.rs +162 -0
- data/crates/kobako-runtime/src/vfs/cred.rs +334 -0
- data/crates/kobako-runtime/src/vfs/dentry.rs +1412 -0
- data/crates/kobako-runtime/src/vfs/errno.rs +153 -0
- data/crates/kobako-runtime/src/vfs/file.rs +1915 -0
- data/crates/kobako-runtime/src/vfs/inode.rs +429 -0
- data/crates/kobako-runtime/src/vfs/kern_path.rs +217 -0
- data/crates/kobako-runtime/src/vfs/mount.rs +59 -0
- data/crates/kobako-runtime/src/vfs/namei.rs +5708 -0
- data/crates/kobako-runtime/src/vfs/openat2.rs +116 -0
- data/crates/kobako-runtime/src/vfs/path.rs +64 -0
- data/crates/kobako-runtime/src/vfs/readdir.rs +163 -0
- data/crates/kobako-runtime/src/vfs/stat.rs +157 -0
- data/crates/kobako-runtime/src/vfs/super_block.rs +122 -0
- data/crates/kobako-runtime/src/vfs/utimes.rs +289 -0
- data/crates/kobako-runtime/src/vfs.rs +60 -0
- data/crates/kobako-runtime/src/yielder.rs +11 -6
- data/crates/kobako-runtime/tests/linux_baseline/calls.rs +171 -0
- data/crates/kobako-runtime/tests/linux_baseline/concurrent.rs +276 -0
- data/crates/kobako-runtime/tests/linux_baseline/kobako.rs +323 -0
- data/crates/kobako-runtime/tests/linux_baseline/linux-baseline-expected.txt +16 -0
- data/crates/kobako-runtime/tests/linux_baseline/linux.rs +449 -0
- data/crates/kobako-runtime/tests/linux_baseline/main.rs +611 -0
- data/crates/kobako-runtime/tests/linux_baseline/permissions.rs +236 -0
- data/crates/kobako-transport/CHANGELOG.md +23 -0
- data/crates/kobako-transport/Cargo.toml +3 -3
- data/crates/kobako-transport/README.md +6 -5
- data/crates/kobako-transport/src/abi.rs +1 -1
- data/crates/kobako-transport/src/envelope/bytes.rs +33 -25
- data/crates/kobako-transport/src/envelope/call.rs +5 -5
- data/crates/kobako-transport/src/envelope/compile_reply.rs +2 -2
- data/crates/kobako-transport/src/envelope/error_record.rs +3 -3
- data/crates/kobako-transport/src/envelope/fault.rs +4 -3
- data/crates/kobako-transport/src/envelope/outcome.rs +3 -3
- data/crates/kobako-transport/src/envelope/preamble.rs +24 -24
- data/crates/kobako-transport/src/envelope/reply.rs +34 -16
- data/crates/kobako-transport/src/envelope/request.rs +19 -9
- data/crates/kobako-transport/src/envelope/run.rs +1 -1
- data/crates/kobako-transport/src/envelope/unsupported.rs +2 -2
- data/crates/kobako-transport/src/envelope.rs +2 -2
- data/crates/kobako-wasmtime/CHANGELOG.md +265 -0
- data/crates/kobako-wasmtime/Cargo.toml +25 -19
- data/crates/kobako-wasmtime/README.md +13 -7
- data/crates/kobako-wasmtime/src/abi.rs +75 -49
- data/crates/kobako-wasmtime/src/ambient.rs +64 -6
- data/crates/kobako-wasmtime/src/cache.rs +188 -77
- data/crates/kobako-wasmtime/src/config.rs +77 -5
- data/crates/kobako-wasmtime/src/descriptors.rs +200 -0
- data/crates/kobako-wasmtime/src/driver.rs +70 -135
- data/crates/kobako-wasmtime/src/exports.rs +5 -16
- data/crates/kobako-wasmtime/src/guest.rs +38 -0
- data/crates/kobako-wasmtime/src/imports.rs +52 -0
- data/crates/kobako-wasmtime/src/instance_pre.rs +18 -46
- data/crates/kobako-wasmtime/src/invocation.rs +43 -74
- data/crates/kobako-wasmtime/src/lib.rs +5 -4
- data/crates/kobako-wasmtime/src/limiter.rs +6 -230
- data/crates/kobako-wasmtime/src/preview1/differential/mount.rs +632 -0
- data/crates/kobako-wasmtime/src/preview1/differential.rs +486 -0
- data/crates/kobako-wasmtime/src/preview1/errno.rs +135 -0
- data/crates/kobako-wasmtime/src/preview1/fd.rs +1420 -0
- data/crates/kobako-wasmtime/src/preview1/memory.rs +172 -0
- data/crates/kobako-wasmtime/src/preview1/mount_view/wrap.rs +211 -0
- data/crates/kobako-wasmtime/src/preview1/mount_view.rs +3766 -0
- data/crates/kobako-wasmtime/src/preview1/path.rs +302 -0
- data/crates/kobako-wasmtime/src/preview1/poll.rs +381 -0
- data/crates/kobako-wasmtime/src/preview1/sock.rs +13 -0
- data/crates/kobako-wasmtime/src/preview1/testsuite-expected.txt +6 -0
- data/crates/kobako-wasmtime/src/preview1/testsuite.rs +157 -0
- data/crates/kobako-wasmtime/src/preview1.rs +512 -0
- data/crates/kobako-wasmtime/src/trap.rs +45 -25
- data/crates/kobako-wasmtime/src/wasi.rs +333 -0
- data/crates/kobako-wasmtime/tests/integration/compile_posture.rs +43 -0
- data/crates/kobako-wasmtime/tests/integration/guest_file.rs +1085 -0
- data/crates/kobako-wasmtime/tests/integration/main.rs +29 -0
- data/crates/kobako-wasmtime/tests/{preamble_flags.rs → integration/preamble_flags.rs} +4 -3
- data/crates/kobako-wasmtime/tests/{snippet_compile.rs → integration/snippet_compile.rs} +5 -4
- data/crates/kobako-wasmtime/tests/{support → integration/support}/mod.rs +9 -13
- data/crates/kobako-wasmtime/tests/integration/unanswered_call.rs +86 -0
- data/crates/kobako-wasmtime/tests/{unsupported_call.rs → integration/unsupported_call.rs} +2 -1
- data/crates/kobako-wasmtime/witx/typenames.witx +750 -0
- data/crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx +441 -0
- data/data/kobako.wasm +0 -0
- data/ext/kobako/Cargo.toml +4 -2
- data/ext/kobako/src/runtime/bridge.rs +154 -81
- data/ext/kobako/src/runtime/errors.rs +1 -1
- data/ext/kobako/src/runtime/escape.rs +67 -0
- data/ext/kobako/src/runtime/filesystem/grants.rs +107 -0
- data/ext/kobako/src/runtime/filesystem/ruby.rs +708 -0
- data/ext/kobako/src/runtime/filesystem.rs +208 -0
- data/ext/kobako/src/runtime/gvl.rs +49 -8
- data/ext/kobako/src/runtime/pinned_value.rs +31 -0
- data/ext/kobako/src/runtime/snapshot.rs +127 -0
- data/ext/kobako/src/runtime.rs +125 -199
- data/lib/kobako/catalog/extensions.rb +5 -5
- data/lib/kobako/catalog/flags.rb +2 -14
- data/lib/kobako/catalog/grants.rb +30 -0
- data/lib/kobako/catalog/handles.rb +6 -6
- data/lib/kobako/catalog/mount.rb +19 -0
- data/lib/kobako/catalog/services.rb +13 -2
- data/lib/kobako/catalog/snippets.rb +11 -15
- data/lib/kobako/catalog.rb +11 -0
- data/lib/kobako/codec/decoder.rb +10 -9
- data/lib/kobako/codec/ext_types.rb +4 -6
- data/lib/kobako/codec/handle_walk.rb +4 -6
- data/lib/kobako/codec/nesting.rb +7 -7
- data/lib/kobako/codec/state.rb +19 -3
- data/lib/kobako/codec/utils.rb +1 -1
- data/lib/kobako/codec/value_budget.rb +86 -0
- data/lib/kobako/codec.rb +7 -0
- data/lib/kobako/context.rb +40 -13
- data/lib/kobako/errors.rb +15 -14
- data/lib/kobako/filesystem.rb +69 -0
- data/lib/kobako/payload/arguments.rb +2 -2
- data/lib/kobako/pool.rb +6 -6
- data/lib/kobako/sandbox.rb +55 -27
- data/lib/kobako/sandbox_options.rb +39 -13
- data/lib/kobako/snippet/{binary.rb → bytecode.rb} +2 -2
- data/lib/kobako/snippet/source.rb +1 -1
- data/lib/kobako/snippet.rb +1 -1
- data/lib/kobako/transport/block_failure.rb +35 -0
- data/lib/kobako/transport/dispatcher.rb +33 -29
- data/lib/kobako/transport/exposure.rb +7 -9
- data/lib/kobako/transport/reflection.rb +79 -23
- data/lib/kobako/transport/run.rb +5 -5
- data/lib/kobako/transport/yielder.rb +9 -31
- data/lib/kobako/transport.rb +1 -0
- data/lib/kobako/version.rb +1 -1
- data/lib/kobako.rb +35 -0
- data/release-please-config.json +1 -0
- data/sig/kobako/catalog/extensions.rbs +3 -3
- data/sig/kobako/catalog/flags.rbs +0 -4
- data/sig/kobako/catalog/grants.rbs +13 -0
- data/sig/kobako/catalog/handles.rbs +3 -3
- data/sig/kobako/catalog/mount.rbs +24 -0
- data/sig/kobako/catalog/services.rbs +5 -1
- data/sig/kobako/catalog/snippets.rbs +4 -4
- data/sig/kobako/catalog.rbs +1 -0
- data/sig/kobako/codec/decoder.rbs +1 -1
- data/sig/kobako/codec/handle_walk.rbs +1 -1
- data/sig/kobako/codec/nesting.rbs +2 -2
- data/sig/kobako/codec/state.rbs +7 -1
- data/sig/kobako/codec/utils.rbs +1 -1
- data/sig/kobako/codec/value_budget.rbs +23 -0
- data/sig/kobako/codec.rbs +3 -2
- data/sig/kobako/context.rbs +14 -6
- data/sig/kobako/errors.rbs +4 -4
- data/sig/kobako/filesystem.rbs +93 -0
- data/sig/kobako/guest_yielder.rbs +9 -0
- data/sig/kobako/payload/arguments.rbs +1 -1
- data/sig/kobako/pool.rbs +3 -3
- data/sig/kobako/runtime.rbs +21 -49
- data/sig/kobako/sandbox.rbs +9 -5
- data/sig/kobako/sandbox_options.rbs +25 -3
- data/sig/kobako/snapshot.rbs +20 -0
- data/sig/kobako/snippet/bytecode.rbs +12 -0
- data/sig/kobako/transport/block_failure.rbs +13 -0
- data/sig/kobako/transport/dispatcher.rbs +4 -4
- data/sig/kobako/transport/exposure.rbs +2 -2
- data/sig/kobako/transport/reflection.rbs +14 -1
- data/sig/kobako/transport/run.rbs +3 -3
- data/sig/kobako/transport/yielder.rbs +3 -7
- data/sig/kobako/transport.rbs +3 -3
- metadata +116 -15
- data/crates/kobako-wasmtime/src/capture.rs +0 -96
- data/crates/kobako-wasmtime/src/dispatch.rs +0 -107
- data/crates/kobako-wasmtime/src/guest_mem.rs +0 -265
- data/crates/kobako-wasmtime/src/io.rs +0 -286
- data/sig/kobako/snippet/binary.rbs +0 -12
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kobako
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.30.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aotokitsuruya
|
|
@@ -13,16 +13,22 @@ dependencies:
|
|
|
13
13
|
name: msgpack
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 1.8.2
|
|
19
|
+
- - "<"
|
|
17
20
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
21
|
+
version: '2'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
25
|
requirements:
|
|
23
|
-
- - "
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 1.8.2
|
|
29
|
+
- - "<"
|
|
24
30
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
31
|
+
version: '2'
|
|
26
32
|
- !ruby/object:Gem::Dependency
|
|
27
33
|
name: rb_sys
|
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,12 +65,70 @@ files:
|
|
|
59
65
|
- crates/kobako-runtime/Cargo.toml
|
|
60
66
|
- crates/kobako-runtime/README.md
|
|
61
67
|
- crates/kobako-runtime/src/dispatch.rs
|
|
68
|
+
- crates/kobako-runtime/src/endpoint.rs
|
|
69
|
+
- crates/kobako-runtime/src/endpoint/buffer.rs
|
|
70
|
+
- crates/kobako-runtime/src/endpoint/capture.rs
|
|
71
|
+
- crates/kobako-runtime/src/endpoint/dispatch.rs
|
|
72
|
+
- crates/kobako-runtime/src/endpoint/invoke.rs
|
|
73
|
+
- crates/kobako-runtime/src/endpoint/memory_cap.rs
|
|
62
74
|
- crates/kobako-runtime/src/error.rs
|
|
75
|
+
- crates/kobako-runtime/src/filesystem.rs
|
|
76
|
+
- crates/kobako-runtime/src/filesystem/bind.rs
|
|
77
|
+
- crates/kobako-runtime/src/filesystem/bind/fid.rs
|
|
78
|
+
- crates/kobako-runtime/src/filesystem/bind/lookup.rs
|
|
79
|
+
- crates/kobako-runtime/src/filesystem/bind/walk.rs
|
|
80
|
+
- crates/kobako-runtime/src/filesystem/overlay.rs
|
|
81
|
+
- crates/kobako-runtime/src/filesystem/overlay/file.rs
|
|
82
|
+
- crates/kobako-runtime/src/filesystem/overlay/inode.rs
|
|
83
|
+
- crates/kobako-runtime/src/filesystem/overlay/path.rs
|
|
84
|
+
- crates/kobako-runtime/src/filesystem/overlay/stack.rs
|
|
85
|
+
- crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs
|
|
86
|
+
- crates/kobako-runtime/src/filesystem/overlay/stack/dir.rs
|
|
87
|
+
- crates/kobako-runtime/src/filesystem/overlay/stack/namei.rs
|
|
88
|
+
- crates/kobako-runtime/src/filesystem/overlay/stack/readdir.rs
|
|
89
|
+
- crates/kobako-runtime/src/filesystem/path.rs
|
|
90
|
+
- crates/kobako-runtime/src/filesystem/pipe.rs
|
|
91
|
+
- crates/kobako-runtime/src/filesystem/rdir.rs
|
|
92
|
+
- crates/kobako-runtime/src/filesystem/tmpfs.rs
|
|
93
|
+
- crates/kobako-runtime/src/filesystem/tmpfs/tmpfile.rs
|
|
94
|
+
- crates/kobako-runtime/src/filesystem/tmpfs/whiteout.rs
|
|
95
|
+
- crates/kobako-runtime/src/filesystem/tmpfs/xattr.rs
|
|
96
|
+
- crates/kobako-runtime/src/filesystem/wrap.rs
|
|
97
|
+
- crates/kobako-runtime/src/grant.rs
|
|
98
|
+
- crates/kobako-runtime/src/hashtable.rs
|
|
63
99
|
- crates/kobako-runtime/src/lib.rs
|
|
100
|
+
- crates/kobako-runtime/src/locking.rs
|
|
101
|
+
- crates/kobako-runtime/src/locking/seqlock.rs
|
|
102
|
+
- crates/kobako-runtime/src/mount.rs
|
|
64
103
|
- crates/kobako-runtime/src/profile.rs
|
|
65
104
|
- crates/kobako-runtime/src/runtime.rs
|
|
105
|
+
- crates/kobako-runtime/src/sched.rs
|
|
106
|
+
- crates/kobako-runtime/src/security.rs
|
|
66
107
|
- crates/kobako-runtime/src/snapshot.rs
|
|
108
|
+
- crates/kobako-runtime/src/vfs.rs
|
|
109
|
+
- crates/kobako-runtime/src/vfs/attr.rs
|
|
110
|
+
- crates/kobako-runtime/src/vfs/cred.rs
|
|
111
|
+
- crates/kobako-runtime/src/vfs/dentry.rs
|
|
112
|
+
- crates/kobako-runtime/src/vfs/errno.rs
|
|
113
|
+
- crates/kobako-runtime/src/vfs/file.rs
|
|
114
|
+
- crates/kobako-runtime/src/vfs/inode.rs
|
|
115
|
+
- crates/kobako-runtime/src/vfs/kern_path.rs
|
|
116
|
+
- crates/kobako-runtime/src/vfs/mount.rs
|
|
117
|
+
- crates/kobako-runtime/src/vfs/namei.rs
|
|
118
|
+
- crates/kobako-runtime/src/vfs/openat2.rs
|
|
119
|
+
- crates/kobako-runtime/src/vfs/path.rs
|
|
120
|
+
- crates/kobako-runtime/src/vfs/readdir.rs
|
|
121
|
+
- crates/kobako-runtime/src/vfs/stat.rs
|
|
122
|
+
- crates/kobako-runtime/src/vfs/super_block.rs
|
|
123
|
+
- crates/kobako-runtime/src/vfs/utimes.rs
|
|
67
124
|
- crates/kobako-runtime/src/yielder.rs
|
|
125
|
+
- crates/kobako-runtime/tests/linux_baseline/calls.rs
|
|
126
|
+
- crates/kobako-runtime/tests/linux_baseline/concurrent.rs
|
|
127
|
+
- crates/kobako-runtime/tests/linux_baseline/kobako.rs
|
|
128
|
+
- crates/kobako-runtime/tests/linux_baseline/linux-baseline-expected.txt
|
|
129
|
+
- crates/kobako-runtime/tests/linux_baseline/linux.rs
|
|
130
|
+
- crates/kobako-runtime/tests/linux_baseline/main.rs
|
|
131
|
+
- crates/kobako-runtime/tests/linux_baseline/permissions.rs
|
|
68
132
|
- crates/kobako-transport/CHANGELOG.md
|
|
69
133
|
- crates/kobako-transport/Cargo.toml
|
|
70
134
|
- crates/kobako-transport/README.md
|
|
@@ -89,22 +153,41 @@ files:
|
|
|
89
153
|
- crates/kobako-wasmtime/src/abi.rs
|
|
90
154
|
- crates/kobako-wasmtime/src/ambient.rs
|
|
91
155
|
- crates/kobako-wasmtime/src/cache.rs
|
|
92
|
-
- crates/kobako-wasmtime/src/capture.rs
|
|
93
156
|
- crates/kobako-wasmtime/src/config.rs
|
|
94
|
-
- crates/kobako-wasmtime/src/
|
|
157
|
+
- crates/kobako-wasmtime/src/descriptors.rs
|
|
95
158
|
- crates/kobako-wasmtime/src/driver.rs
|
|
96
159
|
- crates/kobako-wasmtime/src/exports.rs
|
|
97
|
-
- crates/kobako-wasmtime/src/
|
|
160
|
+
- crates/kobako-wasmtime/src/guest.rs
|
|
161
|
+
- crates/kobako-wasmtime/src/imports.rs
|
|
98
162
|
- crates/kobako-wasmtime/src/instance_pre.rs
|
|
99
163
|
- crates/kobako-wasmtime/src/invocation.rs
|
|
100
|
-
- crates/kobako-wasmtime/src/io.rs
|
|
101
164
|
- crates/kobako-wasmtime/src/lib.rs
|
|
102
165
|
- crates/kobako-wasmtime/src/limiter.rs
|
|
166
|
+
- crates/kobako-wasmtime/src/preview1.rs
|
|
167
|
+
- crates/kobako-wasmtime/src/preview1/differential.rs
|
|
168
|
+
- crates/kobako-wasmtime/src/preview1/differential/mount.rs
|
|
169
|
+
- crates/kobako-wasmtime/src/preview1/errno.rs
|
|
170
|
+
- crates/kobako-wasmtime/src/preview1/fd.rs
|
|
171
|
+
- crates/kobako-wasmtime/src/preview1/memory.rs
|
|
172
|
+
- crates/kobako-wasmtime/src/preview1/mount_view.rs
|
|
173
|
+
- crates/kobako-wasmtime/src/preview1/mount_view/wrap.rs
|
|
174
|
+
- crates/kobako-wasmtime/src/preview1/path.rs
|
|
175
|
+
- crates/kobako-wasmtime/src/preview1/poll.rs
|
|
176
|
+
- crates/kobako-wasmtime/src/preview1/sock.rs
|
|
177
|
+
- crates/kobako-wasmtime/src/preview1/testsuite-expected.txt
|
|
178
|
+
- crates/kobako-wasmtime/src/preview1/testsuite.rs
|
|
103
179
|
- crates/kobako-wasmtime/src/trap.rs
|
|
104
|
-
- crates/kobako-wasmtime/
|
|
105
|
-
- crates/kobako-wasmtime/tests/
|
|
106
|
-
- crates/kobako-wasmtime/tests/
|
|
107
|
-
- crates/kobako-wasmtime/tests/
|
|
180
|
+
- crates/kobako-wasmtime/src/wasi.rs
|
|
181
|
+
- crates/kobako-wasmtime/tests/integration/compile_posture.rs
|
|
182
|
+
- crates/kobako-wasmtime/tests/integration/guest_file.rs
|
|
183
|
+
- crates/kobako-wasmtime/tests/integration/main.rs
|
|
184
|
+
- crates/kobako-wasmtime/tests/integration/preamble_flags.rs
|
|
185
|
+
- crates/kobako-wasmtime/tests/integration/snippet_compile.rs
|
|
186
|
+
- crates/kobako-wasmtime/tests/integration/support/mod.rs
|
|
187
|
+
- crates/kobako-wasmtime/tests/integration/unanswered_call.rs
|
|
188
|
+
- crates/kobako-wasmtime/tests/integration/unsupported_call.rs
|
|
189
|
+
- crates/kobako-wasmtime/witx/typenames.witx
|
|
190
|
+
- crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx
|
|
108
191
|
- data/kobako.wasm
|
|
109
192
|
- ext/kobako/Cargo.toml
|
|
110
193
|
- ext/kobako/extconf.rb
|
|
@@ -112,13 +195,21 @@ files:
|
|
|
112
195
|
- ext/kobako/src/runtime.rs
|
|
113
196
|
- ext/kobako/src/runtime/bridge.rs
|
|
114
197
|
- ext/kobako/src/runtime/errors.rs
|
|
198
|
+
- ext/kobako/src/runtime/escape.rs
|
|
199
|
+
- ext/kobako/src/runtime/filesystem.rs
|
|
200
|
+
- ext/kobako/src/runtime/filesystem/grants.rs
|
|
201
|
+
- ext/kobako/src/runtime/filesystem/ruby.rs
|
|
115
202
|
- ext/kobako/src/runtime/gvl.rs
|
|
203
|
+
- ext/kobako/src/runtime/pinned_value.rs
|
|
204
|
+
- ext/kobako/src/runtime/snapshot.rs
|
|
116
205
|
- lib/kobako.rb
|
|
117
206
|
- lib/kobako/capture.rb
|
|
118
207
|
- lib/kobako/catalog.rb
|
|
119
208
|
- lib/kobako/catalog/extensions.rb
|
|
120
209
|
- lib/kobako/catalog/flags.rb
|
|
210
|
+
- lib/kobako/catalog/grants.rb
|
|
121
211
|
- lib/kobako/catalog/handles.rb
|
|
212
|
+
- lib/kobako/catalog/mount.rb
|
|
122
213
|
- lib/kobako/catalog/services.rb
|
|
123
214
|
- lib/kobako/catalog/snippets.rb
|
|
124
215
|
- lib/kobako/codec.rb
|
|
@@ -130,11 +221,13 @@ files:
|
|
|
130
221
|
- lib/kobako/codec/nesting.rb
|
|
131
222
|
- lib/kobako/codec/state.rb
|
|
132
223
|
- lib/kobako/codec/utils.rb
|
|
224
|
+
- lib/kobako/codec/value_budget.rb
|
|
133
225
|
- lib/kobako/constant_name.rb
|
|
134
226
|
- lib/kobako/context.rb
|
|
135
227
|
- lib/kobako/errors.rb
|
|
136
228
|
- lib/kobako/execution.rb
|
|
137
229
|
- lib/kobako/extension.rb
|
|
230
|
+
- lib/kobako/filesystem.rb
|
|
138
231
|
- lib/kobako/handle.rb
|
|
139
232
|
- lib/kobako/outcome.rb
|
|
140
233
|
- lib/kobako/payload.rb
|
|
@@ -144,9 +237,10 @@ files:
|
|
|
144
237
|
- lib/kobako/sandbox.rb
|
|
145
238
|
- lib/kobako/sandbox_options.rb
|
|
146
239
|
- lib/kobako/snippet.rb
|
|
147
|
-
- lib/kobako/snippet/
|
|
240
|
+
- lib/kobako/snippet/bytecode.rb
|
|
148
241
|
- lib/kobako/snippet/source.rb
|
|
149
242
|
- lib/kobako/transport.rb
|
|
243
|
+
- lib/kobako/transport/block_failure.rb
|
|
150
244
|
- lib/kobako/transport/call.rb
|
|
151
245
|
- lib/kobako/transport/dispatcher.rb
|
|
152
246
|
- lib/kobako/transport/error.rb
|
|
@@ -163,7 +257,9 @@ files:
|
|
|
163
257
|
- sig/kobako/catalog.rbs
|
|
164
258
|
- sig/kobako/catalog/extensions.rbs
|
|
165
259
|
- sig/kobako/catalog/flags.rbs
|
|
260
|
+
- sig/kobako/catalog/grants.rbs
|
|
166
261
|
- sig/kobako/catalog/handles.rbs
|
|
262
|
+
- sig/kobako/catalog/mount.rbs
|
|
167
263
|
- sig/kobako/catalog/services.rbs
|
|
168
264
|
- sig/kobako/catalog/snippets.rbs
|
|
169
265
|
- sig/kobako/codec.rbs
|
|
@@ -175,11 +271,14 @@ files:
|
|
|
175
271
|
- sig/kobako/codec/nesting.rbs
|
|
176
272
|
- sig/kobako/codec/state.rbs
|
|
177
273
|
- sig/kobako/codec/utils.rbs
|
|
274
|
+
- sig/kobako/codec/value_budget.rbs
|
|
178
275
|
- sig/kobako/constant_name.rbs
|
|
179
276
|
- sig/kobako/context.rbs
|
|
180
277
|
- sig/kobako/errors.rbs
|
|
181
278
|
- sig/kobako/execution.rbs
|
|
182
279
|
- sig/kobako/extension.rbs
|
|
280
|
+
- sig/kobako/filesystem.rbs
|
|
281
|
+
- sig/kobako/guest_yielder.rbs
|
|
183
282
|
- sig/kobako/handle.rbs
|
|
184
283
|
- sig/kobako/outcome.rbs
|
|
185
284
|
- sig/kobako/payload.rbs
|
|
@@ -188,10 +287,12 @@ files:
|
|
|
188
287
|
- sig/kobako/runtime.rbs
|
|
189
288
|
- sig/kobako/sandbox.rbs
|
|
190
289
|
- sig/kobako/sandbox_options.rbs
|
|
290
|
+
- sig/kobako/snapshot.rbs
|
|
191
291
|
- sig/kobako/snippet.rbs
|
|
192
|
-
- sig/kobako/snippet/
|
|
292
|
+
- sig/kobako/snippet/bytecode.rbs
|
|
193
293
|
- sig/kobako/snippet/source.rbs
|
|
194
294
|
- sig/kobako/transport.rbs
|
|
295
|
+
- sig/kobako/transport/block_failure.rbs
|
|
195
296
|
- sig/kobako/transport/call.rbs
|
|
196
297
|
- sig/kobako/transport/dispatcher.rbs
|
|
197
298
|
- sig/kobako/transport/error.rbs
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
//! Per-channel stdout / stderr capture sizing and clipping.
|
|
2
|
-
//!
|
|
3
|
-
//! Two pure helpers shared by the run path: one
|
|
4
|
-
//! sizes the per-run `MemoryOutputPipe`, the other clips a captured
|
|
5
|
-
//! snapshot back to the configured cap and reports whether the cap was
|
|
6
|
-
//! exceeded. Kept channel-agnostic (a function of `cap`, not of which
|
|
7
|
-
//! channel) so a regression that only breaks one channel cannot sneak
|
|
8
|
-
//! through the test that pins them.
|
|
9
|
-
|
|
10
|
-
/// One byte past the cap, so "wrote exactly cap" and "exceeded cap" stay
|
|
11
|
-
/// distinguishable.
|
|
12
|
-
pub(crate) fn pipe_capacity(cap: Option<usize>) -> usize {
|
|
13
|
-
match cap {
|
|
14
|
-
Some(c) => c.saturating_add(1),
|
|
15
|
-
None => usize::MAX,
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/// Takes the snapshot by value and truncates in place, so the readback
|
|
20
|
-
/// costs one copy out of the pipe rather than two.
|
|
21
|
-
pub(crate) fn clip_capture(mut raw: Vec<u8>, cap: Option<usize>) -> (Vec<u8>, bool) {
|
|
22
|
-
match cap {
|
|
23
|
-
Some(c) if raw.len() > c => {
|
|
24
|
-
raw.truncate(c);
|
|
25
|
-
(raw, true)
|
|
26
|
-
}
|
|
27
|
-
_ => (raw, false),
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
#[cfg(test)]
|
|
32
|
-
mod tests {
|
|
33
|
-
use super::{clip_capture, pipe_capacity};
|
|
34
|
-
|
|
35
|
-
// @behavior S-108
|
|
36
|
-
#[test]
|
|
37
|
-
fn pipe_capacity_adds_one_when_cap_is_set() {
|
|
38
|
-
assert_eq!(pipe_capacity(Some(5)), 6);
|
|
39
|
-
assert_eq!(pipe_capacity(Some(0)), 1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// @behavior S-109
|
|
43
|
-
#[test]
|
|
44
|
-
fn pipe_capacity_falls_back_to_usize_max_when_uncapped() {
|
|
45
|
-
assert_eq!(pipe_capacity(None), usize::MAX);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// @behavior S-110
|
|
49
|
-
#[test]
|
|
50
|
-
fn pipe_capacity_saturates_at_usize_max() {
|
|
51
|
-
assert_eq!(pipe_capacity(Some(usize::MAX)), usize::MAX);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// @behavior S-111
|
|
55
|
-
#[test]
|
|
56
|
-
fn clip_capture_returns_full_bytes_when_under_cap() {
|
|
57
|
-
let (bytes, truncated) = clip_capture(b"abc".to_vec(), Some(5));
|
|
58
|
-
assert_eq!(bytes, b"abc");
|
|
59
|
-
assert!(!truncated);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// @behavior S-112
|
|
63
|
-
#[test]
|
|
64
|
-
fn clip_capture_does_not_flag_truncation_at_exactly_cap_bytes() {
|
|
65
|
-
let (bytes, truncated) = clip_capture(b"abcde".to_vec(), Some(5));
|
|
66
|
-
assert_eq!(bytes, b"abcde");
|
|
67
|
-
assert!(!truncated);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// @behavior S-024
|
|
71
|
-
#[test]
|
|
72
|
-
fn clip_capture_clips_to_cap_and_flags_truncation_on_overflow() {
|
|
73
|
-
// The pipe is sized `cap + 1`, so the snapshot can be at most
|
|
74
|
-
// 6 bytes when `cap == 5`; that surface is what triggers the
|
|
75
|
-
// truncation flag.
|
|
76
|
-
let (bytes, truncated) = clip_capture(b"abcdef".to_vec(), Some(5));
|
|
77
|
-
assert_eq!(bytes, b"abcde");
|
|
78
|
-
assert!(truncated);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// @behavior S-033
|
|
82
|
-
#[test]
|
|
83
|
-
fn clip_capture_treats_none_as_uncapped() {
|
|
84
|
-
let (bytes, truncated) = clip_capture(b"abcdef".to_vec(), None);
|
|
85
|
-
assert_eq!(bytes, b"abcdef");
|
|
86
|
-
assert!(!truncated);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// @behavior S-100 S-101
|
|
90
|
-
#[test]
|
|
91
|
-
fn clip_capture_handles_empty_input() {
|
|
92
|
-
let (bytes, truncated) = clip_capture(Vec::new(), Some(5));
|
|
93
|
-
assert_eq!(bytes, b"");
|
|
94
|
-
assert!(!truncated);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
//! Host side of the `__kobako_upcall` import: hand the guest's Call to
|
|
2
|
-
//! the bound `DispatchHandler` and write its Reply back into guest memory.
|
|
3
|
-
//! A request under a tag the host does not serve is answered as
|
|
4
|
-
//! unsupported, so a guest asking for a later operation can fall back.
|
|
5
|
-
//!
|
|
6
|
-
//! A failure lands on whoever is answerable for it. A trap the guest
|
|
7
|
-
//! raises during a callback into it ends the invocation as that trap; any
|
|
8
|
-
//! other failure is the guest's or the wire's, so the import answers 0,
|
|
9
|
-
//! which the guest receives as a wire failure.
|
|
10
|
-
//!
|
|
11
|
-
//! Each 0 also writes one `[kobako-dispatch] <reason>` line to stderr,
|
|
12
|
-
//! since the 0 itself carries no reason. It is the one place the driver
|
|
13
|
-
//! logs, and normal operation never reaches it.
|
|
14
|
-
|
|
15
|
-
use wasmtime::Caller;
|
|
16
|
-
|
|
17
|
-
use kobako_runtime::error::Trap;
|
|
18
|
-
use kobako_runtime::yielder::Yielder;
|
|
19
|
-
use kobako_transport::abi::pack_ptr_len;
|
|
20
|
-
use kobako_transport::envelope::{Unsupported, Upcall, YieldReply};
|
|
21
|
-
|
|
22
|
-
use crate::guest_mem;
|
|
23
|
-
use crate::invocation::Invocation;
|
|
24
|
-
|
|
25
|
-
/// The wasmtime-backed `Yielder`: built per `__kobako_upcall` frame over
|
|
26
|
-
/// that frame's `Caller`, so nested dispatch frames each carry their own and
|
|
27
|
-
/// stack on the Rust call stack with no shared slot.
|
|
28
|
-
struct CallerYielder<'a, 'c> {
|
|
29
|
-
caller: &'a mut Caller<'c, Invocation>,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
impl Yielder for CallerYielder<'_, '_> {
|
|
33
|
-
fn yield_to_block(&mut self, args: &[u8]) -> Result<YieldReply, Trap> {
|
|
34
|
-
let bytes = guest_mem::drive_yield(self.caller, args)
|
|
35
|
-
.map_err(|msg| Trap::Other(msg.to_string()))?;
|
|
36
|
-
YieldReply::decode(&bytes).map_err(|err| Trap::Other(err.to_string()))
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/// Answer one `__kobako_upcall` call: the packed `(ptr<<32)|len` of the
|
|
41
|
-
/// Reply, 0 for a failure the guest or the wire is answerable for, or the
|
|
42
|
-
/// trap a callback into the guest raised.
|
|
43
|
-
pub(crate) fn handle(
|
|
44
|
-
caller: &mut Caller<'_, Invocation>,
|
|
45
|
-
req_ptr: i32,
|
|
46
|
-
req_len: i32,
|
|
47
|
-
) -> wasmtime::Result<i64> {
|
|
48
|
-
let answer = try_handle(caller, req_ptr, req_len);
|
|
49
|
-
if let Some(trap) = caller.data_mut().take_reentry_trap() {
|
|
50
|
-
return Err(trap);
|
|
51
|
-
}
|
|
52
|
-
Ok(answer.unwrap_or_else(|reason| {
|
|
53
|
-
eprintln!("[kobako-dispatch] {reason}");
|
|
54
|
-
0
|
|
55
|
-
}))
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
fn try_handle(
|
|
59
|
-
caller: &mut Caller<'_, Invocation>,
|
|
60
|
-
req_ptr: i32,
|
|
61
|
-
req_len: i32,
|
|
62
|
-
) -> Result<i64, &'static str> {
|
|
63
|
-
let req_bytes = guest_mem::read_request(caller, req_ptr, req_len)?;
|
|
64
|
-
// The driver decodes the core envelope, here and in `CallerYielder`, so
|
|
65
|
-
// the frontend never sees a frame; the payload inside it stays bytes
|
|
66
|
-
// the whole way through.
|
|
67
|
-
let call = match Upcall::decode(&req_bytes) {
|
|
68
|
-
Ok(Upcall::Call(call)) => call,
|
|
69
|
-
Ok(_) => {
|
|
70
|
-
let refusal = Unsupported::new("the host does not serve this request");
|
|
71
|
-
return write_reply(caller, &refusal.encode());
|
|
72
|
-
}
|
|
73
|
-
Err(_) => {
|
|
74
|
-
return Err(
|
|
75
|
-
"the guest sent a malformed Call envelope — please report this as a kobako bug",
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// `Kobako::Sandbox` always installs the dispatch handler before
|
|
81
|
-
// invoking the runtime, so reaching this branch indicates a misuse
|
|
82
|
-
// rather than a normal control path.
|
|
83
|
-
let handler = caller
|
|
84
|
-
.data()
|
|
85
|
-
.on_dispatch()
|
|
86
|
-
.ok_or("a Sandbox callback fired outside an active invocation — please report this as a kobako bug")?;
|
|
87
|
-
|
|
88
|
-
// Build a frame-scoped yielder over this Caller and hand it to the
|
|
89
|
-
// handler. The borrow ends with the block, freeing the Caller for
|
|
90
|
-
// `write_reply`; nested dispatch frames each build their own, so
|
|
91
|
-
// the LIFO re-entry lives on the Rust stack — no shared slot.
|
|
92
|
-
let reply = {
|
|
93
|
-
let mut yielder = CallerYielder { caller };
|
|
94
|
-
handler.dispatch(call, &mut yielder)
|
|
95
|
-
}
|
|
96
|
-
.ok_or(
|
|
97
|
-
"a Sandbox callback raised an exception instead of returning a fault — please report this as a kobako bug",
|
|
98
|
-
)?;
|
|
99
|
-
|
|
100
|
-
write_reply(caller, &reply.encode())
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
fn write_reply(caller: &mut Caller<'_, Invocation>, bytes: &[u8]) -> Result<i64, &'static str> {
|
|
104
|
-
let ptr = guest_mem::write_from_callback(caller, bytes)?;
|
|
105
|
-
// The write has already held the length to the payload cap.
|
|
106
|
-
Ok(pack_ptr_len(ptr, bytes.len() as u32) as i64)
|
|
107
|
-
}
|