Skip to content

Commit d4f6fcf

Browse files
authored
Revert "[HWASan] symbolize stack overflows" (#102951)
Reverts #95308 Broke buildbot https://lab.llvm.org/buildbot/#/builders/51/builds/2364
1 parent c642816 commit d4f6fcf

File tree

2 files changed

+3
-75
lines changed

2 files changed

+3
-75
lines changed

compiler-rt/lib/hwasan/scripts/hwasan_symbolize

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ class Symbolizer:
109109
self.__html = False
110110
self.__last_access_address = None
111111
self.__last_access_tag = None
112-
self.__tag_dump = []
113-
self.__tag_dump_match_idx = None
114-
self.__matched_stack_uas = False
115-
self.__offsets = []
116112

117113
def enable_html(self, enable):
118114
self.__html = enable
@@ -315,34 +311,6 @@ class Symbolizer:
315311
if match:
316312
self.__last_access_tag = int(match.group(2), 16)
317313

318-
def process_tag_dump_line(self, line, ignore_tags=False):
319-
m = re.match(r'.*?(0x[0-9a-f]+):' + '([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
320-
if m is None:
321-
return False
322-
addr = m.group(1)
323-
tags = m.group(*range(2, 18))
324-
fault = [i for i, x in enumerate(tags) if '[' in x]
325-
if fault:
326-
self.__tag_dump_match_idx = len(self.__tag_dump) + fault[0]
327-
self.__tag_dump.extend(int(x.strip(' [').rstrip('] '), 16) for x in tags)
328-
return True
329-
330-
def finish_tag_dump(self):
331-
if self.__matched_stack_uas or self.__tag_dump_match_idx is None:
332-
return
333-
for offset, size, local in sorted(self.__offsets, key=lambda x: abs(x[0])):
334-
idx = self.__tag_dump_match_idx - offset // 16
335-
if idx < 0 or idx > len(self.__tag_dump):
336-
continue
337-
if self.__tag_dump[idx] == self.__last_access_tag:
338-
self.print('')
339-
self.print('Potentially referenced stack object:')
340-
if offset > 0:
341-
self.print(' %d bytes after a variable "%s" in stack frame of function "%s"' % (offset - size, local[2], local[0]))
342-
if offset < 0:
343-
self.print(' %d bytes before a variable "%s" in stack frame of function "%s"' % (-offset, local[2], local[0]))
344-
self.print(' at %s' % (local[1],))
345-
346314
def process_stack_history(self, line, ignore_tags=False):
347315
if self.__last_access_address is None or self.__last_access_tag is None:
348316
return
@@ -368,18 +336,16 @@ class Symbolizer:
368336
size = local[4]
369337
if frame_offset is None or size is None:
370338
continue
371-
obj_offset = (self.__last_access_address & fp_mask) - (fp & fp_mask + frame_offset)
339+
obj_offset = (self.__last_access_address - fp - frame_offset) & fp_mask
340+
if obj_offset >= size:
341+
continue
372342
tag_offset = local[5]
373343
if not ignore_tags and (tag_offset is None or base_tag ^ tag_offset != self.__last_access_tag):
374344
continue
375-
if obj_offset < 0 or obj_offset >= size:
376-
self.__offsets.append((obj_offset, size, local))
377-
continue
378345
self.print('')
379346
self.print('Potentially referenced stack object:')
380347
self.print(' %d bytes inside a variable "%s" in stack frame of function "%s"' % (obj_offset, local[2], local[0]))
381348
self.print(' at %s' % (local[1],))
382-
self.__matched_stack_uas = True
383349
return True
384350
return False
385351

@@ -490,18 +456,9 @@ def main():
490456
sys.exit(1)
491457
symbolizer.read_linkify(args.linkify)
492458

493-
tag_dump = False
494459
for line in sys.stdin:
495460
if sys.version_info.major < 3:
496461
line = line.decode('utf-8')
497-
if tag_dump:
498-
tag_dump = symbolizer.process_tag_dump_line(line)
499-
if tag_dump:
500-
continue
501-
symbolizer.finish_tag_dump()
502-
if 'Memory tags around the buggy address' in line:
503-
tag_dump = True
504-
505462
symbolizer.save_access_address(line)
506463
if symbolizer.process_stack_history(line, ignore_tags=args.ignore_tags):
507464
continue

compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)