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.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.githooks/linux-tests.sh +29 -0
  3. data/.release-please-manifest.json +1 -1
  4. data/CHANGELOG.md +125 -0
  5. data/Cargo.lock +457 -494
  6. data/README.md +2 -3
  7. data/ROADMAP.md +0 -1
  8. data/crates/kobako-runtime/CHANGELOG.md +90 -0
  9. data/crates/kobako-runtime/Cargo.toml +14 -15
  10. data/crates/kobako-runtime/README.md +1 -1
  11. data/crates/kobako-runtime/src/cred.rs +32 -20
  12. data/crates/kobako-runtime/src/filesystem/bind/fid.rs +300 -22
  13. data/crates/kobako-runtime/src/filesystem/bind/lookup.rs +56 -22
  14. data/crates/kobako-runtime/src/filesystem/bind/unicode.rs +109 -0
  15. data/crates/kobako-runtime/src/filesystem/bind/walk.rs +33 -14
  16. data/crates/kobako-runtime/src/filesystem/bind.rs +393 -220
  17. data/crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs +2 -0
  18. data/crates/kobako-runtime/src/filesystem/overlay/stack.rs +9 -10
  19. data/crates/kobako-runtime/src/filesystem/overlay.rs +277 -46
  20. data/crates/kobako-runtime/src/filesystem/rdir.rs +8 -27
  21. data/crates/kobako-runtime/src/filesystem/testing.rs +31 -0
  22. data/crates/kobako-runtime/src/filesystem/tmpfs.rs +47 -13
  23. data/crates/kobako-runtime/src/filesystem.rs +2 -0
  24. data/crates/kobako-runtime/src/fork.rs +239 -16
  25. data/crates/kobako-runtime/src/limits.rs +17 -41
  26. data/crates/kobako-runtime/src/locking/seqlock.rs +29 -3
  27. data/crates/kobako-runtime/src/locking.rs +508 -113
  28. data/crates/kobako-runtime/src/memcg.rs +83 -160
  29. data/crates/kobako-runtime/src/mount.rs +0 -30
  30. data/crates/kobako-runtime/src/net/connections.rs +53 -13
  31. data/crates/kobako-runtime/src/net/egress.rs +44 -24
  32. data/crates/kobako-runtime/src/net/http.rs +888 -456
  33. data/crates/kobako-runtime/src/net/lookup.rs +150 -50
  34. data/crates/kobako-runtime/src/net/namespace.rs +97 -95
  35. data/crates/kobako-runtime/src/net/reactor.rs +298 -203
  36. data/crates/kobako-runtime/src/net/resolv/darwin.rs +8 -3
  37. data/crates/kobako-runtime/src/net/resolv/stub/tests.rs +50 -0
  38. data/crates/kobako-runtime/src/net/resolv/stub.rs +29 -23
  39. data/crates/kobako-runtime/src/net/resolv/windows.rs +14 -44
  40. data/crates/kobako-runtime/src/net/resolv.rs +39 -15
  41. data/crates/kobako-runtime/src/net/skbuff.rs +109 -0
  42. data/crates/kobako-runtime/src/net/socket.rs +51 -52
  43. data/crates/kobako-runtime/src/net/task.rs +223 -0
  44. data/crates/kobako-runtime/src/net/tcp.rs +410 -158
  45. data/crates/kobako-runtime/src/net/tls.rs +65 -3
  46. data/crates/kobako-runtime/src/net/transport.rs +72 -47
  47. data/crates/kobako-runtime/src/net/udp.rs +231 -129
  48. data/crates/kobako-runtime/src/net.rs +3 -0
  49. data/crates/kobako-runtime/src/sched.rs +244 -58
  50. data/crates/kobako-runtime/src/security.rs +27 -16
  51. data/crates/kobako-runtime/src/vfs/dentry.rs +80 -41
  52. data/crates/kobako-runtime/src/vfs/file.rs +52 -53
  53. data/crates/kobako-runtime/src/vfs/kern_path.rs +24 -11
  54. data/crates/kobako-runtime/src/vfs/namei.rs +399 -184
  55. data/crates/kobako-runtime/src/vfs/namespace.rs +123 -40
  56. data/crates/kobako-runtime/src/vfs/stat.rs +105 -16
  57. data/crates/kobako-runtime/src/vfs.rs +1 -0
  58. data/crates/kobako-runtime/src/wait.rs +75 -50
  59. data/crates/kobako-transport/CHANGELOG.md +7 -0
  60. data/crates/kobako-transport/Cargo.toml +1 -1
  61. data/crates/kobako-transport/README.md +1 -1
  62. data/crates/kobako-wasmtime/CHANGELOG.md +47 -0
  63. data/crates/kobako-wasmtime/Cargo.toml +27 -6
  64. data/crates/kobako-wasmtime/README.md +3 -3
  65. data/crates/kobako-wasmtime/src/abi.rs +2 -1
  66. data/crates/kobako-wasmtime/src/ambient.rs +11 -2
  67. data/crates/kobako-wasmtime/src/cache/unix.rs +95 -0
  68. data/crates/kobako-wasmtime/src/cache/windows.rs +359 -0
  69. data/crates/kobako-wasmtime/src/cache.rs +88 -103
  70. data/crates/kobako-wasmtime/src/driver.rs +40 -27
  71. data/crates/kobako-wasmtime/src/invocation.rs +21 -7
  72. data/crates/kobako-wasmtime/src/lib.rs +2 -0
  73. data/crates/kobako-wasmtime/src/limiter.rs +78 -25
  74. data/crates/kobako-wasmtime/src/preview1/descriptors.rs +13 -17
  75. data/crates/kobako-wasmtime/src/preview1/differential/mount.rs +4 -5
  76. data/crates/kobako-wasmtime/src/preview1/differential.rs +1 -1
  77. data/crates/kobako-wasmtime/src/preview1/fd.rs +23 -19
  78. data/crates/kobako-wasmtime/src/preview1/mount_view.rs +130 -197
  79. data/crates/kobako-wasmtime/src/preview1/path.rs +3 -3
  80. data/crates/kobako-wasmtime/src/preview1/poll.rs +28 -22
  81. data/crates/kobako-wasmtime/src/preview1/random.rs +125 -0
  82. data/crates/kobako-wasmtime/src/preview1/testing.rs +31 -0
  83. data/crates/kobako-wasmtime/src/preview1.rs +85 -9
  84. data/crates/kobako-wasmtime/src/preview2/filesystem.rs +2 -2
  85. data/crates/kobako-wasmtime/src/preview2/host.rs +609 -249
  86. data/crates/kobako-wasmtime/src/preview2/http.rs +299 -215
  87. data/crates/kobako-wasmtime/src/preview2/io.rs +17 -4
  88. data/crates/kobako-wasmtime/src/preview2/table.rs +24 -72
  89. data/crates/kobako-wasmtime/src/trap.rs +68 -23
  90. data/crates/kobako-wasmtime/src/waits.rs +59 -0
  91. data/crates/kobako-wasmtime/src/wasi.rs +91 -10
  92. data/crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx +13 -0
  93. data/data/kobako.wasm +0 -0
  94. data/ext/kobako/Cargo.toml +6 -2
  95. data/ext/kobako/src/escape.rs +332 -26
  96. data/ext/kobako/src/filesystem/grants.rs +5 -7
  97. data/ext/kobako/src/filesystem/ruby.rs +10 -3
  98. data/ext/kobako/src/filesystem.rs +47 -8
  99. data/ext/kobako/src/fork.rs +72 -0
  100. data/ext/kobako/src/gvl.rs +499 -76
  101. data/ext/kobako/src/handoff.rs +490 -0
  102. data/ext/kobako/src/lib.rs +10 -0
  103. data/ext/kobako/src/network.rs +5 -3
  104. data/ext/kobako/src/pinned_value.rs +28 -15
  105. data/ext/kobako/src/runtime/bridge.rs +32 -25
  106. data/ext/kobako/src/runtime.rs +74 -43
  107. data/lib/kobako/catalog/handles.rb +9 -5
  108. data/lib/kobako/codec/decoder.rb +1 -1
  109. data/lib/kobako/codec/state.rb +2 -18
  110. data/lib/kobako/codec/value_budget.rb +4 -4
  111. data/lib/kobako/codec.rb +5 -6
  112. data/lib/kobako/errors.rb +4 -7
  113. data/lib/kobako/filesystem.rb +1 -1
  114. data/lib/kobako/fork.rb +42 -0
  115. data/lib/kobako/handle.rb +1 -2
  116. data/lib/kobako/sandbox.rb +17 -36
  117. data/lib/kobako/sandbox_options.rb +7 -9
  118. data/lib/kobako/usage.rb +4 -2
  119. data/lib/kobako/version.rb +1 -1
  120. data/lib/kobako.rb +2 -2
  121. data/sig/kobako/catalog/handles.rbs +2 -0
  122. data/sig/kobako/codec/state.rbs +0 -4
  123. data/sig/kobako/codec/value_budget.rbs +1 -1
  124. data/sig/kobako/codec.rbs +2 -2
  125. data/sig/kobako/errors.rbs +0 -3
  126. data/sig/kobako/fork.rbs +17 -0
  127. data/sig/kobako/runtime.rbs +2 -2
  128. data/sig/kobako/sandbox.rbs +3 -12
  129. data/sig/kobako/sandbox_options.rbs +0 -2
  130. metadata +15 -4
  131. data/lib/kobako/pool.rb +0 -162
  132. data/sig/core/thread.rbs +0 -6
  133. data/sig/kobako/pool.rbs +0 -46
data/README.md CHANGED
@@ -164,15 +164,14 @@ Kobako::Sandbox.new(timeout: 5.0, memory_limit: 10 * 1024 * 1024)
164
164
  | `timeout` | 60 s |
165
165
  | `memory_limit` | 4 MiB |
166
166
  | `stdout_limit`, `stderr_limit` | 1 MiB |
167
- | `open_file_limit` | 1024 |
167
+ | `open_file_limit` | 16 |
168
168
  | `open_connection_limit` | 6 |
169
169
  | `connection_limit` | 50 |
170
170
 
171
171
  ### Concurrency
172
172
 
173
173
  A Sandbox keeps nothing between runs, so Threads may share one. `gvl:
174
- :release` runs guest code in parallel. `Kobako::Pool` is deprecated, and the
175
- next release removes it.
174
+ :release` runs guest code in parallel.
176
175
 
177
176
  ```ruby
178
177
  sandbox = Kobako::Sandbox.new(gvl: :release).bind("KV::Lookup", lookup)
data/ROADMAP.md CHANGED
@@ -9,7 +9,6 @@ row below links a feature to its scenarios and to where its code starts.
9
9
  | ✅ [Sandbox](docs/spec/behavior/sandbox.md) | [lib/kobako/sandbox.rb](lib/kobako/sandbox.rb) |
10
10
  | ✅ [Service registration](docs/spec/behavior/services.md) | [lib/kobako/catalog/services.rb](lib/kobako/catalog/services.rb) |
11
11
  | ✅ [Runtime](docs/spec/behavior/runtime.md) | [lib/kobako/runtime.rb](lib/kobako/runtime.rb) |
12
- | ✅ [Pool](docs/spec/behavior/pool.md) | [lib/kobako/pool.rb](lib/kobako/pool.rb) |
13
12
  | ✅ [Extension](docs/spec/behavior/extension.md) | [lib/kobako/extension.rb](lib/kobako/extension.rb) |
14
13
  | ✅ [Outcome attribution](docs/spec/behavior/outcome.md) | [lib/kobako/outcome.rb](lib/kobako/outcome.rb) |
15
14
  | ✅ [Transport dispatch](docs/spec/behavior/transport-dispatch.md) | [lib/kobako/transport/dispatcher.rb](lib/kobako/transport/dispatcher.rb) |
@@ -1,5 +1,95 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.22.0](https://github.com/elct9620/kobako/compare/kobako-runtime-v0.21.0...kobako-runtime-v0.22.0) (2026-11-27)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **runtime:** vfs::cp_new_stat returns Result<Kstat, Errno> and vfs::ino_of returns Result<u64, Errno> in place of Kstat and u64; a Wasm Driver passes their EOVERFLOW to the guest.
9
+ * **runtime:** Tmpfs::new() and Tmpfs::DEFAULT_SIZE hold 4 MiB and 1025 entries instead of 64 MiB and 16385. Call
10
+ * **runtime:** a listing, a walk, or a copy up in a run past its deadline or interrupted now answers EINTR mid-way instead of finishing.
11
+ * **runtime:** a reader may now take a free directory ahead of a writer already waiting for it, and a trylock fails while any thread waits, so calls on a contended directory land in another order.
12
+ * **runtime:** connection_limit now also counts name lookups, failed dials, and each further address an HTTP request dials, so a run reaches the default 50 sooner; a socket to a new name spends two. Raise connection_limit for a script that needs more.
13
+ * **codec:** kobako-runtime drops Limits::value_budget; read kobako_codec::msgpack::codec::MAX_PAYLOAD_VALUES instead. A Sandbox whose memory_limit is above 4 MiB or None, or one built with_runtime, no longer accepts a guest payload of more than 262144 values.
14
+ * **runtime:** memory_limit measures the guest's own memory only; host buffers no longer answer ENOMEM or fail a request as internal.
15
+ * **memcg:** a run whose start function, global initializers, table growth, or request grow past memory_limit now raises Kobako::MemoryLimitError, growth of several memories and the GC heap adds up, and Usage#memory_peak includes them. Raise memory_limit by that growth to keep the earlier headroom.
16
+ * **net:** on Windows, a dropped lookup keeps its place against `open_connection_limit` until the host's query finishes.
17
+ * **runtime:** `Limits::default().open_file_limit` is `Some(16)` instead of `Some(1024)`; set `open_file_limit` for an invocation that holds more at once.
18
+ * **net:** a connection the guest closes with bytes the peer has not taken counts against `open_file_limit` until it closes, and resets when no open file is left for it.
19
+ * **filesystem:** an Overlay directory over N Bind Layers takes N of an invocation's `open_file_limit`; raise the limit by the Layers each held directory spans.
20
+ * **net:** TcpSock::send_room counts the Invocation's memory, and MemoryBudget::peak, and so Usage::memory_peak, can pass the limit by a permitted write as well as a forced read, at most 68 KiB more per open connection.
21
+ * **net:** net::send asks no CredentialSource for a TRACE and answers HttpError::Denied for one whose OutgoingRequest::body is not empty, where it swapped the value and sent the body.
22
+ * **net:** net::send answers HttpError::Denied for an OutgoingRequest whose method is CONNECT, where it sent one. A caller that needs a tunnel dials a TcpSock through an endpoint of Protocol::Tcp.
23
+ * **net:** MemoryBudget::peak, and so Usage::memory_peak, can pass the limit by one forced network read per open connection.
24
+ * **gvl:** a Service of a Sandbox releasing the GVL no longer takes interrupts the Host App's own Thread.handle_interrupt mask defers; it takes them as that mask allows, as under gvl: :hold. The warning a run releasing the GVL gave on the main Thread is gone.
25
+ * **vfs:** a FileOperations implementing iterate_shared must also return true from has_iterate_shared, or its listings answer NotADirectory.
26
+ * **vfs:** a guest now holds one preopen, `/`, at descriptor 3, instead of one per outermost Mount named by its path. A Guest Binary built on wasi-libc is unaffected; one that reads a Mount through descriptor 3 directly walks from `/` now, or the Host App mounts its Filesystem at `/`. `kobako_runtime::mount::outermost_of` is removed; a Wasm Driver opens `Cred::root` instead.
27
+ * **security:** a Sandbox whose nested mount path passes a host link, at its last name or above it, now fails each run with "stands nowhere: ELOOP" instead of standing where the link leads. Mount the directory the link leads to by its own path instead.
28
+
29
+ ### Features
30
+
31
+ * **http:** stream a request body as the guest writes it ([ed2b571](https://github.com/elct9620/kobako/commit/ed2b571820d46b1fdfff577b3c8257fd7c63ce71))
32
+ * **runtime:** tell how many datagrams a UDP socket holds unread ([48df527](https://github.com/elct9620/kobako/commit/48df52794238e2c13e27cc45f78e31e24101d82e))
33
+ * **sandbox:** have a fork wait for the runs in progress, or raise where it cannot ([3c33928](https://github.com/elct9620/kobako/commit/3c3392818a0454cfd72fc720560afc32b0a04aa5))
34
+ * **vfs:** preopen the guest's root alone, beneath which every Mount stands ([2a6d18d](https://github.com/elct9620/kobako/commit/2a6d18d78814f0529b15e109bbcd50f8b372e51b))
35
+ * **wasmtime:** bound what one host call copies out of the guest by memory_limit ([044090e](https://github.com/elct9620/kobako/commit/044090eef9430584d970b0bd0a773fd37ce61ffc))
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * **codec:** hold every guest payload to the Codec's own 262144 values ([1eee6ec](https://github.com/elct9620/kobako/commit/1eee6ecaf578687e9785753afa475d269d3fa750))
41
+ * **filesystem:** charge each host directory an Overlay holds to the caller ([437ada0](https://github.com/elct9620/kobako/commit/437ada00b268cf793cee8e7fadee1067dd0a4bf7))
42
+ * **filesystem:** let a process drop every directory its Binds keep ([ecd9756](https://github.com/elct9620/kobako/commit/ecd9756bbfb828930864c658a969f80fc9bbbe3f))
43
+ * **filesystem:** make way for a Bind's root when the host is out of descriptors ([ed7edd4](https://github.com/elct9620/kobako/commit/ed7edd40ea87e7ada687732eb28e6631e28b19a7))
44
+ * **filesystem:** share one bound on the directories Binds keep ([e7f2ff2](https://github.com/elct9620/kobako/commit/e7f2ff26fc50ee36ef31ac025363986f2a7ee99b))
45
+ * **fork:** tell a descendant apart from the ancestor whose pid it reuses ([15f6540](https://github.com/elct9620/kobako/commit/15f6540488a1a44a817a7f0349ca767a01fd0829))
46
+ * **gvl:** have a run on a Fiber a callback starts hold locks as that run ([723db42](https://github.com/elct9620/kobako/commit/723db4236131c95f140bef07e583e014e2ac8168))
47
+ * **gvl:** run each guest on a thread of its own, served by its caller ([7710c21](https://github.com/elct9620/kobako/commit/7710c212552415eaa4dd683d54e20d5aad89de26))
48
+ * **memcg:** charge every growth from the run's Store past what the binary declares ([44c7a8b](https://github.com/elct9620/kobako/commit/44c7a8bdc444b96a5d34a137a72b4e2f3c292d80))
49
+ * **net:** charge what a socket and an exchange hold as it arrives ([8c44cb4](https://github.com/elct9620/kobako/commit/8c44cb42b0bb996294715bd8eebe204707ea4c87))
50
+ * **net:** declare close on every request the proxy sends ([0ef6aa1](https://github.com/elct9620/kobako/commit/0ef6aa12eb1c5497e098570cdaf51c6b7cf7495e))
51
+ * **net:** draw each DNS query ID from the kernel ([99548ed](https://github.com/elct9620/kobako/commit/99548ed51cb73123a529072f49926b887a6a30e4))
52
+ * **net:** give a dropped lookup's place back at once on every host ([a8f8c4a](https://github.com/elct9620/kobako/commit/a8f8c4a9d9188fa9132571a5b279bca0e4130c3b))
53
+ * **net:** hold an open file for a socket still sending after its release ([d309bff](https://github.com/elct9620/kobako/commit/d309bff11cd22a323eef0695c19ef6db96532d2e))
54
+ * **net:** keep a lookup's place in a Windows query until its routine runs ([537b7f5](https://github.com/elct9620/kobako/commit/537b7f566abb75b46b18ee958141bdd2e717262b))
55
+ * **net:** keep an output stream's permit whole once its memory fills ([2b641cc](https://github.com/elct9620/kobako/commit/2b641ccee300a160d39c5edf691487d05ac4e365))
56
+ * **net:** move each request on the thread that waits for it ([425f82a](https://github.com/elct9620/kobako/commit/425f82abc5fc0b78774d0ae4e448a13a547bac29))
57
+ * **net:** never let a Windows lookup's completion wait on its cancel ([020673b](https://github.com/elct9620/kobako/commit/020673baaaf438e3bf62655101d43a87c0ee4760))
58
+ * **net:** refuse CONNECT at the L7 proxy ([8c69128](https://github.com/elct9620/kobako/commit/8c69128e6548037c8c66f7cb444db85585a43a70))
59
+ * **net:** shut a connection down as its exchange lets it go ([054e70a](https://github.com/elct9620/kobako/commit/054e70a2f467688297a9c640efb55cbd27e0553b))
60
+ * **net:** swap nothing into a TRACE and refuse one with content ([2135449](https://github.com/elct9620/kobako/commit/21354496a920c073bdafdb738538e273bf60a49a))
61
+ * **runtime:** answer a name no DNS query carries before the lookup holds it ([6b50f3a](https://github.com/elct9620/kobako/commit/6b50f3ad92fc0557f9485cc517b4931e2ea0a11a))
62
+ * **runtime:** append through a Windows Bind in one step ([bcc692b](https://github.com/elct9620/kobako/commit/bcc692b788ea86e79af5416344c991c1ccc992f9))
63
+ * **runtime:** count only the guest's descriptors against the open-file cap ([b0deca2](https://github.com/elct9620/kobako/commit/b0deca26519684729f37bf288a6a40f28968f9d0))
64
+ * **runtime:** default an invocation's open files to 16 ([c091b90](https://github.com/elct9620/kobako/commit/c091b90f2590e4a4746e482cd6d8e8c45e58bc5d))
65
+ * **runtime:** hand a socket what its event reported, so Windows hears a reset ([67874f7](https://github.com/elct9620/kobako/commit/67874f7e7a67604ab35c1fe8c123e17ab4f6092e))
66
+ * **runtime:** hold 4 MiB in a Tmpfs given no size of its own ([23ad4fe](https://github.com/elct9620/kobako/commit/23ad4feaca61f0c320fffe6f29021ced42b5601e))
67
+ * **runtime:** hold what the host keeps for a run by counts, not memory ([5428293](https://github.com/elct9620/kobako/commit/54282932e5f8a523d3d9e79275b846265102a22f))
68
+ * **runtime:** keep the reactor's repolls through an interrupted wait ([5275c77](https://github.com/elct9620/kobako/commit/5275c777e56241597ca8a6d469b1fdfe69be2258))
69
+ * **runtime:** let a TCP socket hear a reset that follows its peer's FIN ([dac6ecb](https://github.com/elct9620/kobako/commit/dac6ecba588867e734e7797f4153e54a659edbe2))
70
+ * **runtime:** let a write trylock pass a line nobody was handed, as mutex_trylock ([de510f5](https://github.com/elct9620/kobako/commit/de510f53e3bb451c7f840aa6373ccf88dc7fcb4d))
71
+ * **runtime:** let the process's open connections start unbounded ([55c03c5](https://github.com/elct9620/kobako/commit/55c03c51e10ebab0415ace38640c8595f86a321f))
72
+ * **runtime:** number a hermetic invocation's entries in the order it meets them ([4e23399](https://github.com/elct9620/kobako/commit/4e23399eca979ae4526735c72e34133907dceeb3))
73
+ * **runtime:** promise a reset past the peer's FIN no sooner than a write ([5de137c](https://github.com/elct9620/kobako/commit/5de137c94efad7aa69f5486af099d2da5f72f699))
74
+ * **runtime:** reach a Windows Bind entry by any spelling its host folds ([0a38543](https://github.com/elct9620/kobako/commit/0a38543c42c73a8b0e9557f205ef663f925bf670))
75
+ * **runtime:** read a Windows Bind's link as a guest path ([f1f04f6](https://github.com/elct9620/kobako/commit/f1f04f689d2da83f148b741a2a4abdf232d161f1))
76
+ * **runtime:** remove a Windows Bind's link to a directory as itself ([f200e1e](https://github.com/elct9620/kobako/commit/f200e1ef157d1b12cc71c0f5efba42745a8e0738))
77
+ * **runtime:** report a Windows Bind entry's times ([8584c90](https://github.com/elct9620/kobako/commit/8584c90e2f406edfeeb54477a330fd2f9937b602))
78
+ * **runtime:** serve a directory lock's waiters in turn, as Linux's rwsem ([4ab9bd0](https://github.com/elct9620/kobako/commit/4ab9bd0e2e134ce10a1bd87f3d4924e2acc4c8e5))
79
+ * **runtime:** set a time through a Windows Bind's descriptor opened to read ([397e0b5](https://github.com/elct9620/kobako/commit/397e0b52feec1d29a41212dfeb4227a4be4d8352))
80
+ * **runtime:** spend a poll budget on each step an HTTP connection takes ([efea22b](https://github.com/elct9620/kobako/commit/efea22b06ede0b27e98a03d174cfc7b4b23ae5f4))
81
+ * **runtime:** spend connection_limit before each lookup and dial leaves the host ([f958a44](https://github.com/elct9620/kobako/commit/f958a44ad39b9b3870685fbe23d911f4c4c3fe33))
82
+ * **runtime:** stand a poll on each wait queue once ([ad9c2b5](https://github.com/elct9620/kobako/commit/ad9c2b503c56b604d2ea6ee16d5676f3d9bce312))
83
+ * **runtime:** stop a listing and a copy up between steps once the run is to stop ([b2aebca](https://github.com/elct9620/kobako/commit/b2aebca6a83499b4659c95be17a2f68202932d74))
84
+ * **runtime:** watch a socket for room only while a writer found none ([b7e1c4d](https://github.com/elct9620/kobako/commit/b7e1c4d9bcf53e8050dee44d7e68f726055a56ed))
85
+ * **sched:** let a wait go on through a wakeup that raises nothing ([cf7f484](https://github.com/elct9620/kobako/commit/cf7f484ca645be1a0c64b0f9530b6e39034d3db3))
86
+ * **security:** refuse a nested mount whose path passes a link ([71abead](https://github.com/elct9620/kobako/commit/71abead05818696ef9a2e2b9082bb871087cfa34))
87
+ * **vfs:** climb out of the walk's own Filesystem mounted again ([1cf46c2](https://github.com/elct9620/kobako/commit/1cf46c2ba61af87631208ae2aed0471b419bb531))
88
+ * **vfs:** keep each Filesystem's moves to the walks on it ([42062b9](https://github.com/elct9620/kobako/commit/42062b9c2f22e00f6317fa92ebd6abe2b3fd76b0))
89
+ * **vfs:** refuse a listing of a file without iterate_shared before locking it ([34eb327](https://github.com/elct9620/kobako/commit/34eb3273cd537ccbd2b7a3592ece38da79d60d2f))
90
+ * **vfs:** wake a name's waiters and a move's readers when a panic unwinds ([515343c](https://github.com/elct9620/kobako/commit/515343c71075517c7c4b9a05624df2ef733b62bc))
91
+ * **wasmtime:** stop a guest that only computes once its run takes a fatal signal ([32990b6](https://github.com/elct9620/kobako/commit/32990b63cd6ae16c5d8a0e473a218d46d29c8919))
92
+
3
93
  ## [0.21.0](https://github.com/elct9620/kobako/compare/kobako-runtime-v0.20.0...kobako-runtime-v0.21.0) (2026-11-18)
4
94
 
5
95
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  [package]
18
18
  name = "kobako-runtime"
19
- version = "0.21.0"
19
+ version = "0.22.0"
20
20
  edition = "2021"
21
21
  description = "Engine-neutral host runtime contract for embedding kobako Wasm guests."
22
22
  license = "Apache-2.0"
@@ -33,7 +33,7 @@ exclude = ["tests/"]
33
33
  # in-tree builds (and the Ruby gem, which ships both crates) resolving
34
34
  # locally.
35
35
  [dependencies]
36
- kobako-transport = { version = "0.21.0", path = "../kobako-transport" }
36
+ kobako-transport = { version = "0.22.0", path = "../kobako-transport" }
37
37
  # cap-std resolves each name a Bind is asked beneath its host directory,
38
38
  # on every host Windows included. The VFS already hands one name and
39
39
  # follows links itself; cap-std still refuses a `..` or a symbolic link
@@ -82,28 +82,27 @@ zeroize = "1.9.1"
82
82
  # It also opens a Bind's directory several names deep with Linux's
83
83
  # openat2, holds a file by O_PATH before reopening it through /proc,
84
84
  # and reads which macOS release confines such an open, and which errno a
85
- # host call failed with, which std names no kind for.
85
+ # host call failed with, which std names no kind for. libc registers the
86
+ # handler that counts each fork, and asks macOS for the name a directory
87
+ # stores, which a Mount's Policy judges in place of a spelling the host
88
+ # folds, and opens a directory beneath another with O_NOFOLLOW_ANY; rustix
89
+ # has none of these.
86
90
  [target.'cfg(unix)'.dependencies]
91
+ libc = "0.2.191"
87
92
  rustix = { version = "1.1.4", features = ["fs", "system"] }
88
93
 
89
94
  # rustix reads which Winsock error a host call failed with, which std
90
95
  # names no kind for, as on POSIX. windows-sys asks Windows for a name through
91
- # GetAddrInfoExW, whose query a lookup can cancel, which std cannot.
96
+ # GetAddrInfoExW, whose query a lookup can cancel, which std cannot, and
97
+ # reopens a Bind's open file to set its times, which std cannot either.
92
98
  [target.'cfg(windows)'.dependencies]
93
99
  rustix = { version = "1.1.4", features = ["net"] }
94
- windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_System_IO"] }
100
+ windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_Storage_FileSystem", "Win32_System_IO"] }
95
101
 
96
102
  # simple-dns reads and writes the DNS messages the Linux stub resolver sends
97
103
  # to a name server, its compression loops refused; it pulls in only bitflags.
104
+ # rustix draws each query ID from getrandom, so no state a fork copies
105
+ # repeats it.
98
106
  [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
107
+ rustix = { version = "1.1.4", features = ["rand"] }
99
108
  simple-dns = "0.13.1"
100
-
101
- # libc asks macOS for the name a directory stores, which a Mount's Policy
102
- # judges in place of a spelling the host folds, and opens a directory
103
- # beneath another with O_NOFOLLOW_ANY; rustix has neither.
104
- [target.'cfg(target_os = "macos")'.dependencies]
105
- libc = "0.2.191"
106
-
107
- # libc makes the syscalls tests/linux_baseline holds the VFS to.
108
- [target.'cfg(target_os = "linux")'.dev-dependencies]
109
- libc = "0.2.191"
@@ -36,7 +36,7 @@ Add the crate to an engine or a frontend that speaks the contract.
36
36
 
37
37
  ```toml
38
38
  [dependencies]
39
- kobako-runtime = "0.21.0" # x-release-please-version
39
+ kobako-runtime = "0.22.0" # x-release-please-version
40
40
  ```
41
41
 
42
42
  ## License
@@ -1,6 +1,6 @@
1
1
  //! Who a call is made for, as Linux's `struct cred`: the security modules
2
2
  //! registered for the caller, the memory charged on its behalf, the profile it
3
- //! sees entries through, and its mount namespace. The hooks that ask its
3
+ //! sees entries through, and its mount and inode number namespaces. The hooks that ask its
4
4
  //! modules live with the security framework, as `security/security.c` holds
5
5
  //! them apart from `kernel/cred.c`.
6
6
 
@@ -9,20 +9,24 @@ use std::sync::Arc;
9
9
  use crate::memcg::MemoryBudget;
10
10
  use crate::profile::Profile;
11
11
  use crate::security::SecurityOperations;
12
- use crate::vfs::{MntNamespace, VfsMount};
12
+ use crate::vfs::{InoNamespace, MntNamespace, VfsMount};
13
13
 
14
14
  /// Who a call is made for, holding the security modules registered for it, as
15
- /// `cred->security` holds a Landlock domain, and the memory budget the host
16
- /// charges what it holds on the caller's behalf to, which every Cred restricted
17
- /// from it shares, as a task's memory cgroup does. Its profile decides what the
15
+ /// `cred->security` holds a Landlock domain, and the memory budget the guest's
16
+ /// growth is charged to, which every Cred restricted from it shares, as a
17
+ /// task's memory cgroup does. Its profile decides what the
18
18
  /// caller sees of an entry, as `cred->user_ns` decides the owner `cp_new_stat`
19
19
  /// reports. Its mount namespace says which mount stands on which name, as a
20
- /// task's `nsproxy` holds one beside its credentials.
20
+ /// task's `nsproxy` holds one beside its credentials, and its inode number
21
+ /// namespace which number a hermetic caller knows each entry by, as a PID
22
+ /// namespace sits there too.
23
+ #[derive(Clone)]
21
24
  pub struct Cred {
22
25
  security: Vec<Arc<dyn SecurityOperations>>,
23
26
  memory: Arc<MemoryBudget>,
24
27
  profile: Profile,
25
28
  mnt_ns: Arc<MntNamespace>,
29
+ ino_ns: Arc<InoNamespace>,
26
30
  }
27
31
 
28
32
  /// One no module is registered for, which this crate's tests make calls as.
@@ -34,6 +38,7 @@ impl Default for Cred {
34
38
  memory: MemoryBudget::new(None),
35
39
  profile: Profile::Hermetic,
36
40
  mnt_ns: Arc::default(),
41
+ ino_ns: Arc::default(),
37
42
  }
38
43
  }
39
44
  }
@@ -41,13 +46,14 @@ impl Default for Cred {
41
46
  impl Cred {
42
47
  /// One with `security` registered, its memory unbounded.
43
48
  pub(crate) fn new(security: Vec<Arc<dyn SecurityOperations>>) -> Arc<Self> {
44
- Self::within(security, MemoryBudget::new(None))
49
+ Self::with_memory(security, MemoryBudget::new(None))
45
50
  }
46
51
 
47
52
  /// One with `security` registered, charging what is held on its behalf to
48
53
  /// `memory`, seeing entries as the hermetic profile does until told
49
- /// otherwise.
50
- pub(crate) fn within(
54
+ /// otherwise, and numbering them afresh, which every Cred restricted from
55
+ /// it shares.
56
+ pub(crate) fn with_memory(
51
57
  security: Vec<Arc<dyn SecurityOperations>>,
52
58
  memory: Arc<MemoryBudget>,
53
59
  ) -> Arc<Self> {
@@ -56,6 +62,7 @@ impl Cred {
56
62
  memory,
57
63
  profile: Profile::Hermetic,
58
64
  mnt_ns: Arc::default(),
65
+ ino_ns: Arc::default(),
59
66
  })
60
67
  }
61
68
 
@@ -66,9 +73,7 @@ impl Cred {
66
73
  security.extend(more);
67
74
  Arc::new(Self {
68
75
  security,
69
- memory: self.memory.clone(),
70
- profile: self.profile,
71
- mnt_ns: self.mnt_ns.clone(),
76
+ ..self.clone()
72
77
  })
73
78
  }
74
79
 
@@ -76,13 +81,18 @@ impl Cred {
76
81
  /// its mounts holds a namespace of its own.
77
82
  pub(crate) fn with_mnt_ns(&self, mnt_ns: Arc<MntNamespace>) -> Arc<Self> {
78
83
  Arc::new(Self {
79
- security: self.security.clone(),
80
- memory: self.memory.clone(),
81
- profile: self.profile,
82
84
  mnt_ns,
85
+ ..self.clone()
83
86
  })
84
87
  }
85
88
 
89
+ /// The mount every guest path starts from, as a task's `fs->root`: the
90
+ /// Mount at `/`, or the read-only root the runtime made beneath the others;
91
+ /// none where no Mount was made.
92
+ pub fn root(&self) -> Option<Arc<VfsMount>> {
93
+ self.mnt_ns.root().cloned()
94
+ }
95
+
86
96
  /// The mount a walk from the root of `mnt` stands on: the topmost of those
87
97
  /// stacked over that root, as Linux's `topmost_overmount` answers.
88
98
  pub fn topmost_overmount(&self, mnt: &Arc<VfsMount>) -> Arc<VfsMount> {
@@ -93,10 +103,8 @@ impl Cred {
93
103
  /// carry the user namespace its stat is reported in.
94
104
  pub fn with_profile(&self, profile: Profile) -> Arc<Self> {
95
105
  Arc::new(Self {
96
- security: self.security.clone(),
97
- memory: self.memory.clone(),
98
106
  profile,
99
- mnt_ns: self.mnt_ns.clone(),
107
+ ..self.clone()
100
108
  })
101
109
  }
102
110
 
@@ -116,9 +124,13 @@ impl Cred {
116
124
  self.profile
117
125
  }
118
126
 
119
- /// The budget the caller's memory is charged to, which a Wasm Driver also
120
- /// charges the guest's own growth to.
127
+ /// The budget a Wasm Driver charges the guest's growth to.
121
128
  pub fn memory_budget(&self) -> &Arc<MemoryBudget> {
122
129
  &self.memory
123
130
  }
131
+
132
+ /// The inode numbers a hermetic caller knows its entries by.
133
+ pub(crate) fn ino_ns(&self) -> &InoNamespace {
134
+ &self.ino_ns
135
+ }
124
136
  }