HomePhabricator

Hwasan reporting check for dladdr failing

Authored by mmalcomson on Nov 12 2020, 4:37 AM.

Description

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

Details

Committed
mmalcomsonNov 16 2020, 4:25 AM
Differential Revision
D91344: [hwasan] Handle possible failure of dladdr
Parents
rG6c185acfffc1: Revert "Move the test compiler setup in a common place. NFCI"
Branches
Unknown
Tags
Unknown