cosmoss-jigu / witcher

SOSP'21 Witcher Artifact
9 stars 0 forks source link

Cirtical error: calculating of aligned address #3

Open iaoing opened 1 year ago

iaoing commented 1 year ago

Issue:

In Python, the result of int/int is the float type and the size is as same as the float in C/C++. However, the int type in Python is unbounded. Thus, conversion from floating point to integer may round or truncate as in C.

Affected code:

  1. Calculating of cache line aligned address: https://github.com/cosmoss-jigu/witcher/blob/ad69038cdcd4ac20f1bde38ebf7e6d9fd6999b36/replay/mem/cachenumbers.py#L8-L9

  2. calculating of atomic-size aligned address: https://github.com/cosmoss-jigu/witcher/blob/ad69038cdcd4ac20f1bde38ebf7e6d9fd6999b36/replay/mem/witchertrace.py#L43-L44

If the address starts with 0xf, the result is incorrect after the calculation.

Fixes:

aligned_addr = address // ALIGNMENT_NUM * ALIGNMENT_NUM