diffkemp icon indicating copy to clipboard operation
diffkemp copied to clipboard

Comparing inline assemblies may produce false negative

Open viktormalik opened this issue 5 years ago • 2 comments

This may happen if the inline assemblies contain the same text but one of them is marked as sideeffect (due to using asm volatile when calling it). DiffKemp cannot detect this change since it only compares inline assemblies for equality of the asm string (only asm string is inserted into asmValueMap in FunctionAbstractionsGenerator).

This can be reproduced by disabling dead code elimination (pattern-cli-options branch), which removed just the non-side effect inline asm causing the difference to appear:

bin/diffkemp compare snapshots/linux-4.18.0-80.el8/ snapshots/linux-4.18.0-107.el8/ --show-diff --stdout -f dump_stack --disable-pattern dead-code

Also, the same issue might occur if only the constraint string of the inline asm differs.

viktormalik avatar Oct 25 '19 12:10 viktormalik

The solution must consider the fact that asmValueMap created in FunctionAbstractionsGenerator is used for displaying differences in the macros.

viktormalik avatar Oct 25 '19 12:10 viktormalik

The solution must consider the fact that asmValueMap created in FunctionAbstractionsGenerator is used for displaying differences in the macros.

Just to make this a little bit clearer - asmValueMap is used for displaying differences directly in the inline assembly code (i.e. enabled by the --print-asm-diffs option); debug information is used to display the corresponding macro difference.

lenticularis39 avatar Oct 25 '19 13:10 lenticularis39