hwasan_poisoning.cpp 945 B

12345678910111213141516171819202122232425262728
  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. #include "hwasan_poisoning.h"
  13. #include "hwasan_mapping.h"
  14. #include "interception/interception.h"
  15. #include "sanitizer_common/sanitizer_common.h"
  16. #include "sanitizer_common/sanitizer_linux.h"
  17. namespace __hwasan {
  18. uptr TagMemory(uptr p, uptr size, tag_t tag) {
  19. uptr start = RoundDownTo(p, kShadowAlignment);
  20. uptr end = RoundUpTo(p + size, kShadowAlignment);
  21. return TagMemoryAligned(start, end - start, tag);
  22. }
  23. } // namespace __hwasan