[PATCH] D95734: Use alias analysis to remove redundant instrumentation for Asan

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 10:49:36 PST 2021


eugenis added a comment.

This is what Vitaly is talking about:

  __attribute__((noinline)) void deallocate(void *p) {
    free(p);
  }
  
  int main(int argc, char **argv) {
    int *p = (int *)malloc(sizeof(int));
    *p = 42;
    deallocate(p);
    return *p;
  }

Your optimization is missing the bug. Any call to a function without the "nofree" attribute needs to forget about the earlier checks.

In general, optimizations like this are dangerous because there is no good test set for memory bugs. We could be missing bugs left and right and will never notice...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95734/new/

https://reviews.llvm.org/D95734



More information about the llvm-commits mailing list