#include "msan.h"
#include "msan_chained_origin_depot.h"
#include "msan_origin.h"
#include "msan_poisoning.h"
#include "msan_report.h"
#include "msan_thread.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_procmaps.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
#include "ubsan/ubsan_flags.h"
#include "ubsan/ubsan_init.h"
usingnamespace__sanitizer;
static THREADLOCAL int msan_expect_umr = …;
static THREADLOCAL int msan_expected_umr_found = …;
SANITIZER_INTERFACE_ATTRIBUTE
THREADLOCAL u64 __msan_param_tls[kMsanParamTlsSize / sizeof(u64)];
SANITIZER_INTERFACE_ATTRIBUTE
THREADLOCAL u32 __msan_param_origin_tls[kMsanParamTlsSize / sizeof(u32)];
SANITIZER_INTERFACE_ATTRIBUTE
THREADLOCAL u64 __msan_retval_tls[kMsanRetvalTlsSize / sizeof(u64)];
SANITIZER_INTERFACE_ATTRIBUTE
THREADLOCAL u32 __msan_retval_origin_tls;
alignas(16) SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u64
__msan_va_arg_tls[kMsanParamTlsSize / sizeof(u64)];
alignas(16) SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u32
__msan_va_arg_origin_tls[kMsanParamTlsSize / sizeof(u32)];
SANITIZER_INTERFACE_ATTRIBUTE
THREADLOCAL u64 __msan_va_arg_overflow_size_tls;
SANITIZER_INTERFACE_ATTRIBUTE
THREADLOCAL u32 __msan_origin_tls;
extern "C" SANITIZER_WEAK_ATTRIBUTE const int __msan_track_origins;
int __msan_get_track_origins() { … }
extern "C" SANITIZER_WEAK_ATTRIBUTE const int __msan_keep_going;
namespace __msan {
static THREADLOCAL int is_in_symbolizer_or_unwinder;
static void EnterSymbolizerOrUnwider() { … }
static void ExitSymbolizerOrUnwider() { … }
bool IsInSymbolizerOrUnwider() { … }
struct UnwinderScope { … };
static Flags msan_flags;
Flags *flags() { … }
int msan_inited = …;
bool msan_init_is_running;
int msan_report_count = …;
#if SANITIZER_PPC
static const uptr kNumStackOriginDescrs = 1 * 1024 * 1024;
#else
static const uptr kNumStackOriginDescrs = …;
#endif
static const char *StackOriginDescr[kNumStackOriginDescrs];
static uptr StackOriginPC[kNumStackOriginDescrs];
static atomic_uint32_t NumStackOriginDescrs;
void Flags::SetDefaults() { … }
class FlagHandlerKeepGoing final : public FlagHandlerBase { … };
static void RegisterMsanFlags(FlagParser *parser, Flags *f) { … }
static void InitializeFlags() { … }
void PrintWarningWithOrigin(uptr pc, uptr bp, u32 origin) { … }
void UnpoisonParam(uptr n) { … }
void ScopedThreadLocalStateBackup::Backup() { … }
void ScopedThreadLocalStateBackup::Restore() { … }
void UnpoisonThreadLocalState() { … }
const char *GetStackOriginDescr(u32 id, uptr *pc) { … }
u32 ChainOrigin(u32 id, StackTrace *stack) { … }
static inline void SetAllocaOrigin(void *a, uptr size, u32 *id_ptr, char *descr,
uptr pc) { … }
}
void __sanitizer::BufferedStackTrace::UnwindImpl(
uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) { … }
usingnamespace__msan;
#define MSAN_MAYBE_WARNING(type, size) …
MSAN_MAYBE_WARNING(u8, 1)
MSAN_MAYBE_WARNING(u16, 2)
MSAN_MAYBE_WARNING(u32, 4)
MSAN_MAYBE_WARNING(u64, 8)
#define MSAN_MAYBE_STORE_ORIGIN(type, size) …
MSAN_MAYBE_STORE_ORIGIN(u8, 1)
MSAN_MAYBE_STORE_ORIGIN(u16, 2)
MSAN_MAYBE_STORE_ORIGIN(u32, 4)
MSAN_MAYBE_STORE_ORIGIN(u64, 8)
void __msan_warning() { … }
void __msan_warning_noreturn() { … }
void __msan_warning_with_origin(u32 origin) { … }
void __msan_warning_with_origin_noreturn(u32 origin) { … }
static void OnStackUnwind(const SignalContext &sig, const void *,
BufferedStackTrace *stack) { … }
static void MsanOnDeadlySignal(int signo, void *siginfo, void *context) { … }
static void CheckUnwind() { … }
void __msan_init() { … }
void __msan_set_keep_going(int keep_going) { … }
void __msan_set_expect_umr(int expect_umr) { … }
void __msan_print_shadow(const void *x, uptr size) { … }
void __msan_dump_shadow(const void *x, uptr size) { … }
sptr __msan_test_shadow(const void *x, uptr size) { … }
void __msan_check_mem_is_initialized(const void *x, uptr size) { … }
int __msan_set_poison_in_malloc(int do_poison) { … }
int __msan_has_dynamic_component() { … }
NOINLINE
void __msan_clear_on_return() { … }
void __msan_partial_poison(const void* data, void* shadow, uptr size) { … }
void __msan_load_unpoisoned(const void *src, uptr size, void *dst) { … }
void __msan_set_origin(const void *a, uptr size, u32 origin) { … }
void __msan_set_alloca_origin(void *a, uptr size, char *descr) { … }
void __msan_set_alloca_origin4(void *a, uptr size, char *descr, uptr pc) { … }
void __msan_set_alloca_origin_with_descr(void *a, uptr size, u32 *id_ptr,
char *descr) { … }
void __msan_set_alloca_origin_no_descr(void *a, uptr size, u32 *id_ptr) { … }
u32 __msan_chain_origin(u32 id) { … }
u32 __msan_get_origin(const void *a) { … }
int __msan_origin_is_descendant_or_same(u32 this_id, u32 prev_id) { … }
u32 __msan_get_umr_origin() { … }
u16 __sanitizer_unaligned_load16(const uu16 *p) { … }
u32 __sanitizer_unaligned_load32(const uu32 *p) { … }
u64 __sanitizer_unaligned_load64(const uu64 *p) { … }
void __sanitizer_unaligned_store16(uu16 *p, u16 x) { … }
void __sanitizer_unaligned_store32(uu32 *p, u32 x) { … }
void __sanitizer_unaligned_store64(uu64 *p, u64 x) { … }
void __msan_set_death_callback(void (*callback)(void)) { … }
void __msan_start_switch_fiber(const void *bottom, uptr size) { … }
void __msan_finish_switch_fiber(const void **bottom_old, uptr *size_old) { … }
SANITIZER_INTERFACE_WEAK_DEF(const char *, __msan_default_options, void) { … }
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_print_stack_trace() { … }
}