2012-08-29 10:27:54 +08:00
|
|
|
//===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===//
|
2012-06-05 21:50:57 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2013-01-30 21:12:08 +08:00
|
|
|
// Common part of the public sanitizer interface.
|
2012-06-05 21:50:57 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-08-29 10:27:54 +08:00
|
|
|
#ifndef SANITIZER_COMMON_INTERFACE_DEFS_H
|
|
|
|
#define SANITIZER_COMMON_INTERFACE_DEFS_H
|
2012-06-05 21:50:57 +08:00
|
|
|
|
2013-01-30 21:12:08 +08:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
2012-06-05 21:50:57 +08:00
|
|
|
|
[asan] make asan work with 7fff8000 offset and prelink
When prelink is installed in the system, prelink-ed
libraries map between 0x003000000000 and 0x004000000000 thus occupying the shadow Gap,
so we need so split the address space even further, like this:
|| [0x10007fff8000, 0x7fffffffffff] || HighMem ||
|| [0x02008fff7000, 0x10007fff7fff] || HighShadow ||
|| [0x004000000000, 0x02008fff6fff] || ShadowGap3 ||
|| [0x003000000000, 0x003fffffffff] || MidMem ||
|| [0x00087fff8000, 0x002fffffffff] || ShadowGap2 ||
|| [0x00067fff8000, 0x00087fff7fff] || MidShadow ||
|| [0x00008fff7000, 0x00067fff7fff] || ShadowGap ||
|| [0x00007fff8000, 0x00008fff6fff] || LowShadow ||
|| [0x000000000000, 0x00007fff7fff] || LowMem ||
Do it only if necessary.
Also added a bit of profiling code to make sure that the
mapping code is efficient.
Added a lit test to simulate prelink-ed libraries.
Unfortunately, this test does not work with binutils-gold linker.
If gold is the default linker the test silently passes.
Also replaced
__has_feature(address_sanitizer)
with
__has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
in two places.
Patch partially by Jakub Jelinek.
llvm-svn: 175263
2013-02-15 20:00:24 +08:00
|
|
|
// GCC does not understand __has_feature.
|
|
|
|
#if !defined(__has_feature)
|
|
|
|
# define __has_feature(x) 0
|
|
|
|
#endif
|
|
|
|
|
2013-01-30 21:12:08 +08:00
|
|
|
#ifdef __cplusplus
|
2012-09-14 12:35:14 +08:00
|
|
|
extern "C" {
|
2013-01-30 21:12:08 +08:00
|
|
|
#endif
|
2012-09-14 12:35:14 +08:00
|
|
|
// Tell the tools to write their reports to "path.<pid>" instead of stderr.
|
2013-01-30 21:12:08 +08:00
|
|
|
void __sanitizer_set_report_path(const char *path);
|
2012-11-02 17:23:36 +08:00
|
|
|
|
|
|
|
// Tell the tools to write their reports to given file descriptor instead of
|
|
|
|
// stderr.
|
2013-01-30 21:12:08 +08:00
|
|
|
void __sanitizer_set_report_fd(int fd);
|
2012-12-10 21:10:40 +08:00
|
|
|
|
|
|
|
// Notify the tools that the sandbox is going to be turned on. The reserved
|
|
|
|
// parameter will be used in the future to hold a structure with functions
|
|
|
|
// that the tools may call to bypass the sandbox.
|
2013-01-30 21:12:08 +08:00
|
|
|
void __sanitizer_sandbox_on_notify(void *reserved);
|
|
|
|
|
2013-02-06 20:36:49 +08:00
|
|
|
// This function is called by the tool when it has just finished reporting
|
|
|
|
// an error. 'error_summary' is a one-line string that summarizes
|
|
|
|
// the error message. This function can be overridden by the client.
|
|
|
|
void __sanitizer_report_error_summary(const char *error_summary);
|
|
|
|
|
2013-01-30 21:12:08 +08:00
|
|
|
#ifdef __cplusplus
|
2012-09-14 12:35:14 +08:00
|
|
|
} // extern "C"
|
2013-01-30 21:12:08 +08:00
|
|
|
#endif
|
2012-09-14 12:35:14 +08:00
|
|
|
|
2012-08-29 10:27:54 +08:00
|
|
|
#endif // SANITIZER_COMMON_INTERFACE_DEFS_H
|