@ai-ecoverse/slicc-kernel 1.136.8 → 1.137.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.
- package/README.md +22 -4
- package/dist/index.js +3 -1
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +666 -164
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +58 -5
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +653 -160
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +58 -5
- package/dist/process-worker.js.map +4 -4
- package/dist/testing.js +1 -0
- package/dist/testing.js.map +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/kernel/net/dns-stub.d.ts +65 -0
- package/dist/types/kernel/net/resolver.d.ts +4 -1
- package/dist/types/kernel/net/sealed-pg.d.ts +1 -0
- package/dist/types/kernel/net/uplink.d.ts +3 -1
- package/dist/types/kernel/proc-info.d.ts +2 -0
- package/dist/types/kernel/socket.d.ts +3 -1
- package/dist/types/launcher.d.ts +2 -0
- package/dist/types/node.d.ts +1 -0
- package/dist/types/process/procfs.d.ts +1 -1
- package/dist/types/process/wasi/wasi-procfs.d.ts +2 -1
- package/dist/types/serve.d.ts +2 -0
- package/dist/types/testing.d.ts +1 -0
- package/package.json +3 -3
|
@@ -6699,7 +6699,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
6699
6699
|
var init_version = __esm({
|
|
6700
6700
|
"src/version.ts"() {
|
|
6701
6701
|
"use strict";
|
|
6702
|
-
KERNEL_VERSION = true ? "1.
|
|
6702
|
+
KERNEL_VERSION = true ? "1.137.0" : "0.0.0-dev";
|
|
6703
6703
|
OS_RELEASE = "6.0.0-slicc";
|
|
6704
6704
|
}
|
|
6705
6705
|
});
|
|
@@ -7784,6 +7784,20 @@ var init_js_net = __esm({
|
|
|
7784
7784
|
}
|
|
7785
7785
|
});
|
|
7786
7786
|
|
|
7787
|
+
// src/kernel/proc-info.ts
|
|
7788
|
+
function mayTrace(viewer, target) {
|
|
7789
|
+
const by = viewer?.cred;
|
|
7790
|
+
const of = target.cred;
|
|
7791
|
+
if (!by || !of || by.euid === 0) return true;
|
|
7792
|
+
const uid = of.ruid === by.euid && of.euid === by.euid && of.suid === by.euid;
|
|
7793
|
+
return uid && of.rgid === by.egid && of.egid === by.egid && of.sgid === by.egid;
|
|
7794
|
+
}
|
|
7795
|
+
var init_proc_info = __esm({
|
|
7796
|
+
"src/kernel/proc-info.ts"() {
|
|
7797
|
+
"use strict";
|
|
7798
|
+
}
|
|
7799
|
+
});
|
|
7800
|
+
|
|
7787
7801
|
// src/fs/owners.ts
|
|
7788
7802
|
function inGroup(cred, gid) {
|
|
7789
7803
|
return cred.egid === gid || cred.groups.includes(gid);
|
|
@@ -10619,6 +10633,25 @@ function attr(node) {
|
|
|
10619
10633
|
blocks: 0
|
|
10620
10634
|
};
|
|
10621
10635
|
}
|
|
10636
|
+
function withPidFiles(names, extra) {
|
|
10637
|
+
return [.../* @__PURE__ */ new Set([...names, ...PID_FILES, ...extra])];
|
|
10638
|
+
}
|
|
10639
|
+
function exeNodes(fresh, info, error, self) {
|
|
10640
|
+
return {
|
|
10641
|
+
exeLink: (parent, target, own = false) => {
|
|
10642
|
+
const of = info(target, own);
|
|
10643
|
+
const exe = of?.exe;
|
|
10644
|
+
if (!of || exe === void 0) throw error();
|
|
10645
|
+
const link = fresh(parent, "exe", LINK_MODE2);
|
|
10646
|
+
link.node_ops.readlink = () => {
|
|
10647
|
+
if (!mayTrace(info(self, true), of)) throw error(EACCES);
|
|
10648
|
+
return exe;
|
|
10649
|
+
};
|
|
10650
|
+
return link;
|
|
10651
|
+
},
|
|
10652
|
+
hasExe: (target, own = false) => info(target, own)?.exe === void 0 ? [] : ["exe"]
|
|
10653
|
+
};
|
|
10654
|
+
}
|
|
10622
10655
|
function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
10623
10656
|
const { lookupPath, createNode, hashRemoveNode } = Fs;
|
|
10624
10657
|
const procList = sys.procList?.bind(sys);
|
|
@@ -10685,14 +10718,16 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
10685
10718
|
dir.node_ops.readdir = () => [".", "..", ...Object.keys(tree)];
|
|
10686
10719
|
return dir;
|
|
10687
10720
|
};
|
|
10688
|
-
const
|
|
10721
|
+
const exe = exeNodes(fresh, (at, own) => find(procList().processes, at, own), error, pid);
|
|
10722
|
+
const pidNames = (names) => withPidFiles(names, exe.hasExe(pid, true));
|
|
10689
10723
|
const pidDir = (name2, target) => {
|
|
10690
10724
|
const dir = fresh(proc, name2, DIR_MODE2);
|
|
10691
10725
|
dir.node_ops.lookup = (parent, child) => {
|
|
10726
|
+
if (child === "exe") return exe.exeLink(parent, target);
|
|
10692
10727
|
if (!PID_FILES.includes(child)) throw error();
|
|
10693
10728
|
return file(parent, child, pidContent(target, child));
|
|
10694
10729
|
};
|
|
10695
|
-
dir.node_ops.readdir = () => [".", "..", ...PID_FILES];
|
|
10730
|
+
dir.node_ops.readdir = () => [".", "..", ...PID_FILES, ...exe.hasExe(target)];
|
|
10696
10731
|
return dir;
|
|
10697
10732
|
};
|
|
10698
10733
|
const scans = /* @__PURE__ */ new Map();
|
|
@@ -10776,6 +10811,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
10776
10811
|
self.node_ops = {
|
|
10777
10812
|
...selfOps,
|
|
10778
10813
|
lookup: (parent, name2) => {
|
|
10814
|
+
if (name2 === "exe") return exe.exeLink(parent, pid, true);
|
|
10779
10815
|
if (PID_FILES.includes(name2)) {
|
|
10780
10816
|
return file(parent, name2, pidContent(pid, name2, true));
|
|
10781
10817
|
}
|
|
@@ -10785,11 +10821,12 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
10785
10821
|
readdir: (node) => pidNames(selfReaddir ? selfReaddir(node) : [".", ".."])
|
|
10786
10822
|
};
|
|
10787
10823
|
}
|
|
10788
|
-
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, UID2, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, SYS_TREE, sigMask, STATES, tagLine;
|
|
10824
|
+
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, EACCES, UID2, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, SYS_TREE, sigMask, STATES, tagLine;
|
|
10789
10825
|
var init_procfs = __esm({
|
|
10790
10826
|
"src/process/procfs.ts"() {
|
|
10791
10827
|
"use strict";
|
|
10792
10828
|
init_cred();
|
|
10829
|
+
init_proc_info();
|
|
10793
10830
|
init_version();
|
|
10794
10831
|
init_process_fds();
|
|
10795
10832
|
HZ = 100;
|
|
@@ -10798,6 +10835,7 @@ var init_procfs = __esm({
|
|
|
10798
10835
|
LINK_MODE2 = 41471;
|
|
10799
10836
|
ENOENT = 44;
|
|
10800
10837
|
EINVAL = 28;
|
|
10838
|
+
EACCES = 2;
|
|
10801
10839
|
UID2 = 1e3;
|
|
10802
10840
|
KIB = 1024;
|
|
10803
10841
|
FALLBACK_MEMORY = 4 * KIB * KIB * KIB;
|
|
@@ -11096,6 +11134,7 @@ var DIR_MODE3, FILE_MODE2, LINK_MODE3, PID_NAMES, SYSTEM_NAMES, ProcTree, FOLLOW
|
|
|
11096
11134
|
var init_wasi_procfs = __esm({
|
|
11097
11135
|
"src/process/wasi/wasi-procfs.ts"() {
|
|
11098
11136
|
"use strict";
|
|
11137
|
+
init_proc_info();
|
|
11099
11138
|
init_sync_fs_wire();
|
|
11100
11139
|
init_process_fds();
|
|
11101
11140
|
init_procfs();
|
|
@@ -11156,7 +11195,16 @@ var init_wasi_procfs = __esm({
|
|
|
11156
11195
|
if (!/^[1-9]\d*$/.test(top) || !this.alive(Number(top))) return void 0;
|
|
11157
11196
|
if (leaf === "task") return this.task(Number(top), rest2);
|
|
11158
11197
|
if (rest2.length > 0) return void 0;
|
|
11159
|
-
if (leaf === void 0)
|
|
11198
|
+
if (leaf === void 0) {
|
|
11199
|
+
const exe = () => this.info(Number(top))?.exe === void 0 ? [] : ["exe"];
|
|
11200
|
+
return { kind: "dir", names: () => [...PID_NAMES, ...exe(), "task"] };
|
|
11201
|
+
}
|
|
11202
|
+
if (leaf === "exe") {
|
|
11203
|
+
const info = this.info(Number(top));
|
|
11204
|
+
if (info?.exe === void 0) return void 0;
|
|
11205
|
+
const denied = !mayTrace(this.ownInfo(), info);
|
|
11206
|
+
return { kind: "link", target: info.exe, ...denied ? { denied } : {} };
|
|
11207
|
+
}
|
|
11160
11208
|
if (!PID_NAMES.includes(leaf)) return void 0;
|
|
11161
11209
|
return {
|
|
11162
11210
|
kind: "file",
|
|
@@ -11168,6 +11216,10 @@ var init_wasi_procfs = __esm({
|
|
|
11168
11216
|
}
|
|
11169
11217
|
};
|
|
11170
11218
|
}
|
|
11219
|
+
ownInfo() {
|
|
11220
|
+
const processes2 = this.listing().processes;
|
|
11221
|
+
return processes2.find((p) => p.tid === this.pid) ?? processes2.find((p) => p.pid === this.pid);
|
|
11222
|
+
}
|
|
11171
11223
|
info(pid) {
|
|
11172
11224
|
return this.listing().processes.find((p) => p.pid === pid);
|
|
11173
11225
|
}
|
|
@@ -11231,6 +11283,7 @@ var init_wasi_procfs = __esm({
|
|
|
11231
11283
|
readlink(path) {
|
|
11232
11284
|
const node = this.find(path, false);
|
|
11233
11285
|
if (node.kind !== "link") throw syncError("EINVAL", path);
|
|
11286
|
+
if (node.denied) throw syncError("EACCES", path);
|
|
11234
11287
|
return node.target;
|
|
11235
11288
|
}
|
|
11236
11289
|
exists(path) {
|