[all-commits] [llvm/llvm-project] 83ac18: Hwasan reporting check for dladdr failing

mmalcomson via All-commits all-commits at lists.llvm.org
Mon Nov 16 04:26:52 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 83ac18205ec69a00ac2be3b603bc3a61293fbe89
      https://github.com/llvm/llvm-project/commit/83ac18205ec69a00ac2be3b603bc3a61293fbe89
  Author: Matthew Malcomson <matthew.malcomson at arm.com>
  Date:   2020-11-16 (Mon, 16 Nov 2020)

  Changed paths:
    M compiler-rt/lib/hwasan/hwasan_report.cpp

  Log Message:
  -----------
  Hwasan reporting check for dladdr failing

In `GetGlobalSizeFromDescriptor` we use `dladdr` to get info on the the
current address.  `dladdr` returns 0 if it failed.
During testing on Linux this returned 0 to indicate failure, and
populated the `info` structure with a NULL pointer which was
dereferenced later.

This patch checks for `dladdr` returning 0, and in that case returns 0
from `GetGlobalSizeFromDescriptor` to indicate failure of identifying
the address.

This occurs when `GetModuleNameAndOffsetForPC` succeeds for some address
not in a dynamically loaded library.  One example is when the found
"module" is '[stack]' having come from parsing /proc/self/maps.

Differential Revision: https://reviews.llvm.org/D91344




More information about the All-commits mailing list