[compiler-rt] [HWASan] Fix symbol indexing (PR #135967)

Stefan Bossbaly via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 18:54:58 PDT 2025


================
@@ -268,13 +306,16 @@ class Symbolizer:
         for fn in fnames:
           filename = os.path.join(dname, fn)
           try:
-            bid = get_buildid(filename)
+            bid = read_elf(filename)
           except FileNotFoundError:
             continue
           except Exception as e:
             print("Failed to parse {}: {}".format(filename, e), file=sys.stderr)
             continue
           if bid is not None:
+            if bid in self.__index:
+              print("Duplicate build ID {} for {} and {}".format(bid, self.__index[bid], filename), file=sys.stderr)
----------------
StefanBossbaly wrote:

Added [`hashlib.file_digest`](https://docs.python.org/3/library/hashlib.html#hashlib.file_digest) check to ensure that contents of shared object with the same build id are the same. Currently using sha256.


Used [`os.path.samefile`](https://docs.python.org/3/library/os.path.html#os.path.samefile) to check for path equality before running the checksum calculation.

https://github.com/llvm/llvm-project/pull/135967


More information about the llvm-commits mailing list