| 1 | //===-- msan_chained_origin_depot.cpp -------------------------------------===// |
|---|---|
| 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 | #include "msan_chained_origin_depot.h" |
| 15 | |
| 16 | #include "sanitizer_common/sanitizer_chained_origin_depot.h" |
| 17 | |
| 18 | namespace __msan { |
| 19 | |
| 20 | static ChainedOriginDepot chainedOriginDepot; |
| 21 | |
| 22 | StackDepotStats ChainedOriginDepotGetStats() { |
| 23 | return chainedOriginDepot.GetStats(); |
| 24 | } |
| 25 | |
| 26 | bool ChainedOriginDepotPut(u32 here_id, u32 prev_id, u32 *new_id) { |
| 27 | return chainedOriginDepot.Put(here_id, prev_id, new_id); |
| 28 | } |
| 29 | |
| 30 | u32 ChainedOriginDepotGet(u32 id, u32 *other) { |
| 31 | return chainedOriginDepot.Get(id, other); |
| 32 | } |
| 33 | |
| 34 | void ChainedOriginDepotBeforeFork() { chainedOriginDepot.LockBeforeFork(); } |
| 35 | |
| 36 | void ChainedOriginDepotAfterFork(bool fork_child) { |
| 37 | chainedOriginDepot.UnlockAfterFork(fork_child); |
| 38 | } |
| 39 | |
| 40 | } // namespace __msan |
| 41 |