Thurston Dang 9095d5c44b Reland '[msan] Intercept dladdr1, and refactor dladdr'
Relanding with #if SANITIZER_GLIBC to avoid breaking FreeBSD.
Also incorporates Arthur's BUILD.gn fix (thanks!) from https://reviews.llvm.org/rGc1e283851772ba494113311405d48cfb883751d1

Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D154272
2023-07-11 20:05:54 +00:00

31 lines
864 B
C++

//===-- msan_dl.h ---------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of MemorySanitizer.
//
// Helper functions for unpoisoning results of dladdr and dladdr1.
//===----------------------------------------------------------------------===//
#ifndef MSAN_DL_H
#define MSAN_DL_H
#include "msan.h"
#include "sanitizer_common/sanitizer_common.h"
namespace __msan {
void UnpoisonDllAddrInfo(void *info);
#if SANITIZER_GLIBC
void UnpoisonDllAddr1ExtraInfo(void **extra_info, int flags);
#endif
} // namespace __msan
#endif // MSAN_DL_H