@ai-ecoverse/slicc-kernel 1.102.0 → 1.102.1

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.
@@ -2458,6 +2458,11 @@ function devRemoval(path, cred) {
2458
2458
  if (cred && cred.euid !== 0) return "EACCES";
2459
2459
  return path === "/dev" ? "EBUSY" : "EPERM";
2460
2460
  }
2461
+ function devCreation(path, cred) {
2462
+ if (path === "/proc" || path.startsWith("/proc/")) return "EROFS";
2463
+ if (path === "/dev" || !inDevTree(path)) return void 0;
2464
+ return cred && cred.euid !== 0 ? "EACCES" : "EPERM";
2465
+ }
2461
2466
  var SHM;
2462
2467
  var init_dev_removal = __esm({
2463
2468
  "src/fs/dev-removal.ts"() {
@@ -2475,7 +2480,7 @@ var KERNEL_VERSION, OS_RELEASE;
2475
2480
  var init_version = __esm({
2476
2481
  "src/version.ts"() {
2477
2482
  "use strict";
2478
- KERNEL_VERSION = true ? "1.102.0" : "0.0.0-dev";
2483
+ KERNEL_VERSION = true ? "1.102.1" : "0.0.0-dev";
2479
2484
  OS_RELEASE = "6.0.0-slicc";
2480
2485
  }
2481
2486
  });
@@ -3308,6 +3313,53 @@ function kernelLink(imports, fs, memory, glue) {
3308
3313
  true
3309
3314
  );
3310
3315
  }
3316
+ function refusedCreation(Fs, heap, dirfd, ptr) {
3317
+ const name2 = cString(heap, ptr);
3318
+ const path = absoluteOf(name2, name2.startsWith("/") ? "/" : baseOf2(Fs, dirfd));
3319
+ const refused2 = devCreation(path, Fs.sliccCred);
3320
+ if (!refused2 || !Fs.lookupPath) return 0;
3321
+ try {
3322
+ Fs.lookupPath(path, { follow: false });
3323
+ return 0;
3324
+ } catch {
3325
+ return -wasiErrno(refused2);
3326
+ }
3327
+ }
3328
+ function devCreations(imports, fs, memory, glue) {
3329
+ const check = (dirfd, ptr) => {
3330
+ const Fs = fs();
3331
+ const heap = memory();
3332
+ return Fs && heap ? refusedCreation(Fs, heap, dirfd, ptr) : 0;
3333
+ };
3334
+ wrapImport(
3335
+ imports,
3336
+ "openat",
3337
+ glue,
3338
+ (own) => (dirfd, path, flags, varargs) => flags & O_CREAT && check(dirfd, path) || own(dirfd, path, flags, varargs),
3339
+ true
3340
+ );
3341
+ wrapImport(
3342
+ imports,
3343
+ "mkdirat",
3344
+ glue,
3345
+ (own) => (dirfd, path, mode) => check(dirfd, path) || own(dirfd, path, mode),
3346
+ true
3347
+ );
3348
+ wrapImport(
3349
+ imports,
3350
+ "mknodat",
3351
+ glue,
3352
+ (own) => (dirfd, path, mode, dev) => check(dirfd, path) || own(dirfd, path, mode, dev),
3353
+ true
3354
+ );
3355
+ wrapImport(
3356
+ imports,
3357
+ "symlinkat",
3358
+ glue,
3359
+ (own) => (target, dirfd, path) => check(dirfd, path) || own(target, dirfd, path),
3360
+ true
3361
+ );
3362
+ }
3311
3363
  function kernelUname(imports, hostname, memory, glue) {
3312
3364
  const fields = ["Linux", hostname, OS_RELEASE, "#1 SMP PREEMPT_DYNAMIC", "wasm32", "(none)"];
3313
3365
  const encoded = fields.map((f) => new TextEncoder().encode(f).subarray(0, UTS_FIELD - 1));
@@ -3394,6 +3446,7 @@ var init_process_fds = __esm({
3394
3446
  umask: "__syscall_umask",
3395
3447
  faccessat: "__syscall_faccessat",
3396
3448
  linkat: "__syscall_linkat",
3449
+ symlinkat: "__syscall_symlinkat",
3397
3450
  uname: "__syscall_uname",
3398
3451
  utimensat: "__syscall_utimensat",
3399
3452
  getppid: "slicc_getppid_js",
@@ -5638,6 +5691,7 @@ function kernelWrappers(imports, module, deps) {
5638
5691
  noFollowUtimes(imports, fsOf, kernelGlue?.utimensat ?? utimensatOf(module), memory);
5639
5692
  kernelAccess(imports, fsOf, memory, kernelGlue);
5640
5693
  kernelLink(imports, fsOf, memory, kernelGlue);
5694
+ devCreations(imports, fsOf, memory, kernelGlue);
5641
5695
  kernelUname(imports, hostnameOf(init.env), memory, kernelGlue);
5642
5696
  const glue = ownValue(module, "sliccFdImports");
5643
5697
  syncFsync(imports, fsOf, glue);
@@ -5957,6 +6011,7 @@ var init_process_runtime = __esm({
5957
6011
  " umask: typeof ___syscall_umask === 'function' ? ___syscall_umask : undefined,",
5958
6012
  " faccessat: typeof ___syscall_faccessat === 'function' ? ___syscall_faccessat : undefined,",
5959
6013
  " linkat: typeof ___syscall_linkat === 'function' ? ___syscall_linkat : undefined,",
6014
+ " symlinkat: typeof ___syscall_symlinkat === 'function' ? ___syscall_symlinkat : undefined,",
5960
6015
  " uname: typeof ___syscall_uname === 'function' ? ___syscall_uname : undefined,",
5961
6016
  " utimensat: typeof ___syscall_utimensat === 'function' ? ___syscall_utimensat : undefined,",
5962
6017
  " getppid: typeof _slicc_getppid_js === 'function' ? _slicc_getppid_js : undefined,",