File Index
Files and directories
Sign in
FILE

kfence.h

File preview with syntax highlighting.

linux-6.19.14/arch/riscv/include/asm/kfence.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2
 3#ifndef _ASM_RISCV_KFENCE_H
 4#define _ASM_RISCV_KFENCE_H
 5
 6#include <linux/kfence.h>
 7#include <linux/pfn.h>
 8#include <asm-generic/pgalloc.h>
 9#include <asm/pgtable.h>
10
11static inline bool arch_kfence_init_pool(void)
12{
13	return true;
14}
15
16static inline bool kfence_protect_page(unsigned long addr, bool protect)
17{
18	pte_t *pte = virt_to_kpte(addr);
19
20	if (protect)
21		set_pte(pte, __pte(pte_val(ptep_get(pte)) & ~_PAGE_PRESENT));
22	else
23		set_pte(pte, __pte(pte_val(ptep_get(pte)) | _PAGE_PRESENT));
24
25	preempt_disable();
26	local_flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
27	preempt_enable();
28
29	return true;
30}
31
32#endif /* _ASM_RISCV_KFENCE_H */
~/ Read-only file preview.