frida-fs 5.2.1 → 5.2.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.
Files changed (2) hide show
  1. package/dist/index.js +74 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -537,6 +537,24 @@ const statFields = new Set([
537
537
  "ctime",
538
538
  "birthtime",
539
539
  ]);
540
+ const statSpecGenericLinux32 = {
541
+ size: 88,
542
+ fields: {
543
+ "dev": [0, "U64"],
544
+ "mode": [16, "U32"],
545
+ "nlink": [20, "U32"],
546
+ "ino": [12, "U32"],
547
+ "uid": [24, "U32"],
548
+ "gid": [28, "U32"],
549
+ "rdev": [32, "U64"],
550
+ "atime": [56, readTimespec32],
551
+ "mtime": [64, readTimespec32],
552
+ "ctime": [72, readTimespec32],
553
+ "size": [44, "S32"],
554
+ "blocks": [52, "S32"],
555
+ "blksize": [48, "S32"],
556
+ }
557
+ };
540
558
  const statSpecs = {
541
559
  "windows": {
542
560
  size: 36,
@@ -595,25 +613,45 @@ const statSpecs = {
595
613
  "blksize": [112, "S32"],
596
614
  }
597
615
  },
598
- "linux-32": {
599
- size: 88,
616
+ "linux-ia32": statSpecGenericLinux32,
617
+ "linux-ia32-stat64": {
618
+ size: 96,
600
619
  fields: {
601
620
  "dev": [0, "U64"],
602
621
  "mode": [16, "U32"],
603
622
  "nlink": [20, "U32"],
604
- "ino": [12, "U32"],
623
+ "ino": [88, "U64"],
605
624
  "uid": [24, "U32"],
606
625
  "gid": [28, "U32"],
607
626
  "rdev": [32, "U64"],
608
- "atime": [56, readTimespec32],
609
- "mtime": [64, readTimespec32],
610
- "ctime": [72, readTimespec32],
611
- "size": [44, "S32"],
612
- "blocks": [52, "S32"],
613
- "blksize": [48, "S32"],
614
- }
627
+ "atime": [64, readTimespec32],
628
+ "mtime": [72, readTimespec32],
629
+ "ctime": [80, readTimespec32],
630
+ "size": [44, "S64"],
631
+ "blocks": [56, "S64"],
632
+ "blksize": [52, "S32"],
633
+ },
634
+ },
635
+ "linux-x64": {
636
+ size: 144,
637
+ fields: {
638
+ "dev": [0, "U64"],
639
+ "mode": [24, "U32"],
640
+ "nlink": [16, "U64"],
641
+ "ino": [8, "U64"],
642
+ "uid": [28, "U32"],
643
+ "gid": [32, "U32"],
644
+ "rdev": [40, "U64"],
645
+ "atime": [72, readTimespec64],
646
+ "mtime": [88, readTimespec64],
647
+ "ctime": [104, readTimespec64],
648
+ "size": [48, "S64"],
649
+ "blocks": [64, "S64"],
650
+ "blksize": [56, "S64"],
651
+ },
615
652
  },
616
- "linux-32-stat64": {
653
+ "linux-arm": statSpecGenericLinux32,
654
+ "linux-arm-stat64": {
617
655
  size: 104,
618
656
  fields: {
619
657
  "dev": [0, "U64"],
@@ -631,25 +669,33 @@ const statSpecs = {
631
669
  "blksize": [56, "S32"],
632
670
  }
633
671
  },
634
- "linux-64": {
635
- size: 144,
672
+ "linux-arm64": {
673
+ size: 128,
636
674
  fields: {
637
675
  "dev": [0, "U64"],
638
- "mode": [24, "U32"],
639
- "nlink": [16, "U64"],
676
+ "mode": [16, "U32"],
677
+ "nlink": [20, "U32"],
640
678
  "ino": [8, "U64"],
641
- "uid": [28, "U32"],
642
- "gid": [32, "U32"],
643
- "rdev": [40, "U64"],
679
+ "uid": [24, "U32"],
680
+ "gid": [28, "U32"],
681
+ "rdev": [32, "U64"],
644
682
  "atime": [72, readTimespec64],
645
683
  "mtime": [88, readTimespec64],
646
684
  "ctime": [104, readTimespec64],
647
685
  "size": [48, "S64"],
648
686
  "blocks": [64, "S64"],
649
- "blksize": [56, "S64"],
687
+ "blksize": [56, "S32"],
650
688
  },
651
689
  },
652
690
  };
691
+ const linuxStatVersions = {
692
+ ia32: 3,
693
+ x64: 1,
694
+ arm: 3,
695
+ arm64: 0,
696
+ mips: 3,
697
+ };
698
+ const STAT_VER_LINUX = linuxStatVersions[Process.arch];
653
699
  let cachedStatSpec = null;
654
700
  const statBufSize = 256;
655
701
  function getStatSpec() {
@@ -662,14 +708,19 @@ function getStatSpec() {
662
708
  else {
663
709
  const api = getPosixApi();
664
710
  const stat64Impl = api.stat64 ?? api.__xstat64;
665
- let platformId = `${platform}-${pointerSize * 8}`;
666
- if (platformId === "linux-32") {
667
- if (stat64Impl !== undefined)
711
+ let platformId;
712
+ if (platform === "darwin") {
713
+ platformId = `darwin-${pointerSize * 8}`;
714
+ }
715
+ else {
716
+ platformId = `${platform}-${Process.arch}`;
717
+ if (pointerSize === 4 && stat64Impl !== undefined) {
668
718
  platformId += "-stat64";
719
+ }
669
720
  }
670
721
  statSpec = statSpecs[platformId];
671
722
  if (statSpec === undefined)
672
- throw new Error("Current OS is not yet supported; please open a PR");
723
+ throw new Error("Current OS/arch combo is not yet supported; please open a PR");
673
724
  statSpec._stat = stat64Impl ?? api.stat;
674
725
  statSpec._lstat = api.lstat64 ?? api.__lxstat64 ?? api.lstat;
675
726
  }
@@ -897,7 +948,6 @@ function _getPosixApi() {
897
948
  ]);
898
949
  }
899
950
  function invokeXstat(impl, path, buf) {
900
- const STAT_VER_LINUX = 3;
901
951
  return impl(STAT_VER_LINUX, path, buf);
902
952
  }
903
953
  function makeApi(spec) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-fs",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "description": "Create a stream from a filesystem resource",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",