xref: /freebsd/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_poisoning.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10b57cec5SDimitry Andric //===-- hwasan_poisoning.cpp ------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file is a part of HWAddressSanitizer.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #include "hwasan_poisoning.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #include "hwasan_mapping.h"
160b57cec5SDimitry Andric #include "interception/interception.h"
170b57cec5SDimitry Andric #include "sanitizer_common/sanitizer_common.h"
180b57cec5SDimitry Andric #include "sanitizer_common/sanitizer_linux.h"
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric namespace __hwasan {
210b57cec5SDimitry Andric 
TagMemory(uptr p,uptr size,tag_t tag)220b57cec5SDimitry Andric uptr TagMemory(uptr p, uptr size, tag_t tag) {
230b57cec5SDimitry Andric   uptr start = RoundDownTo(p, kShadowAlignment);
240b57cec5SDimitry Andric   uptr end = RoundUpTo(p + size, kShadowAlignment);
250b57cec5SDimitry Andric   return TagMemoryAligned(start, end - start, tag);
260b57cec5SDimitry Andric }
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric }  // namespace __hwasan
29*bdd1243dSDimitry Andric 
30*bdd1243dSDimitry Andric // --- Implementation of LSan-specific functions --- {{{1
31*bdd1243dSDimitry Andric namespace __lsan {
WordIsPoisoned(uptr addr)32*bdd1243dSDimitry Andric bool WordIsPoisoned(uptr addr) {
33*bdd1243dSDimitry Andric   // Fixme: implement actual tag checking.
34*bdd1243dSDimitry Andric   return false;
35*bdd1243dSDimitry Andric }
36*bdd1243dSDimitry Andric }  // namespace __lsan
37