@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
package/dist/process-worker.js
CHANGED
|
@@ -2783,7 +2783,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2783
2783
|
var init_version = __esm({
|
|
2784
2784
|
"src/version.ts"() {
|
|
2785
2785
|
"use strict";
|
|
2786
|
-
KERNEL_VERSION = true ? "1.
|
|
2786
|
+
KERNEL_VERSION = true ? "1.137.0" : "0.0.0-dev";
|
|
2787
2787
|
OS_RELEASE = "6.0.0-slicc";
|
|
2788
2788
|
}
|
|
2789
2789
|
});
|
|
@@ -5484,6 +5484,20 @@ var init_cred = __esm({
|
|
|
5484
5484
|
}
|
|
5485
5485
|
});
|
|
5486
5486
|
|
|
5487
|
+
// src/kernel/proc-info.ts
|
|
5488
|
+
function mayTrace(viewer, target) {
|
|
5489
|
+
const by = viewer?.cred;
|
|
5490
|
+
const of = target.cred;
|
|
5491
|
+
if (!by || !of || by.euid === 0) return true;
|
|
5492
|
+
const uid = of.ruid === by.euid && of.euid === by.euid && of.suid === by.euid;
|
|
5493
|
+
return uid && of.rgid === by.egid && of.egid === by.egid && of.sgid === by.egid;
|
|
5494
|
+
}
|
|
5495
|
+
var init_proc_info = __esm({
|
|
5496
|
+
"src/kernel/proc-info.ts"() {
|
|
5497
|
+
"use strict";
|
|
5498
|
+
}
|
|
5499
|
+
});
|
|
5500
|
+
|
|
5487
5501
|
// src/process/procfs.ts
|
|
5488
5502
|
function isSysFile(at) {
|
|
5489
5503
|
return typeof at === "string" || typeof at === "function";
|
|
@@ -5687,6 +5701,25 @@ function attr(node) {
|
|
|
5687
5701
|
blocks: 0
|
|
5688
5702
|
};
|
|
5689
5703
|
}
|
|
5704
|
+
function withPidFiles(names, extra) {
|
|
5705
|
+
return [.../* @__PURE__ */ new Set([...names, ...PID_FILES, ...extra])];
|
|
5706
|
+
}
|
|
5707
|
+
function exeNodes(fresh, info, error, self) {
|
|
5708
|
+
return {
|
|
5709
|
+
exeLink: (parent, target, own = false) => {
|
|
5710
|
+
const of = info(target, own);
|
|
5711
|
+
const exe = of?.exe;
|
|
5712
|
+
if (!of || exe === void 0) throw error();
|
|
5713
|
+
const link = fresh(parent, "exe", LINK_MODE2);
|
|
5714
|
+
link.node_ops.readlink = () => {
|
|
5715
|
+
if (!mayTrace(info(self, true), of)) throw error(EACCES);
|
|
5716
|
+
return exe;
|
|
5717
|
+
};
|
|
5718
|
+
return link;
|
|
5719
|
+
},
|
|
5720
|
+
hasExe: (target, own = false) => info(target, own)?.exe === void 0 ? [] : ["exe"]
|
|
5721
|
+
};
|
|
5722
|
+
}
|
|
5690
5723
|
function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
5691
5724
|
const { lookupPath, createNode, hashRemoveNode } = Fs;
|
|
5692
5725
|
const procList = sys.procList?.bind(sys);
|
|
@@ -5753,14 +5786,16 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
5753
5786
|
dir.node_ops.readdir = () => [".", "..", ...Object.keys(tree)];
|
|
5754
5787
|
return dir;
|
|
5755
5788
|
};
|
|
5756
|
-
const
|
|
5789
|
+
const exe = exeNodes(fresh, (at, own) => find(procList().processes, at, own), error, pid);
|
|
5790
|
+
const pidNames = (names) => withPidFiles(names, exe.hasExe(pid, true));
|
|
5757
5791
|
const pidDir = (name2, target) => {
|
|
5758
5792
|
const dir = fresh(proc, name2, DIR_MODE2);
|
|
5759
5793
|
dir.node_ops.lookup = (parent, child) => {
|
|
5794
|
+
if (child === "exe") return exe.exeLink(parent, target);
|
|
5760
5795
|
if (!PID_FILES.includes(child)) throw error();
|
|
5761
5796
|
return file(parent, child, pidContent(target, child));
|
|
5762
5797
|
};
|
|
5763
|
-
dir.node_ops.readdir = () => [".", "..", ...PID_FILES];
|
|
5798
|
+
dir.node_ops.readdir = () => [".", "..", ...PID_FILES, ...exe.hasExe(target)];
|
|
5764
5799
|
return dir;
|
|
5765
5800
|
};
|
|
5766
5801
|
const scans = /* @__PURE__ */ new Map();
|
|
@@ -5844,6 +5879,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
5844
5879
|
self.node_ops = {
|
|
5845
5880
|
...selfOps,
|
|
5846
5881
|
lookup: (parent, name2) => {
|
|
5882
|
+
if (name2 === "exe") return exe.exeLink(parent, pid, true);
|
|
5847
5883
|
if (PID_FILES.includes(name2)) {
|
|
5848
5884
|
return file(parent, name2, pidContent(pid, name2, true));
|
|
5849
5885
|
}
|
|
@@ -5853,11 +5889,12 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
5853
5889
|
readdir: (node) => pidNames(selfReaddir ? selfReaddir(node) : [".", ".."])
|
|
5854
5890
|
};
|
|
5855
5891
|
}
|
|
5856
|
-
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, UID, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, SYS_TREE, sigMask, STATES, tagLine;
|
|
5892
|
+
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, EACCES, UID, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, SYS_TREE, sigMask, STATES, tagLine;
|
|
5857
5893
|
var init_procfs = __esm({
|
|
5858
5894
|
"src/process/procfs.ts"() {
|
|
5859
5895
|
"use strict";
|
|
5860
5896
|
init_cred();
|
|
5897
|
+
init_proc_info();
|
|
5861
5898
|
init_version();
|
|
5862
5899
|
init_process_fds();
|
|
5863
5900
|
HZ = 100;
|
|
@@ -5866,6 +5903,7 @@ var init_procfs = __esm({
|
|
|
5866
5903
|
LINK_MODE2 = 41471;
|
|
5867
5904
|
ENOENT = 44;
|
|
5868
5905
|
EINVAL = 28;
|
|
5906
|
+
EACCES = 2;
|
|
5869
5907
|
UID = 1e3;
|
|
5870
5908
|
KIB = 1024;
|
|
5871
5909
|
FALLBACK_MEMORY = 4 * KIB * KIB * KIB;
|
|
@@ -12505,6 +12543,7 @@ var DIR_MODE3, FILE_MODE2, LINK_MODE3, PID_NAMES, SYSTEM_NAMES, ProcTree, FOLLOW
|
|
|
12505
12543
|
var init_wasi_procfs = __esm({
|
|
12506
12544
|
"src/process/wasi/wasi-procfs.ts"() {
|
|
12507
12545
|
"use strict";
|
|
12546
|
+
init_proc_info();
|
|
12508
12547
|
init_sync_fs_wire();
|
|
12509
12548
|
init_process_fds();
|
|
12510
12549
|
init_procfs();
|
|
@@ -12565,7 +12604,16 @@ var init_wasi_procfs = __esm({
|
|
|
12565
12604
|
if (!/^[1-9]\d*$/.test(top) || !this.alive(Number(top))) return void 0;
|
|
12566
12605
|
if (leaf === "task") return this.task(Number(top), rest2);
|
|
12567
12606
|
if (rest2.length > 0) return void 0;
|
|
12568
|
-
if (leaf === void 0)
|
|
12607
|
+
if (leaf === void 0) {
|
|
12608
|
+
const exe = () => this.info(Number(top))?.exe === void 0 ? [] : ["exe"];
|
|
12609
|
+
return { kind: "dir", names: () => [...PID_NAMES, ...exe(), "task"] };
|
|
12610
|
+
}
|
|
12611
|
+
if (leaf === "exe") {
|
|
12612
|
+
const info = this.info(Number(top));
|
|
12613
|
+
if (info?.exe === void 0) return void 0;
|
|
12614
|
+
const denied = !mayTrace(this.ownInfo(), info);
|
|
12615
|
+
return { kind: "link", target: info.exe, ...denied ? { denied } : {} };
|
|
12616
|
+
}
|
|
12569
12617
|
if (!PID_NAMES.includes(leaf)) return void 0;
|
|
12570
12618
|
return {
|
|
12571
12619
|
kind: "file",
|
|
@@ -12577,6 +12625,10 @@ var init_wasi_procfs = __esm({
|
|
|
12577
12625
|
}
|
|
12578
12626
|
};
|
|
12579
12627
|
}
|
|
12628
|
+
ownInfo() {
|
|
12629
|
+
const processes2 = this.listing().processes;
|
|
12630
|
+
return processes2.find((p) => p.tid === this.pid) ?? processes2.find((p) => p.pid === this.pid);
|
|
12631
|
+
}
|
|
12580
12632
|
info(pid) {
|
|
12581
12633
|
return this.listing().processes.find((p) => p.pid === pid);
|
|
12582
12634
|
}
|
|
@@ -12640,6 +12692,7 @@ var init_wasi_procfs = __esm({
|
|
|
12640
12692
|
readlink(path) {
|
|
12641
12693
|
const node = this.find(path, false);
|
|
12642
12694
|
if (node.kind !== "link") throw syncError("EINVAL", path);
|
|
12695
|
+
if (node.denied) throw syncError("EACCES", path);
|
|
12643
12696
|
return node.target;
|
|
12644
12697
|
}
|
|
12645
12698
|
exists(path) {
|