@ai-ecoverse/slicc-kernel 1.103.1 → 1.103.3
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 +1 -1
- package/dist/kernel-worker.js +29 -3
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +123 -84
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +29 -3
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +45 -6
- package/dist/process-worker.js.map +3 -3
- package/dist/types/kernel/children.d.ts +1 -0
- package/dist/types/kernel/process.d.ts +1 -0
- package/dist/types/kernel/run-child.d.ts +1 -0
- package/dist/types/launcher.d.ts +1 -0
- package/dist/types/process/wasi/wasi-files.d.ts +1 -1
- package/dist/types/realm/emscripten-vfs-hook.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Runs `argv[0]` with `argv` as its arguments and resolves when it exits. `stdout`
|
|
|
54
54
|
|
|
55
55
|
| option | |
|
|
56
56
|
| --- | --- |
|
|
57
|
-
| `cwd` | working directory, default `/`; created in OPFS if missing |
|
|
57
|
+
| `cwd` | working directory, default `/`; created in OPFS if missing. Under `users: 'enforce'`, a `cwd` the user can't search rejects with `code: 'EACCES'` (`cannot change to <cwd>: Permission denied`) and starts nothing, as a `chdir` there fails on Linux; `openTerminal` does the same. A program's spawn with its own `cwd` (`ctx.spawn`, `ctx.sync.run`, a WASIX `posix_spawn` chdir action) is checked the same way and fails with `EACCES`, while a child that inherits its parent's cwd keeps it unchecked, as on Linux |
|
|
58
58
|
| `user` | the user to run as, by name or uid (see [Users](#users)); default `root`. An unknown user rejects with `code: 'ENOENT'` |
|
|
59
59
|
| `tag` | a string the kernel keeps with the process and every process it starts (fork, spawn and exec), and hands to `approve` with a [`sudo`](#sudo) request, so the embedder knows which agent asks; nothing a program does changes it. Anything but a string rejects with a `TypeError` |
|
|
60
60
|
| `env` | extra environment, over the user's defaults: `HOME`, `USER`, `LOGNAME`, `PNPM_HOME` and `PATH=$PNPM_HOME/bin:/usr/local/bin:/usr/bin:/bin` (see [Users](#users)), and `PWD=<cwd>` |
|
package/dist/kernel-worker.js
CHANGED
|
@@ -12197,7 +12197,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
|
|
|
12197
12197
|
var EARLY_WHOLE_FILE = 64 * 1024;
|
|
12198
12198
|
|
|
12199
12199
|
// src/version.ts
|
|
12200
|
-
var KERNEL_VERSION = true ? "1.103.
|
|
12200
|
+
var KERNEL_VERSION = true ? "1.103.3" : "0.0.0-dev";
|
|
12201
12201
|
var OS_RELEASE = "6.0.0-slicc";
|
|
12202
12202
|
function procVersion() {
|
|
12203
12203
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -14617,6 +14617,7 @@ async function runChild(req, deps) {
|
|
|
14617
14617
|
...req.argv0 !== void 0 ? { argv0: req.argv0 } : {},
|
|
14618
14618
|
env: req.env,
|
|
14619
14619
|
cwd: req.cwd,
|
|
14620
|
+
...req.chdir ? { chdir: req.chdir } : {},
|
|
14620
14621
|
...req.pgid !== void 0 ? { pgid: req.pgid } : {},
|
|
14621
14622
|
...req.session ? { session: req.session } : {}
|
|
14622
14623
|
},
|
|
@@ -16099,13 +16100,23 @@ var WasmProcess = class {
|
|
|
16099
16100
|
return "deliver";
|
|
16100
16101
|
}
|
|
16101
16102
|
async spawn(req) {
|
|
16102
|
-
const { file, argv, argv0, env, cwd, stdio, inherit: inherit2, exec, pgid, session, deathSignal } = req;
|
|
16103
|
+
const { file, argv, argv0, env, cwd, chdir, stdio, inherit: inherit2, exec, pgid, session, deathSignal } = req;
|
|
16103
16104
|
if (deathSignal !== void 0 && (exec || !isSignal(deathSignal))) {
|
|
16104
16105
|
throw new KernelError("EINVAL");
|
|
16105
16106
|
}
|
|
16106
16107
|
const group = { ...pgid !== void 0 ? { pgid } : {}, ...session ? { session } : {} };
|
|
16107
16108
|
const named = argv0 !== void 0 ? { argv0 } : {};
|
|
16108
|
-
const
|
|
16109
|
+
const moved2 = chdir ? { chdir } : {};
|
|
16110
|
+
const spawned = {
|
|
16111
|
+
file,
|
|
16112
|
+
argv,
|
|
16113
|
+
...named,
|
|
16114
|
+
env,
|
|
16115
|
+
cwd,
|
|
16116
|
+
...moved2,
|
|
16117
|
+
...group,
|
|
16118
|
+
...exec ? { exec } : {}
|
|
16119
|
+
};
|
|
16109
16120
|
const pid = await this.children.spawn(spawned, stdio, inherit2);
|
|
16110
16121
|
if (deathSignal !== void 0) this.onDeath(pgid === 0 || session ? -pid : pid, deathSignal);
|
|
16111
16122
|
if (!exec) return pid;
|
|
@@ -21521,6 +21532,13 @@ var Launcher = class {
|
|
|
21521
21532
|
await fds.closeAll();
|
|
21522
21533
|
throw new SpawnError(await this.unrunnable(file, req.cwd, scope));
|
|
21523
21534
|
}
|
|
21535
|
+
async enterable(g, cwd) {
|
|
21536
|
+
if (!g) return;
|
|
21537
|
+
const denied2 = new Error(`cannot change to ${cwd}: Permission denied`);
|
|
21538
|
+
await need(g, "chdir", cwd, X_OK, { directory: true }).catch((err) => {
|
|
21539
|
+
throw err.code === "EACCES" ? Object.assign(denied2, { code: "EACCES" }) : err;
|
|
21540
|
+
});
|
|
21541
|
+
}
|
|
21524
21542
|
execGuard(cred, pid, tag) {
|
|
21525
21543
|
const { dac } = this;
|
|
21526
21544
|
return dac && { fs: this.fs, cred, pid, dac, tag, links: this.links.get(pid) };
|
|
@@ -22137,6 +22155,13 @@ var Launcher = class {
|
|
|
22137
22155
|
throw new SpawnError(group);
|
|
22138
22156
|
}
|
|
22139
22157
|
const cred = grant ? grant.cred : this.credOf(ppid);
|
|
22158
|
+
if (req.chdir && !grant) {
|
|
22159
|
+
const g = this.execGuard(cred, ppid);
|
|
22160
|
+
await this.enterable(g, req.cwd).catch(async (err) => {
|
|
22161
|
+
await fds.closeAll();
|
|
22162
|
+
throw err.code === "EACCES" ? new SpawnError("EACCES") : err;
|
|
22163
|
+
});
|
|
22164
|
+
}
|
|
22140
22165
|
const scope = grant ? "" : await this.scopeOf(cred.euid);
|
|
22141
22166
|
const file = booked === void 0 ? req.file : await this.ticketFile(req, fds);
|
|
22142
22167
|
const planned = await this.checkedPlan({ ...req, file }, { ppid, cred, scope }, fds);
|
|
@@ -22733,6 +22758,7 @@ var Launcher = class {
|
|
|
22733
22758
|
const scope = account.uid === 0 ? "" : pnpmHomeOf(account, this.pnpmHome);
|
|
22734
22759
|
const start2 = dir ?? "/";
|
|
22735
22760
|
const cwd = await physicalPathAsync(this.base, start2.startsWith("/") ? start2 : `/${start2}`);
|
|
22761
|
+
await this.enterable(this.execGuard(credOf(account), 0, tag), cwd);
|
|
22736
22762
|
const file = await this.execFile(argv[0] ?? "", cwd, this.execGuard(credOf(account), 0, tag));
|
|
22737
22763
|
if (!await this.base.exists(cwd)) await this.stackFor(tag).fs.mkdir(cwd, { recursive: true });
|
|
22738
22764
|
const planned = await this.plan(file, argv, cwd, scope);
|