xref: /freebsd/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.h (revision cb14a3fe5122c879eae1fb480ed7ce82a699ddb6)
1 //===-- msan_chained_origin_depot.h -----------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of MemorySanitizer.
10 //
11 // A storage for chained origins.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MSAN_CHAINED_ORIGIN_DEPOT_H
15 #define MSAN_CHAINED_ORIGIN_DEPOT_H
16 
17 #include "sanitizer_common/sanitizer_common.h"
18 
19 namespace __msan {
20 
21 // Gets the statistic of the origin chain storage.
22 StackDepotStats ChainedOriginDepotGetStats();
23 
24 // Stores a chain with StackDepot ID here_id and previous chain ID prev_id.
25 // If successful, returns true and the new chain id new_id.
26 // If the same element already exists, returns false and sets new_id to the
27 // existing ID.
28 bool ChainedOriginDepotPut(u32 here_id, u32 prev_id, u32 *new_id);
29 
30 // Retrieves the stored StackDepot ID for the given origin ID.
31 u32 ChainedOriginDepotGet(u32 id, u32 *other);
32 
33 void ChainedOriginDepotBeforeFork();
34 void ChainedOriginDepotAfterFork(bool fork_child);
35 
36 }  // namespace __msan
37 
38 #endif  // MSAN_CHAINED_ORIGIN_DEPOT_H
39