File: 006-use-sandbox-hook-for-open-object-file.patch

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (70 lines) | stat: -rw-r--r-- 2,983 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff --git a/base/third_party/symbolize/symbolize.cc b/base/third_party/symbolize/symbolize.cc
index 3c72fd1183f48..20d4d4106d65b 100644
--- a/base/third_party/symbolize/symbolize.cc
+++ b/base/third_party/symbolize/symbolize.cc
@@ -491,11 +491,12 @@ static char *GetHex(const char *start, const char *end, uint64_t *hex) {
   return const_cast<char *>(p);
 }
 
-int OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
-                                                 uint64_t& start_address,
-                                                 uint64_t& base_address,
-                                                 char* out_file_name,
-                                                 size_t out_file_name_size) {
+static int OpenObjectFileContainingPcAndGetStartAddressNoHook(
+    uint64_t pc,
+    uint64_t& start_address,
+    uint64_t& base_address,
+    char* out_file_name,
+    size_t out_file_name_size) {
   int object_fd;
 
   int maps_fd;
@@ -645,6 +646,20 @@ int OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
   }
 }
 
+int OpenObjectFileContainingPcAndGetStartAddress(
+    uint64_t pc,
+    uint64_t& start_address,
+    uint64_t& base_address,
+    char* out_file_name,
+    size_t out_file_name_size) {
+  if (g_symbolize_open_object_file_callback) {
+    return g_symbolize_open_object_file_callback(
+        pc, start_address, base_address, out_file_name, out_file_name_size);
+  }
+  return OpenObjectFileContainingPcAndGetStartAddressNoHook(
+      pc, start_address, base_address, out_file_name, out_file_name_size);
+}
+
 // POSIX doesn't define any async-signal safe function for converting
 // an integer to ASCII. We'll have to define our own version.
 // itoa_r() converts an (unsigned) integer to ASCII. It returns "buf", if the
@@ -734,7 +749,6 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
   uint64_t pc0 = reinterpret_cast<uintptr_t>(pc);
   uint64_t start_address = 0;
   uint64_t base_address = 0;
-  int object_fd = -1;
 
   if (out_size < 1) {
     return false;
@@ -742,16 +756,8 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
   out[0] = '\0';
   SafeAppendString("(", out, out_size);
 
-  if (g_symbolize_open_object_file_callback) {
-    object_fd = g_symbolize_open_object_file_callback(pc0, start_address,
-                                                      base_address, out + 1,
-                                                      out_size - 1);
-  } else {
-    object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address,
-                                                             base_address,
-                                                             out + 1,
-                                                             out_size - 1);
-  }
+  int object_fd = OpenObjectFileContainingPcAndGetStartAddress(
+      pc0, start_address, base_address, out + 1, out_size - 1);
 
   FileDescriptor wrapped_object_fd(object_fd);