Path: blob/main/contrib/llvm-project/compiler-rt/lib/msan/msan_poisoning.h
35262 views
//===-- msan_poisoning.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 MemorySanitizer.9//10//===----------------------------------------------------------------------===//1112#ifndef MSAN_POISONING_H13#define MSAN_POISONING_H1415#include "msan.h"1617namespace __msan {1819// Return origin for the first poisoned byte in the memory range, or 0.20u32 GetOriginIfPoisoned(uptr addr, uptr size);2122// Walk [addr, addr+size) app memory region, copying origin tags from the23// corresponding positions in [src_origin, src_origin+size) where the24// corresponding shadow in [src_shadow, src_shadow+size) is non-zero.25void SetOriginIfPoisoned(uptr addr, uptr src_shadow, uptr size, u32 src_origin);2627// Copy origin from src (app address) to dst (app address), creating chained28// origin ids as necessary, without overriding origin for fully initialized29// quads.30void CopyOrigin(const void *dst, const void *src, uptr size, StackTrace *stack);3132// memmove() shadow and origin. Dst and src are application addresses.33// See CopyOrigin() for the origin copying logic.34void MoveShadowAndOrigin(const void *dst, const void *src, uptr size,35StackTrace *stack);3637// memcpy() shadow and origin. Dst and src are application addresses.38// See CopyOrigin() for the origin copying logic.39void CopyShadowAndOrigin(const void *dst, const void *src, uptr size,40StackTrace *stack);4142// memcpy() app memory, and do "the right thing" to the corresponding shadow and43// origin regions.44void CopyMemory(void *dst, const void *src, uptr size, StackTrace *stack);4546// Fill shadow will value. Ptr is an application address.47void SetShadow(const void *ptr, uptr size, u8 value);4849// Set origin for the memory region.50void SetOrigin(const void *dst, uptr size, u32 origin);5152// Mark memory region uninitialized, with origins.53void PoisonMemory(const void *dst, uptr size, StackTrace *stack);5455} // namespace __msan5657#endif // MSAN_POISONING_H585960