You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously we would add any ELF that contained a build id regardless
whether the ELF contained symbols or not. This works for Android since
soong will strip the symbols into a new directory. However other
build systems, like BUCK, will write the stripped file in the same
directory as the unstripped file. This would cause the hwasan_symbolize
script sometimes add then stripped ELF to its index and ignore the
symbolized ELF. The logic has now been changed to only add ELFs that
contain symbols to the index. If two symbolized ELFs are encountered
with the same build id, we now exit out with an error.
Fixes#135966
---------
Co-authored-by: Stefan Bossbaly <sboss@meta.com>
print("Could not find symbols for", name, file=sys.stderr)
242
+
print("Could not find symbols for {} (Build ID: {})".format(name, buildid), file=sys.stderr)
204
243
self.__warnings.add(name)
205
244
returnNone
206
245
@@ -268,13 +307,30 @@ class Symbolizer:
268
307
forfninfnames:
269
308
filename=os.path.join(dname, fn)
270
309
try:
271
-
bid=get_buildid(filename)
310
+
bid=read_elf(filename)
272
311
exceptFileNotFoundError:
273
312
continue
274
313
exceptExceptionase:
275
314
print("Failed to parse {}: {}".format(filename, e), file=sys.stderr)
276
315
continue
277
-
ifbidisnotNone:
316
+
ifbidisNone:
317
+
continue
318
+
319
+
ifbidinself.__index:
320
+
index_filename=self.__index[bid]
321
+
322
+
ifos.path.samefile(index_filename, filename):
323
+
continue
324
+
325
+
withopen(filename, "rb") asf:
326
+
file_hash=hashlib.file_digest(f, "sha256")
327
+
328
+
withopen(index_filename, "rb") asf:
329
+
index_file_hash=hashlib.file_digest(f, "sha256")
330
+
331
+
ifindex_file_hash.digest() !=file_hash.digest():
332
+
print("Build ID collision! Files share the same BuildId ({}) but their contents differ. Files {} and {} ".format(bid, filename, index_filename), file=sys.stderr)
0 commit comments