libsanitizer: cherry-pick commit b226894d475b from upstream