@ai-ecoverse/slicc-kernel 1.102.0 → 1.102.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.
@@ -1374,6 +1374,11 @@ function devRemoval(path, cred) {
1374
1374
  if (cred && cred.euid !== 0) return "EACCES";
1375
1375
  return path === "/dev" ? "EBUSY" : "EPERM";
1376
1376
  }
1377
+ function devCreation(path, cred) {
1378
+ if (path === "/proc" || path.startsWith("/proc/")) return "EROFS";
1379
+ if (path === "/dev" || !inDevTree(path)) return void 0;
1380
+ return cred && cred.euid !== 0 ? "EACCES" : "EPERM";
1381
+ }
1377
1382
  var SHM;
1378
1383
  var init_dev_removal = __esm({
1379
1384
  "src/fs/dev-removal.ts"() {
@@ -4769,7 +4774,7 @@ var KERNEL_VERSION, OS_RELEASE;
4769
4774
  var init_version = __esm({
4770
4775
  "src/version.ts"() {
4771
4776
  "use strict";
4772
- KERNEL_VERSION = true ? "1.102.0" : "0.0.0-dev";
4777
+ KERNEL_VERSION = true ? "1.102.2" : "0.0.0-dev";
4773
4778
  OS_RELEASE = "6.0.0-slicc";
4774
4779
  }
4775
4780
  });
@@ -8579,6 +8584,53 @@ function kernelLink(imports, fs, memory, glue) {
8579
8584
  true
8580
8585
  );
8581
8586
  }
8587
+ function refusedCreation(Fs, heap, dirfd, ptr) {
8588
+ const name2 = cString(heap, ptr);
8589
+ const path = absoluteOf(name2, name2.startsWith("/") ? "/" : baseOf3(Fs, dirfd));
8590
+ const refused3 = devCreation(path, Fs.sliccCred);
8591
+ if (!refused3 || !Fs.lookupPath) return 0;
8592
+ try {
8593
+ Fs.lookupPath(path, { follow: false });
8594
+ return 0;
8595
+ } catch {
8596
+ return -wasiErrno(refused3);
8597
+ }
8598
+ }
8599
+ function devCreations(imports, fs, memory, glue) {
8600
+ const check = (dirfd, ptr) => {
8601
+ const Fs = fs();
8602
+ const heap = memory();
8603
+ return Fs && heap ? refusedCreation(Fs, heap, dirfd, ptr) : 0;
8604
+ };
8605
+ wrapImport(
8606
+ imports,
8607
+ "openat",
8608
+ glue,
8609
+ (own) => (dirfd, path, flags, varargs) => flags & O_CREAT && check(dirfd, path) || own(dirfd, path, flags, varargs),
8610
+ true
8611
+ );
8612
+ wrapImport(
8613
+ imports,
8614
+ "mkdirat",
8615
+ glue,
8616
+ (own) => (dirfd, path, mode) => check(dirfd, path) || own(dirfd, path, mode),
8617
+ true
8618
+ );
8619
+ wrapImport(
8620
+ imports,
8621
+ "mknodat",
8622
+ glue,
8623
+ (own) => (dirfd, path, mode, dev) => check(dirfd, path) || own(dirfd, path, mode, dev),
8624
+ true
8625
+ );
8626
+ wrapImport(
8627
+ imports,
8628
+ "symlinkat",
8629
+ glue,
8630
+ (own) => (target, dirfd, path) => check(dirfd, path) || own(target, dirfd, path),
8631
+ true
8632
+ );
8633
+ }
8582
8634
  function kernelUname(imports, hostname, memory, glue) {
8583
8635
  const fields = ["Linux", hostname, OS_RELEASE, "#1 SMP PREEMPT_DYNAMIC", "wasm32", "(none)"];
8584
8636
  const encoded = fields.map((f) => new TextEncoder().encode(f).subarray(0, UTS_FIELD - 1));
@@ -8665,6 +8717,7 @@ var init_process_fds = __esm({
8665
8717
  umask: "__syscall_umask",
8666
8718
  faccessat: "__syscall_faccessat",
8667
8719
  linkat: "__syscall_linkat",
8720
+ symlinkat: "__syscall_symlinkat",
8668
8721
  uname: "__syscall_uname",
8669
8722
  utimensat: "__syscall_utimensat",
8670
8723
  getppid: "slicc_getppid_js",
@@ -12781,6 +12834,7 @@ function kernelWrappers(imports, module, deps) {
12781
12834
  noFollowUtimes(imports, fsOf, kernelGlue?.utimensat ?? utimensatOf(module), memory);
12782
12835
  kernelAccess(imports, fsOf, memory, kernelGlue);
12783
12836
  kernelLink(imports, fsOf, memory, kernelGlue);
12837
+ devCreations(imports, fsOf, memory, kernelGlue);
12784
12838
  kernelUname(imports, hostnameOf(init.env), memory, kernelGlue);
12785
12839
  const glue = ownValue(module, "sliccFdImports");
12786
12840
  syncFsync(imports, fsOf, glue);
@@ -13100,6 +13154,7 @@ var init_process_runtime = __esm({
13100
13154
  " umask: typeof ___syscall_umask === 'function' ? ___syscall_umask : undefined,",
13101
13155
  " faccessat: typeof ___syscall_faccessat === 'function' ? ___syscall_faccessat : undefined,",
13102
13156
  " linkat: typeof ___syscall_linkat === 'function' ? ___syscall_linkat : undefined,",
13157
+ " symlinkat: typeof ___syscall_symlinkat === 'function' ? ___syscall_symlinkat : undefined,",
13103
13158
  " uname: typeof ___syscall_uname === 'function' ? ___syscall_uname : undefined,",
13104
13159
  " utimensat: typeof ___syscall_utimensat === 'function' ? ___syscall_utimensat : undefined,",
13105
13160
  " getppid: typeof _slicc_getppid_js === 'function' ? _slicc_getppid_js : undefined,",