forked from OSchip/llvm-project
parent
a6c4a387ee
commit
84c7e47b5c
|
@ -28,11 +28,6 @@ extern "C" {
|
||||||
// before any instrumented code is executed and before any call to malloc.
|
// before any instrumented code is executed and before any call to malloc.
|
||||||
void __asan_init() SANITIZER_INTERFACE_ATTRIBUTE;
|
void __asan_init() SANITIZER_INTERFACE_ATTRIBUTE;
|
||||||
|
|
||||||
// This function should be called by the instrumented code.
|
|
||||||
// 'addr' is the address of a global variable called 'name' of 'size' bytes.
|
|
||||||
void __asan_register_global(uptr addr, uptr size, const char *name)
|
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE;
|
|
||||||
|
|
||||||
// This structure describes an instrumented global variable.
|
// This structure describes an instrumented global variable.
|
||||||
struct __asan_global {
|
struct __asan_global {
|
||||||
uptr beg; // The address of the global.
|
uptr beg; // The address of the global.
|
||||||
|
|
|
@ -55,11 +55,6 @@ void PoisonRedZones(const Global &g) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uptr GetAlignedSize(uptr size) {
|
|
||||||
return ((size + kGlobalAndStackRedzone - 1) / kGlobalAndStackRedzone)
|
|
||||||
* kGlobalAndStackRedzone;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DescribeAddressIfGlobal(uptr addr) {
|
bool DescribeAddressIfGlobal(uptr addr) {
|
||||||
if (!flags()->report_globals) return false;
|
if (!flags()->report_globals) return false;
|
||||||
BlockingMutexLock lock(&mu_for_globals);
|
BlockingMutexLock lock(&mu_for_globals);
|
||||||
|
@ -142,19 +137,6 @@ static void UnpoisonGlobal(const Global *g) {
|
||||||
// ---------------------- Interface ---------------- {{{1
|
// ---------------------- Interface ---------------- {{{1
|
||||||
using namespace __asan; // NOLINT
|
using namespace __asan; // NOLINT
|
||||||
|
|
||||||
// Register one global with a default redzone.
|
|
||||||
void __asan_register_global(uptr addr, uptr size,
|
|
||||||
const char *name) {
|
|
||||||
if (!flags()->report_globals) return;
|
|
||||||
BlockingMutexLock lock(&mu_for_globals);
|
|
||||||
Global *g = (Global *)allocator_for_globals.Allocate(sizeof(Global));
|
|
||||||
g->beg = addr;
|
|
||||||
g->size = size;
|
|
||||||
g->size_with_redzone = GetAlignedSize(size) + kGlobalAndStackRedzone;
|
|
||||||
g->name = name;
|
|
||||||
RegisterGlobal(g);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register an array of globals.
|
// Register an array of globals.
|
||||||
void __asan_register_globals(__asan_global *globals, uptr n) {
|
void __asan_register_globals(__asan_global *globals, uptr n) {
|
||||||
if (!flags()->report_globals) return;
|
if (!flags()->report_globals) return;
|
||||||
|
|
|
@ -231,7 +231,6 @@ static NOINLINE void force_interface_symbols() {
|
||||||
case 8: __asan_report_store4(0); break;
|
case 8: __asan_report_store4(0); break;
|
||||||
case 9: __asan_report_store8(0); break;
|
case 9: __asan_report_store8(0); break;
|
||||||
case 10: __asan_report_store16(0); break;
|
case 10: __asan_report_store16(0); break;
|
||||||
case 11: __asan_register_global(0, 0, 0); break;
|
|
||||||
case 12: __asan_register_globals(0, 0); break;
|
case 12: __asan_register_globals(0, 0); break;
|
||||||
case 13: __asan_unregister_globals(0, 0); break;
|
case 13: __asan_unregister_globals(0, 0); break;
|
||||||
case 14: __asan_set_death_callback(0); break;
|
case 14: __asan_set_death_callback(0); break;
|
||||||
|
|
Loading…
Reference in New Issue