-
Notifications
You must be signed in to change notification settings - Fork 1
/
fishnet_external.patch
350 lines (324 loc) · 13.6 KB
/
fishnet_external.patch
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
Subject: [PATCH] fishnet_external
---
Index: fishnet/src/main/cpp/external/unwinding/libunwindstack/AndroidUnwinder.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/unwinding/libunwindstack/AndroidUnwinder.cpp b/fishnet/src/main/cpp/external/unwinding/libunwindstack/AndroidUnwinder.cpp
--- a/fishnet/src/main/cpp/external/unwinding/libunwindstack/AndroidUnwinder.cpp (revision c7b83a52e8dbe29735e74f0abee1fe565a7ced5b)
+++ b/fishnet/src/main/cpp/external/unwinding/libunwindstack/AndroidUnwinder.cpp (date 1732625700297)
@@ -38,7 +38,7 @@
#include <unwindstack/RegsGetLocal.h>
#include <unwindstack/Unwinder.h>
-#if defined(__BIONIC__)
+#if defined(__BIONIC__) && 0
#include <bionic/reserved_signals.h>
static constexpr int kThreadUnwindSignal = BIONIC_SIGNAL_BACKTRACE;
#else
Index: fishnet/src/main/cpp/external/libziparchive/zip_archive.cc
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/libziparchive/zip_archive.cc b/fishnet/src/main/cpp/external/libziparchive/zip_archive.cc
--- a/fishnet/src/main/cpp/external/libziparchive/zip_archive.cc (revision 63f00d1ade29315dc0adac08fceae9984305205d)
+++ b/fishnet/src/main/cpp/external/libziparchive/zip_archive.cc (date 1732630504258)
@@ -18,6 +18,8 @@
* Read-only access to Zip archives, with minimal heap allocation.
*/
+#define IS_FDSAN_AVAILABLE __builtin_available(android 29, *)
+
#define LOG_TAG "ziparchive"
#include "ziparchive/zip_archive.h"
@@ -150,8 +152,12 @@
#if defined(__BIONIC__)
static uint64_t GetOwnerTag(const ZipArchive* archive) {
- return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE,
- reinterpret_cast<uint64_t>(archive));
+ if (IS_FDSAN_AVAILABLE) {
+ return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE,
+ reinterpret_cast<uint64_t>(archive));
+ } else {
+ return 0;
+ }
}
#endif
@@ -165,7 +171,9 @@
#if defined(__BIONIC__)
if (assume_ownership) {
CHECK(mapped_zip.GetFileDescriptor() >= 0 || !mapped_zip.GetBasePtr());
- android_fdsan_exchange_owner_tag(mapped_zip.GetFileDescriptor(), 0, GetOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ android_fdsan_exchange_owner_tag(mapped_zip.GetFileDescriptor(), 0, GetOwnerTag(this));
+ }
}
#endif
}
@@ -181,7 +189,11 @@
ZipArchive::~ZipArchive() {
if (close_file && mapped_zip.GetFileDescriptor() >= 0) {
#if defined(__BIONIC__)
- android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this));
+ } else {
+ close(mapped_zip.GetFileDescriptor());
+ }
#else
close(mapped_zip.GetFileDescriptor());
#endif
Index: fishnet/src/main/cpp/external/art/libartbase/base/macros.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/art/libartbase/base/macros.h b/fishnet/src/main/cpp/external/art/libartbase/base/macros.h
--- a/fishnet/src/main/cpp/external/art/libartbase/base/macros.h (revision 54cd7bf45839805d7f0f2708a6c9a65c70ca154a)
+++ b/fishnet/src/main/cpp/external/art/libartbase/base/macros.h (date 1732602113366)
@@ -20,7 +20,7 @@
#include <stddef.h> // for size_t
#include <unistd.h> // for TEMP_FAILURE_RETRY
-#include "android-base/format.h"
+// #include "android-base/format.h"
#include "android-base/macros.h"
#include "android-base/thread_annotations.h"
Index: fishnet/src/main/cpp/external/libbase/include/android-base/unique_fd.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/libbase/include/android-base/unique_fd.h b/fishnet/src/main/cpp/external/libbase/include/android-base/unique_fd.h
--- a/fishnet/src/main/cpp/external/libbase/include/android-base/unique_fd.h (revision 72bf9612eacb940beaefbabc116c9f5b293d5ad1)
+++ b/fishnet/src/main/cpp/external/libbase/include/android-base/unique_fd.h (date 1732602113366)
@@ -16,6 +16,8 @@
#pragma once
+#define IS_FDSAN_AVAILABLE __builtin_available(android 29, *)
+
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -153,19 +155,25 @@
struct DefaultCloser {
#if defined(__BIONIC__)
static void Tag(int fd, void* old_addr, void* new_addr) {
- if (android_fdsan_exchange_owner_tag) {
- uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
- reinterpret_cast<uint64_t>(old_addr));
- uint64_t new_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
- reinterpret_cast<uint64_t>(new_addr));
- android_fdsan_exchange_owner_tag(fd, old_tag, new_tag);
+ if (IS_FDSAN_AVAILABLE) {
+ if (android_fdsan_exchange_owner_tag) {
+ uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
+ reinterpret_cast<uint64_t>(old_addr));
+ uint64_t new_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
+ reinterpret_cast<uint64_t>(new_addr));
+ android_fdsan_exchange_owner_tag(fd, old_tag, new_tag);
+ }
}
}
static void Close(int fd, void* addr) {
- if (android_fdsan_close_with_tag) {
- uint64_t tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
- reinterpret_cast<uint64_t>(addr));
- android_fdsan_close_with_tag(fd, tag);
+ if (IS_FDSAN_AVAILABLE) {
+ if (android_fdsan_close_with_tag) {
+ uint64_t tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
+ reinterpret_cast<uint64_t>(addr));
+ android_fdsan_close_with_tag(fd, tag);
+ } else {
+ close(fd);
+ }
} else {
close(fd);
}
Index: fishnet/src/main/cpp/external/unwinding/libunwindstack/include/unwindstack/Maps.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/unwinding/libunwindstack/include/unwindstack/Maps.h b/fishnet/src/main/cpp/external/unwinding/libunwindstack/include/unwindstack/Maps.h
--- a/fishnet/src/main/cpp/external/unwinding/libunwindstack/include/unwindstack/Maps.h (revision c7b83a52e8dbe29735e74f0abee1fe565a7ced5b)
+++ b/fishnet/src/main/cpp/external/unwinding/libunwindstack/include/unwindstack/Maps.h (date 1732630040901)
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <functional>
#include <memory>
#include <string>
#include <vector>
Index: fishnet/src/main/cpp/external/art/libartbase/base/unix_file/fd_file.cc
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/art/libartbase/base/unix_file/fd_file.cc b/fishnet/src/main/cpp/external/art/libartbase/base/unix_file/fd_file.cc
--- a/fishnet/src/main/cpp/external/art/libartbase/base/unix_file/fd_file.cc (revision 54cd7bf45839805d7f0f2708a6c9a65c70ca154a)
+++ b/fishnet/src/main/cpp/external/art/libartbase/base/unix_file/fd_file.cc (date 1732602113366)
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define IS_FDSAN_AVAILABLE __builtin_available(android 29, *)
+
#include "fd_file.h"
#include <errno.h>
@@ -141,8 +143,12 @@
#if defined(__BIONIC__)
static uint64_t GetFdFileOwnerTag(FdFile* fd_file) {
- return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ART_FDFILE,
- reinterpret_cast<uint64_t>(fd_file));
+ if (IS_FDSAN_AVAILABLE) {
+ return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ART_FDFILE,
+ reinterpret_cast<uint64_t>(fd_file));
+ } else {
+ return 0;
+ }
}
#endif
@@ -159,8 +165,10 @@
file_path_(path),
read_only_mode_(read_only_mode) {
#if defined(__BIONIC__)
- if (fd >= 0) {
- android_fdsan_exchange_owner_tag(fd, 0, GetFdFileOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ if (fd >= 0) {
+ android_fdsan_exchange_owner_tag(fd, 0, GetFdFileOwnerTag(this));
+ }
}
#endif
}
@@ -196,8 +204,10 @@
file_path_(std::move(other.file_path_)),
read_only_mode_(other.read_only_mode_) {
#if defined(__BIONIC__)
- if (fd_ >= 0) {
- android_fdsan_exchange_owner_tag(fd_, GetFdFileOwnerTag(&other), GetFdFileOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ if (fd_ >= 0) {
+ android_fdsan_exchange_owner_tag(fd_, GetFdFileOwnerTag(&other), GetFdFileOwnerTag(this));
+ }
}
#endif
other.guard_state_ = GuardState::kClosed;
@@ -219,8 +229,10 @@
read_only_mode_ = other.read_only_mode_;
#if defined(__BIONIC__)
- if (fd_ >= 0) {
- android_fdsan_exchange_owner_tag(fd_, GetFdFileOwnerTag(&other), GetFdFileOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ if (fd_ >= 0) {
+ android_fdsan_exchange_owner_tag(fd_, GetFdFileOwnerTag(&other), GetFdFileOwnerTag(this));
+ }
}
#endif
other.guard_state_ = GuardState::kClosed;
@@ -237,8 +249,10 @@
fd_ = kInvalidFd;
guard_state_ = GuardState::kNoCheck;
#if defined(__BIONIC__)
- if (tmp_fd >= 0) {
- android_fdsan_exchange_owner_tag(tmp_fd, GetFdFileOwnerTag(this), 0);
+ if (IS_FDSAN_AVAILABLE) {
+ if (tmp_fd >= 0) {
+ android_fdsan_exchange_owner_tag(tmp_fd, GetFdFileOwnerTag(this), 0);
+ }
}
#endif
return tmp_fd;
@@ -253,8 +267,10 @@
fd_ = fd;
#if defined(__BIONIC__)
- if (fd_ >= 0) {
- android_fdsan_exchange_owner_tag(fd_, 0, GetFdFileOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ if (fd_ >= 0) {
+ android_fdsan_exchange_owner_tag(fd_, 0, GetFdFileOwnerTag(this));
+ }
}
#endif
@@ -302,7 +318,9 @@
}
#if defined(__BIONIC__)
- android_fdsan_exchange_owner_tag(fd_, 0, GetFdFileOwnerTag(this));
+ if (IS_FDSAN_AVAILABLE) {
+ android_fdsan_exchange_owner_tag(fd_, 0, GetFdFileOwnerTag(this));
+ }
#endif
file_path_ = path;
@@ -319,7 +337,12 @@
int FdFile::Close() {
#if defined(__BIONIC__)
- int result = android_fdsan_close_with_tag(fd_, GetFdFileOwnerTag(this));
+ int result;
+ if (IS_FDSAN_AVAILABLE) {
+ result = android_fdsan_close_with_tag(fd_, GetFdFileOwnerTag(this));
+ } else {
+ result = close(fd_);
+ }
#else
int result = close(fd_);
#endif
Index: fishnet/src/main/cpp/external/libbase/include/android-base/logging.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/libbase/include/android-base/logging.h b/fishnet/src/main/cpp/external/libbase/include/android-base/logging.h
--- a/fishnet/src/main/cpp/external/libbase/include/android-base/logging.h (revision 72bf9612eacb940beaefbabc116c9f5b293d5ad1)
+++ b/fishnet/src/main/cpp/external/libbase/include/android-base/logging.h (date 1732602113366)
@@ -16,6 +16,8 @@
#pragma once
+#define NDEBUG 1
+
//
// Google-style C++ logging.
//
Index: fishnet/src/main/cpp/external/unwinding/libunwindstack/Memory.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/unwinding/libunwindstack/Memory.cpp b/fishnet/src/main/cpp/external/unwinding/libunwindstack/Memory.cpp
--- a/fishnet/src/main/cpp/external/unwinding/libunwindstack/Memory.cpp (revision c7b83a52e8dbe29735e74f0abee1fe565a7ced5b)
+++ b/fishnet/src/main/cpp/external/unwinding/libunwindstack/Memory.cpp (date 1732629848383)
@@ -22,7 +22,7 @@
#include <sys/ptrace.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/uio.h>
+#include <sys/uio_compat.h>
#include <unistd.h>
#include <algorithm>
@@ -95,7 +95,7 @@
++iovecs_used;
}
- ssize_t rc = process_vm_readv(pid, &dst_iov, 1, src_iovs, iovecs_used, 0);
+ ssize_t rc = process_vm_readv_compat(pid, &dst_iov, 1, src_iovs, iovecs_used, 0);
if (rc == -1) {
return total_read;
}
Index: fishnet/src/main/cpp/external/libziparchive/include/ziparchive/zip_writer.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fishnet/src/main/cpp/external/libziparchive/include/ziparchive/zip_writer.h b/fishnet/src/main/cpp/external/libziparchive/include/ziparchive/zip_writer.h
--- a/fishnet/src/main/cpp/external/libziparchive/include/ziparchive/zip_writer.h (revision 63f00d1ade29315dc0adac08fceae9984305205d)
+++ b/fishnet/src/main/cpp/external/libziparchive/include/ziparchive/zip_writer.h (date 1732602113366)
@@ -19,7 +19,7 @@
#include <cstdio>
#include <ctime>
-#include <gtest/gtest_prod.h>
+// #include <gtest/gtest_prod.h>
#include <memory>
#include <string>
#include <string_view>
@@ -191,5 +191,5 @@
std::unique_ptr<z_stream, void (*)(z_stream*)> z_stream_;
std::vector<uint8_t> buffer_;
- FRIEND_TEST(zipwriter, WriteToUnseekableFile);
+ // FRIEND_TEST(zipwriter, WriteToUnseekableFile);
};