frida 16.6.6 → 16.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida",
3
- "version": "16.6.6",
3
+ "version": "16.7.3",
4
4
  "authors": [
5
5
  "Frida Developers"
6
6
  ],
package/releng/deps.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [dependencies]
2
- version = "20250114"
3
- bootstrap_version = "20250109"
2
+ version = "20250321"
3
+ bootstrap_version = "20250114"
4
4
 
5
5
  [ninja]
6
6
  scope = "toolchain"
@@ -102,15 +102,6 @@ dependencies = [
102
102
  """ }
103
103
  ]
104
104
 
105
- [elfutils]
106
- when = "machine.os in {'linux', 'android', 'qnx'}"
107
- name = "elfutils"
108
- version = "1284bbc128473aea220337685985d465607fbac8"
109
- url = "https://github.com/frida/elfutils.git"
110
- dependencies = [
111
- "zlib",
112
- ]
113
-
114
105
  [libdwarf]
115
106
  when = "machine.os in {'linux', 'android', 'freebsd', 'qnx'}"
116
107
  name = "libdwarf"
@@ -119,9 +110,6 @@ url = "https://github.com/frida/libdwarf.git"
119
110
  options = [
120
111
  "-Ddecompression=false",
121
112
  ]
122
- dependencies = [
123
- { id = "elfutils", when = "machine.os != 'freebsd'" },
124
- ]
125
113
 
126
114
  [xz]
127
115
  name = "XZ Utils"
@@ -374,12 +362,13 @@ options = [
374
362
  [v8]
375
363
  when = """ \
376
364
  machine.config != 'mingw' \
365
+ and machine.arch != 'arm64beilp32' \
377
366
  and not machine.arch.startswith('mips') \
378
367
  and not machine.arch.startswith('powerpc') \
379
368
  and machine.os != 'qnx' \
380
369
  """
381
370
  name = "V8"
382
- version = "9492bfc5ca8615be651b85336caafa8f3c730cd7"
371
+ version = "a7b09c3d8b16199ef8664c66559d2530c293b8cf"
383
372
  url = "https://github.com/frida/v8.git"
384
373
  options = [
385
374
  "-Ddebug=false",
@@ -3,13 +3,11 @@
3
3
  #include <fcntl.h>
4
4
  #include <unistd.h>
5
5
 
6
- typedef struct _ExampleListener ExampleListener;
6
+ typedef struct _ExampleListenerData ExampleListenerData;
7
7
  typedef enum _ExampleHookId ExampleHookId;
8
8
 
9
- struct _ExampleListener
9
+ struct _ExampleListenerData
10
10
  {
11
- GObject parent;
12
-
13
11
  guint num_calls;
14
12
  };
15
13
 
@@ -19,51 +17,48 @@ enum _ExampleHookId
19
17
  EXAMPLE_HOOK_CLOSE
20
18
  };
21
19
 
22
- static void example_listener_iface_init (gpointer g_iface, gpointer iface_data);
23
-
24
- #define EXAMPLE_TYPE_LISTENER (example_listener_get_type ())
25
- G_DECLARE_FINAL_TYPE (ExampleListener, example_listener, EXAMPLE, LISTENER, GObject)
26
- G_DEFINE_TYPE_EXTENDED (ExampleListener,
27
- example_listener,
28
- G_TYPE_OBJECT,
29
- 0,
30
- G_IMPLEMENT_INTERFACE (GUM_TYPE_INVOCATION_LISTENER,
31
- example_listener_iface_init))
20
+ static void example_listener_on_enter (GumInvocationContext * ic, gpointer user_data);
21
+ static void example_listener_on_leave (GumInvocationContext * ic, gpointer user_data);
32
22
 
33
23
  int
34
24
  main (int argc,
35
25
  char * argv[])
36
26
  {
37
27
  GumInterceptor * interceptor;
28
+ ExampleListenerData * data;
38
29
  GumInvocationListener * listener;
39
30
 
40
31
  gum_init_embedded ();
41
32
 
42
33
  interceptor = gum_interceptor_obtain ();
43
- listener = g_object_new (EXAMPLE_TYPE_LISTENER, NULL);
34
+
35
+ data = g_new0 (ExampleListenerData, 1);
36
+ listener = gum_make_call_listener (example_listener_on_enter, example_listener_on_leave, data, g_free);
44
37
 
45
38
  gum_interceptor_begin_transaction (interceptor);
46
39
  gum_interceptor_attach (interceptor,
47
- GSIZE_TO_POINTER (gum_module_find_export_by_name (NULL, "open")),
40
+ GSIZE_TO_POINTER (gum_module_find_global_export_by_name ("open")),
48
41
  listener,
49
- GSIZE_TO_POINTER (EXAMPLE_HOOK_OPEN));
42
+ GSIZE_TO_POINTER (EXAMPLE_HOOK_OPEN),
43
+ GUM_ATTACH_FLAGS_NONE);
50
44
  gum_interceptor_attach (interceptor,
51
- GSIZE_TO_POINTER (gum_module_find_export_by_name (NULL, "close")),
45
+ GSIZE_TO_POINTER (gum_module_find_global_export_by_name ("close")),
52
46
  listener,
53
- GSIZE_TO_POINTER (EXAMPLE_HOOK_CLOSE));
47
+ GSIZE_TO_POINTER (EXAMPLE_HOOK_CLOSE),
48
+ GUM_ATTACH_FLAGS_NONE);
54
49
  gum_interceptor_end_transaction (interceptor);
55
50
 
56
51
  close (open ("/etc/hosts", O_RDONLY));
57
52
  close (open ("/etc/fstab", O_RDONLY));
58
53
 
59
- g_print ("[*] listener got %u calls\n", EXAMPLE_LISTENER (listener)->num_calls);
54
+ g_print ("[*] listener got %u calls\n", data->num_calls);
60
55
 
61
56
  gum_interceptor_detach (interceptor, listener);
62
57
 
63
58
  close (open ("/etc/hosts", O_RDONLY));
64
59
  close (open ("/etc/fstab", O_RDONLY));
65
60
 
66
- g_print ("[*] listener still has %u calls\n", EXAMPLE_LISTENER (listener)->num_calls);
61
+ g_print ("[*] listener still has %u calls\n", data->num_calls);
67
62
 
68
63
  g_object_unref (listener);
69
64
  g_object_unref (interceptor);
@@ -74,11 +69,13 @@ main (int argc,
74
69
  }
75
70
 
76
71
  static void
77
- example_listener_on_enter (GumInvocationListener * listener,
78
- GumInvocationContext * ic)
72
+ example_listener_on_enter (GumInvocationContext * ic,
73
+ gpointer user_data)
79
74
  {
80
- ExampleListener * self = EXAMPLE_LISTENER (listener);
81
- ExampleHookId hook_id = GUM_IC_GET_FUNC_DATA (ic, ExampleHookId);
75
+ ExampleListenerData * data = user_data;
76
+ ExampleHookId hook_id;
77
+
78
+ hook_id = GUM_IC_GET_FUNC_DATA (ic, ExampleHookId);
82
79
 
83
80
  switch (hook_id)
84
81
  {
@@ -90,33 +87,11 @@ example_listener_on_enter (GumInvocationListener * listener,
90
87
  break;
91
88
  }
92
89
 
93
- self->num_calls++;
94
- }
95
-
96
- static void
97
- example_listener_on_leave (GumInvocationListener * listener,
98
- GumInvocationContext * ic)
99
- {
100
- }
101
-
102
- static void
103
- example_listener_class_init (ExampleListenerClass * klass)
104
- {
105
- (void) EXAMPLE_IS_LISTENER;
106
- (void) glib_autoptr_cleanup_ExampleListener;
107
- }
108
-
109
- static void
110
- example_listener_iface_init (gpointer g_iface,
111
- gpointer iface_data)
112
- {
113
- GumInvocationListenerInterface * iface = g_iface;
114
-
115
- iface->on_enter = example_listener_on_enter;
116
- iface->on_leave = example_listener_on_leave;
90
+ data->num_calls++;
117
91
  }
118
92
 
119
93
  static void
120
- example_listener_init (ExampleListener * self)
94
+ example_listener_on_leave (GumInvocationContext * ic,
95
+ gpointer user_data)
121
96
  {
122
97
  }
@@ -11,13 +11,11 @@
11
11
 
12
12
  #include <windows.h>
13
13
 
14
- typedef struct _ExampleListener ExampleListener;
14
+ typedef struct _ExampleListenerData ExampleListenerData;
15
15
  typedef enum _ExampleHookId ExampleHookId;
16
16
 
17
- struct _ExampleListener
17
+ struct _ExampleListenerData
18
18
  {
19
- GObject parent;
20
-
21
19
  guint num_calls;
22
20
  };
23
21
 
@@ -27,52 +25,55 @@ enum _ExampleHookId
27
25
  EXAMPLE_HOOK_SLEEP
28
26
  };
29
27
 
30
- static void example_listener_iface_init (gpointer g_iface, gpointer iface_data);
31
-
32
- #define EXAMPLE_TYPE_LISTENER (example_listener_get_type ())
33
- G_DECLARE_FINAL_TYPE (ExampleListener, example_listener, EXAMPLE, LISTENER, GObject)
34
- G_DEFINE_TYPE_EXTENDED (ExampleListener,
35
- example_listener,
36
- G_TYPE_OBJECT,
37
- 0,
38
- G_IMPLEMENT_INTERFACE (GUM_TYPE_INVOCATION_LISTENER,
39
- example_listener_iface_init))
28
+ static void example_listener_on_enter (GumInvocationContext * ic, gpointer user_data);
29
+ static void example_listener_on_leave (GumInvocationContext * ic, gpointer user_data);
40
30
 
41
31
  int
42
32
  main (int argc,
43
33
  char * argv[])
44
34
  {
45
35
  GumInterceptor * interceptor;
36
+ ExampleListenerData * data;
46
37
  GumInvocationListener * listener;
38
+ GumModule * user32, * kernel32;
47
39
 
48
40
  gum_init_embedded ();
49
41
 
50
42
  interceptor = gum_interceptor_obtain ();
51
- listener = g_object_new (EXAMPLE_TYPE_LISTENER, NULL);
43
+
44
+ data = g_new0 (ExampleListenerData, 1);
45
+ listener = gum_make_call_listener (example_listener_on_enter, example_listener_on_leave, data, g_free);
46
+
47
+ user32 = gum_process_find_module_by_name ("user32.dll");
48
+ kernel32 = gum_process_find_module_by_name ("kernel32.dll");
52
49
 
53
50
  gum_interceptor_begin_transaction (interceptor);
54
51
  gum_interceptor_attach (interceptor,
55
- GSIZE_TO_POINTER (gum_module_find_export_by_name ("user32.dll", "MessageBeep")),
52
+ GSIZE_TO_POINTER (gum_module_find_export_by_name (user32, "MessageBeep")),
56
53
  listener,
57
- GSIZE_TO_POINTER (EXAMPLE_HOOK_MESSAGE_BEEP));
54
+ GSIZE_TO_POINTER (EXAMPLE_HOOK_MESSAGE_BEEP),
55
+ GUM_ATTACH_FLAGS_NONE);
58
56
  gum_interceptor_attach (interceptor,
59
- GSIZE_TO_POINTER (gum_module_find_export_by_name ("kernel32.dll", "Sleep")),
57
+ GSIZE_TO_POINTER (gum_module_find_export_by_name (kernel32, "Sleep")),
60
58
  listener,
61
- GSIZE_TO_POINTER (EXAMPLE_HOOK_SLEEP));
59
+ GSIZE_TO_POINTER (EXAMPLE_HOOK_SLEEP),
60
+ GUM_ATTACH_FLAGS_NONE);
62
61
  gum_interceptor_end_transaction (interceptor);
63
62
 
64
63
  MessageBeep (MB_ICONINFORMATION);
65
64
  Sleep (1);
66
65
 
67
- g_print ("[*] listener got %u calls\n", EXAMPLE_LISTENER (listener)->num_calls);
66
+ g_print ("[*] listener got %u calls\n", data->num_calls);
68
67
 
69
68
  gum_interceptor_detach (interceptor, listener);
70
69
 
71
70
  MessageBeep (MB_ICONINFORMATION);
72
71
  Sleep (1);
73
72
 
74
- g_print ("[*] listener still has %u calls\n", EXAMPLE_LISTENER (listener)->num_calls);
73
+ g_print ("[*] listener still has %u calls\n", data->num_calls);
75
74
 
75
+ g_object_unref (kernel32);
76
+ g_object_unref (user32);
76
77
  g_object_unref (listener);
77
78
  g_object_unref (interceptor);
78
79
 
@@ -82,11 +83,13 @@ main (int argc,
82
83
  }
83
84
 
84
85
  static void
85
- example_listener_on_enter (GumInvocationListener * listener,
86
- GumInvocationContext * ic)
86
+ example_listener_on_enter (GumInvocationContext * ic,
87
+ gpointer user_data)
87
88
  {
88
- ExampleListener * self = EXAMPLE_LISTENER (listener);
89
- ExampleHookId hook_id = GUM_IC_GET_FUNC_DATA (ic, ExampleHookId);
89
+ ExampleListenerData * data = user_data;
90
+ ExampleHookId hook_id;
91
+
92
+ hook_id = GUM_IC_GET_FUNC_DATA (ic, ExampleHookId);
90
93
 
91
94
  switch (hook_id)
92
95
  {
@@ -98,35 +101,11 @@ example_listener_on_enter (GumInvocationListener * listener,
98
101
  break;
99
102
  }
100
103
 
101
- self->num_calls++;
102
- }
103
-
104
- static void
105
- example_listener_on_leave (GumInvocationListener * listener,
106
- GumInvocationContext * ic)
107
- {
108
- }
109
-
110
- static void
111
- example_listener_class_init (ExampleListenerClass * klass)
112
- {
113
- (void) EXAMPLE_IS_LISTENER;
114
- #ifndef _MSC_VER
115
- (void) glib_autoptr_cleanup_ExampleListener;
116
- #endif
117
- }
118
-
119
- static void
120
- example_listener_iface_init (gpointer g_iface,
121
- gpointer iface_data)
122
- {
123
- GumInvocationListenerInterface * iface = g_iface;
124
-
125
- iface->on_enter = example_listener_on_enter;
126
- iface->on_leave = example_listener_on_leave;
104
+ data->num_calls++;
127
105
  }
128
106
 
129
107
  static void
130
- example_listener_init (ExampleListener * self)
108
+ example_listener_on_leave (GumInvocationContext * ic,
109
+ gpointer user_data)
131
110
  {
132
111
  }
package/releng/devkit.py CHANGED
@@ -139,7 +139,7 @@ class CompilerApplication:
139
139
  ingest_header(selinux_header, header_files, processed_header_files, devkit_header_lines)
140
140
  devkit_header = u"".join(devkit_header_lines)
141
141
 
142
- if package.startswith("frida-gumjs"):
142
+ if package.startswith("frida-gum"):
143
143
  config = """#ifndef GUM_STATIC
144
144
  # define GUM_STATIC
145
145
  #endif
package/releng/env.py CHANGED
@@ -282,6 +282,9 @@ def can_run_host_binaries(build_machine: MachineSpec,
282
282
 
283
283
  def find_exe_wrapper(machine: MachineSpec,
284
284
  environ: dict[str, str]) -> Optional[list[str]]:
285
+ if machine.arch == "arm64beilp32":
286
+ return None
287
+
285
288
  qemu_sysroot = environ.get("FRIDA_QEMU_SYSROOT")
286
289
  if qemu_sysroot is None:
287
290
  return None
@@ -417,4 +420,5 @@ QEMU_ARCHS = {
417
420
  "armhf": "arm",
418
421
  "armbe8": "armeb",
419
422
  "arm64": "aarch64",
423
+ "arm64be": "aarch64_be",
420
424
  }
@@ -133,6 +133,7 @@ ARCH_COMMON_FLAGS = {
133
133
  "-march=armv7-a",
134
134
  "-mfloat-abi=softfp",
135
135
  "-mfpu=vfpv3-d16",
136
+ "-mthumb",
136
137
  ]
137
138
  }
138
139
 
@@ -293,13 +293,15 @@ ARCH_COMMON_FLAGS_UNIX = {
293
293
  ],
294
294
  "arm": [
295
295
  "-march=armv5t",
296
+ "-mthumb",
296
297
  ],
297
298
  "armbe8": [
298
- "-march=armv6",
299
- "-mbe8",
299
+ "-mcpu=cortex-a72",
300
+ "-mthumb",
300
301
  ],
301
302
  "armhf": [
302
303
  "-march=armv7-a",
304
+ "-mthumb",
303
305
  ],
304
306
  "arm64": [
305
307
  "-march=armv8-a",
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
  from dataclasses import dataclass
3
3
  import platform
4
4
  import re
5
+ import subprocess
5
6
  from typing import Optional
6
7
 
7
8
 
@@ -14,7 +15,22 @@ class MachineSpec:
14
15
 
15
16
  @staticmethod
16
17
  def make_from_local_system() -> MachineSpec:
17
- return MachineSpec(detect_os(), detect_arch())
18
+ os = detect_os()
19
+ arch = detect_arch()
20
+ config = None
21
+
22
+ if os == "linux":
23
+ try:
24
+ output = subprocess.run(["ldd", "--version"],
25
+ stdout=subprocess.PIPE,
26
+ stderr=subprocess.STDOUT,
27
+ encoding="utf-8").stdout
28
+ if "musl" in output:
29
+ config = "musl"
30
+ except:
31
+ pass
32
+
33
+ return MachineSpec(os, arch, config)
18
34
 
19
35
  @staticmethod
20
36
  def parse(raw_spec: str) -> MachineSpec:
@@ -41,12 +57,18 @@ class MachineSpec:
41
57
  if arch[0] == "i":
42
58
  arch = "x86"
43
59
  elif arch == "arm":
44
- if system == "gnueabihf":
60
+ if system.endswith("eabihf"):
45
61
  arch = "armhf"
46
62
  elif os == "qnx" and system.endswith("eabi"):
47
63
  arch = "armeabi"
64
+ elif arch == "armeb":
65
+ arch = "armbe8"
48
66
  elif arch == "aarch64":
49
67
  arch = "arm64"
68
+ elif arch == "aarch64_be":
69
+ arch = "arm64be"
70
+ if system.endswith("_ilp32"):
71
+ arch += "ilp32"
50
72
 
51
73
  if system.startswith("musl"):
52
74
  config = "musl"
@@ -184,7 +206,7 @@ class MachineSpec:
184
206
  arch = self.arch
185
207
  if arch in {"x86_64", "s390x"}:
186
208
  return 8
187
- if arch.startswith("arm64") or arch.startswith("mips64"):
209
+ if (arch.startswith("arm64") and not arch.endswith("ilp32")) or arch.startswith("mips64"):
188
210
  return 8
189
211
  return 4
190
212
 
@@ -236,29 +258,33 @@ KERNELS = {
236
258
  }
237
259
 
238
260
  CPU_FAMILIES = {
239
- "armbe8": "arm",
240
- "armeabi": "arm",
241
- "armhf": "arm",
261
+ "armbe8": "arm",
262
+ "armeabi": "arm",
263
+ "armhf": "arm",
242
264
 
243
- "arm64": "aarch64",
244
- "arm64e": "aarch64",
245
- "arm64eoabi": "aarch64",
265
+ "arm64": "aarch64",
266
+ "arm64be": "aarch64",
267
+ "arm64beilp32": "aarch64",
268
+ "arm64e": "aarch64",
269
+ "arm64eoabi": "aarch64",
246
270
 
247
- "mipsel": "mips",
248
- "mips64el": "mips64",
271
+ "mipsel": "mips",
272
+ "mips64el": "mips64",
249
273
 
250
- "powerpc": "ppc"
274
+ "powerpc": "ppc"
251
275
  }
252
276
 
253
277
  CPU_TYPES = {
254
- "arm": "armv7",
255
- "armbe8": "armv6",
256
- "armhf": "armv7hf",
257
- "armeabi": "armv7eabi",
258
-
259
- "arm64": "aarch64",
260
- "arm64e": "aarch64",
261
- "arm64eoabi": "aarch64",
278
+ "arm": "armv7",
279
+ "armbe8": "armv6",
280
+ "armhf": "armv7hf",
281
+ "armeabi": "armv7eabi",
282
+
283
+ "arm64": "aarch64",
284
+ "arm64be": "aarch64",
285
+ "arm64beilp32": "aarch64",
286
+ "arm64e": "aarch64",
287
+ "arm64eoabi": "aarch64",
262
288
  }
263
289
 
264
290
  CPU_TYPES_PER_OS_OVERRIDES = {
@@ -283,6 +309,8 @@ CPU_TYPES_PER_OS_OVERRIDES = {
283
309
  }
284
310
 
285
311
  BIG_ENDIAN_ARCHS = {
312
+ "arm64be",
313
+ "arm64beilp32",
286
314
  "armbe8",
287
315
  "mips",
288
316
  "mips64",
@@ -291,4 +319,4 @@ BIG_ENDIAN_ARCHS = {
291
319
  "s390x",
292
320
  }
293
321
 
294
- TARGET_TRIPLET_ARCH_PATTERN = re.compile(r"^(i.86|x86_64|arm\w*|aarch64|mips\w*|powerpc|s390x)$")
322
+ TARGET_TRIPLET_ARCH_PATTERN = re.compile(r"^(i.86|x86_64|arm\w*|aarch64(_be)?|mips\w*|powerpc|s390x)$")
@@ -49,7 +49,7 @@ def main(argv: list[str]):
49
49
  cwd=abidir,
50
50
  check=True)
51
51
 
52
- abi = subprocess.run([node, "-e", f"console.log(require('node-abi').getAbi('{target}', '{runtime}'))"],
52
+ abi = subprocess.run([node, "-e", f"import('node-abi').then(abi => {{ console.log(abi.getAbi('{target}', '{runtime}')); }})"],
53
53
  capture_output=True,
54
54
  encoding="utf-8",
55
55
  cwd=abidir,
@@ -1,6 +1,6 @@
1
1
  [wrap-git]
2
2
  url = https://github.com/frida/frida-core.git
3
- revision = 16.6.6
3
+ revision = 16.7.2
4
4
  depth = 1
5
5
 
6
6
  [provide]