xref: /freebsd/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_poisoning.cpp (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1 //===-- hwasan_poisoning.cpp ------------------------------------*- 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 HWAddressSanitizer.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "hwasan_poisoning.h"
14 
15 #include "hwasan_mapping.h"
16 #include "interception/interception.h"
17 #include "sanitizer_common/sanitizer_common.h"
18 #include "sanitizer_common/sanitizer_linux.h"
19 
20 namespace __hwasan {
21 
22 uptr TagMemory(uptr p, uptr size, tag_t tag) {
23   uptr start = RoundDownTo(p, kShadowAlignment);
24   uptr end = RoundUpTo(p + size, kShadowAlignment);
25   return TagMemoryAligned(start, end - start, tag);
26 }
27 
28 }  // namespace __hwasan
29