[all-commits] [llvm/llvm-project] 43aa6e: [hwasan] Fixing false invalid-free with disabled t...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Fri Sep 22 13:35:48 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 43aa6e6bf3d5ca1dde3e839f4c6ebd0e524055a1
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2023-09-22 (Fri, 22 Sep 2023)

  Changed paths:
    M compiler-rt/lib/hwasan/hwasan_allocator.cpp
    A compiler-rt/test/hwasan/TestCases/enable-disable.c

  Log Message:
  [hwasan] Fixing false invalid-free with disabled tagging (#67169)

This problem was accidentally discovered by the internal symbolizer, but
it's relevant for external one as well, see the test.

If we just disable tagging, there may still be tagged allocations that
have already been freed. After disabling tagging, these tagged
allocations can be released to the user as-is, which would later break
the "invalid-free" check.

We cannot just disable the "invalid-free" check with disabled tagging,
because if we re-enable tagging, the issue still applies to allocations
created when it was disabled.

The fix is to continue tagging with zero even if tagging is disabled.

This makes the "disabled" mode less efficient, but this is not the
primary use case.

More information about the All-commits mailing list