Skip to content

Commit

Permalink
kernel: Sort debug logs for reproducibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mebeim committed May 27, 2024
1 parent 2527e3b commit 41c4567
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/systrack/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ def __extract_syscalls(self) -> List[Syscall]:
preferred_logs = []

# Create a mapping vaddr -> symbol for every vaddr in the syscall table
# for convenience. Sort symbols by name to generate reproducible results
# and logs.
# for convenience. Sort symbols by name for reproducible results. We
# look at .symbols instead of .functions here because (of course) some
# of these symbols may not be classified as FUNC.
for sym in sorted(self.vmlinux.symbols.values(), key=attrgetter('name')):
vaddr = sym.vaddr
if vaddr not in seen:
Expand All @@ -364,6 +365,11 @@ def __extract_syscalls(self) -> List[Syscall]:

symbols_by_vaddr[vaddr] = sym

# Sort logs for reproducible output (the above sorting does not
# guarantee that these are sorted as well).
discarded_logs.sort()
preferred_logs.sort()

for sym, other in discarded_logs:
logging.debug('Discarding %s as alias for %s', sym, other)

Expand Down

0 comments on commit 41c4567

Please sign in to comment.