[all-commits] [llvm/llvm-project] 4f42e1: [hwasan] Omit tag check for null pointers (#122206)

Thurston Dang via All-commits all-commits at lists.llvm.org
Thu Jan 9 13:48:47 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4f42e165164ba2bfca7b87be2a533ef09e8777e0
      https://github.com/llvm/llvm-project/commit/4f42e165164ba2bfca7b87be2a533ef09e8777e0
  Author: Thurston Dang <thurston at google.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
    M llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
    M llvm/test/CodeGen/AArch64/hwasan-zero-ptr.ll
    M llvm/test/Instrumentation/HWAddressSanitizer/zero-ptr.ll

  Log Message:
  -----------
  [hwasan] Omit tag check for null pointers (#122206)

If the pointer to be checked is statically known to be zero, the tag
check will always pass since:
1) the tag is zero
2) shadow memory for address 0 is initialized to 0 and never updated.
We can therefore elide the tag check.

We perform the elision in two places:
1) the HWASan pass
2) when lowering the CHECK_MEMACCESS intrinsic. Conceivably, the HWASan
pass may encounter a "cannot currently statically prove to be null"
pointer (and is therefore unable to omit the intrinsic) that later
optimization passes convert into a statically known-null pointer. As a
last line of defense, we perform elision here too.

This also updates the tests from
https://github.com/llvm/llvm-project/pull/122186



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list