Path: blob/main/contrib/llvm-project/compiler-rt/lib/tysan/tysan.h
213766 views
//===-- tysan.h -------------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of TypeSanitizer.9//10// Private TySan header.11//===----------------------------------------------------------------------===//1213#ifndef TYSAN_H14#define TYSAN_H1516#include "sanitizer_common/sanitizer_internal_defs.h"1718using __sanitizer::sptr;19using __sanitizer::u16;20using __sanitizer::uptr;2122#include "tysan_platform.h"2324extern "C" {25void tysan_set_type_unknown(const void *addr, uptr size);26void tysan_copy_types(const void *daddr, const void *saddr, uptr size);27}2829namespace __tysan {30extern bool tysan_inited;31extern bool tysan_init_is_running;3233void InitializeInterceptors();3435enum { TYSAN_MEMBER_TD = 1, TYSAN_STRUCT_TD = 2 };3637struct tysan_member_type_descriptor {38struct tysan_type_descriptor *Base;39struct tysan_type_descriptor *Access;40uptr Offset;41};4243struct tysan_struct_type_descriptor {44uptr MemberCount;45struct {46struct tysan_type_descriptor *Type;47uptr Offset;48} Members[1]; // Tail allocated.49};5051struct tysan_type_descriptor {52uptr Tag;53union {54tysan_member_type_descriptor Member;55tysan_struct_type_descriptor Struct;56};57};5859inline tysan_type_descriptor **shadow_for(const void *ptr) {60return (tysan_type_descriptor **)((((uptr)ptr) & AppMask()) * sizeof(ptr) +61ShadowAddr());62}6364struct Flags {65#define TYSAN_FLAG(Type, Name, DefaultValue, Description) Type Name;66#include "tysan_flags.inc"67#undef TYSAN_FLAG6869void SetDefaults();70};7172extern Flags flags_data;73inline Flags &flags() { return flags_data; }7475} // namespace __tysan7677#endif // TYSAN_H787980