@ai-ecoverse/slicc-kernel 1.77.0 → 1.77.2
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.
- package/README.md +3 -3
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +126 -2
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +42 -5
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +126 -2
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +42 -5
- package/dist/process-worker.js.map +3 -3
- package/package.json +1 -1
|
@@ -1497,6 +1497,7 @@ var init_wasi_fds = __esm({
|
|
|
1497
1497
|
WasiFds = class {
|
|
1498
1498
|
table = /* @__PURE__ */ new Map();
|
|
1499
1499
|
buffers = /* @__PURE__ */ new Map();
|
|
1500
|
+
reported = /* @__PURE__ */ new WeakSet();
|
|
1500
1501
|
byId = /* @__PURE__ */ new Map();
|
|
1501
1502
|
ids = /* @__PURE__ */ new Map();
|
|
1502
1503
|
kernel;
|
|
@@ -1821,7 +1822,16 @@ var init_wasi_fds = __esm({
|
|
|
1821
1822
|
release(e) {
|
|
1822
1823
|
if (e.type !== "file" || --e.file.refs > 0) return;
|
|
1823
1824
|
const { buffer } = e.file;
|
|
1824
|
-
|
|
1825
|
+
try {
|
|
1826
|
+
buffer.flush();
|
|
1827
|
+
} catch (err) {
|
|
1828
|
+
this.reported.add(buffer);
|
|
1829
|
+
this.drop(buffer);
|
|
1830
|
+
throw err;
|
|
1831
|
+
}
|
|
1832
|
+
this.drop(buffer);
|
|
1833
|
+
}
|
|
1834
|
+
drop(buffer) {
|
|
1825
1835
|
if (--buffer.opens > 0) return;
|
|
1826
1836
|
this.forget(buffer);
|
|
1827
1837
|
this.letGo(buffer);
|
|
@@ -1876,7 +1886,13 @@ var init_wasi_fds = __esm({
|
|
|
1876
1886
|
return e.kind;
|
|
1877
1887
|
}
|
|
1878
1888
|
flushAll() {
|
|
1879
|
-
for (const buffer of this.buffers.values())
|
|
1889
|
+
for (const buffer of this.buffers.values()) {
|
|
1890
|
+
try {
|
|
1891
|
+
buffer.flush();
|
|
1892
|
+
} catch (err) {
|
|
1893
|
+
if (!this.reported.has(buffer)) throw err;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1880
1896
|
}
|
|
1881
1897
|
flushEarly() {
|
|
1882
1898
|
for (const buffer of this.buffers.values()) {
|
|
@@ -2639,7 +2655,8 @@ var init_wasi_host = __esm({
|
|
|
2639
2655
|
if (this.o.fs.owners && amode & 1) throw new WasiError("EACCES");
|
|
2640
2656
|
return;
|
|
2641
2657
|
}
|
|
2642
|
-
pathOwned(path, !nofollow);
|
|
2658
|
+
const st = pathOwned(path, !nofollow);
|
|
2659
|
+
if (amode & 2 && st.readonly) throw new WasiError("EROFS");
|
|
2643
2660
|
if (!this.o.fs.owners) return;
|
|
2644
2661
|
const kind = flags & AT_EACCESS ? "eaccess" : "access";
|
|
2645
2662
|
this.o.fs.access?.(path, amode & 7, kind, nofollow);
|
|
@@ -8646,6 +8663,22 @@ function cString(memory, at) {
|
|
|
8646
8663
|
function baseOf(Fs, dirfd) {
|
|
8647
8664
|
return dirfd === AT_FDCWD ? Fs.cwd?.() ?? "/" : Fs.getStream?.(dirfd)?.path ?? "/";
|
|
8648
8665
|
}
|
|
8666
|
+
function readonlyRefusal(Fs, memory, call2) {
|
|
8667
|
+
if (!(call2.amode & W_ACCESS)) return 0;
|
|
8668
|
+
try {
|
|
8669
|
+
const name2 = cString(memory, call2.path);
|
|
8670
|
+
const abs = name2.startsWith("/") ? name2 : `${baseOf(Fs, call2.dirfd)}/${name2}`;
|
|
8671
|
+
const follow2 = (call2.flags & AT_SYMLINK_NOFOLLOW2) === 0;
|
|
8672
|
+
const { node } = Fs.lookupPath.call(Fs, abs, {
|
|
8673
|
+
follow: follow2
|
|
8674
|
+
});
|
|
8675
|
+
const bridge = node.live ? node.mount.opts.bridge : void 0;
|
|
8676
|
+
const stat = bridge?.stat;
|
|
8677
|
+
return stat?.(liveNodePath(node)).readonly ? -wasiErrno("EROFS") : 0;
|
|
8678
|
+
} catch {
|
|
8679
|
+
return 0;
|
|
8680
|
+
}
|
|
8681
|
+
}
|
|
8649
8682
|
function kernelChecks(Fs, memory, call2) {
|
|
8650
8683
|
const name2 = cString(memory, call2.path);
|
|
8651
8684
|
const abs = name2.startsWith("/") ? name2 : `${baseOf(Fs, call2.dirfd)}/${name2}`;
|
|
@@ -8659,9 +8692,12 @@ function kernelChecks(Fs, memory, call2) {
|
|
|
8659
8692
|
}
|
|
8660
8693
|
function kernelAccess(imports, fs, memory, glue) {
|
|
8661
8694
|
wrapImport(imports, "faccessat", glue, (own) => (dirfd, path, amode, flags) => {
|
|
8662
|
-
const rc = own(dirfd, path, amode, flags);
|
|
8663
8695
|
const Fs = fs();
|
|
8664
8696
|
const heap = memory();
|
|
8697
|
+
const call2 = { dirfd, path, amode: amode & 7, flags };
|
|
8698
|
+
const refused2 = Fs?.lookupPath && heap ? readonlyRefusal(Fs, heap, call2) : 0;
|
|
8699
|
+
if (refused2 !== 0) return refused2;
|
|
8700
|
+
const rc = own(dirfd, path, amode, flags);
|
|
8665
8701
|
if (rc !== 0 || !Fs?.lookupPath || !heap) return rc;
|
|
8666
8702
|
try {
|
|
8667
8703
|
return kernelChecks(Fs, heap, { dirfd, path, amode: amode & 7, flags });
|
|
@@ -8680,7 +8716,7 @@ function linuxDevices(Fs) {
|
|
|
8680
8716
|
}
|
|
8681
8717
|
}
|
|
8682
8718
|
}
|
|
8683
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY4, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE2, O_CREAT2, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS2, DEVICE_MODES;
|
|
8719
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY4, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE2, O_CREAT2, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS2, W_ACCESS, DEVICE_MODES;
|
|
8684
8720
|
var init_process_fds = __esm({
|
|
8685
8721
|
"src/process/process-fds.ts"() {
|
|
8686
8722
|
"use strict";
|
|
@@ -8739,6 +8775,7 @@ var init_process_fds = __esm({
|
|
|
8739
8775
|
NAME = /^[a-z_][a-z0-9_-]*$/i;
|
|
8740
8776
|
AT_FDCWD = -100;
|
|
8741
8777
|
AT_EACCESS2 = 512;
|
|
8778
|
+
W_ACCESS = 2;
|
|
8742
8779
|
DEVICE_MODES = [
|
|
8743
8780
|
["/", 493],
|
|
8744
8781
|
["/dev", 493],
|