kfence.h 680 B

1234567891011121314151617181920212223242526272829303132
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * arm64 KFENCE support.
  4. *
  5. * Copyright (C) 2020, Google LLC.
  6. */
  7. #ifndef __ASM_KFENCE_H
  8. #define __ASM_KFENCE_H
  9. #include <asm/set_memory.h>
  10. static inline bool arch_kfence_init_pool(void) { return true; }
  11. static inline bool kfence_protect_page(unsigned long addr, bool protect)
  12. {
  13. set_memory_valid(addr, 1, !protect);
  14. return true;
  15. }
  16. #ifdef CONFIG_KFENCE
  17. extern bool kfence_early_init;
  18. static inline bool arm64_kfence_can_set_direct_map(void)
  19. {
  20. return !kfence_early_init;
  21. }
  22. #else /* CONFIG_KFENCE */
  23. static inline bool arm64_kfence_can_set_direct_map(void) { return false; }
  24. #endif /* CONFIG_KFENCE */
  25. #endif /* __ASM_KFENCE_H */