Staging
v0.8.1
https://github.com/torvalds/linux
Raw File
Tip revision: d566ec94e63702a1bf83f43804b021a8f478a27b authored by dependabot[bot] on 02 November 2023, 21:52:54 UTC
build(deps): bump pip from 23.2.1 to 23.3 in /drivers/gpu/drm/ci/xfails
Tip revision: d566ec9
kfence.h
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef _ASM_RISCV_KFENCE_H
#define _ASM_RISCV_KFENCE_H

#include <linux/kfence.h>
#include <linux/pfn.h>
#include <asm-generic/pgalloc.h>
#include <asm/pgtable.h>

static inline bool arch_kfence_init_pool(void)
{
	return true;
}

static inline bool kfence_protect_page(unsigned long addr, bool protect)
{
	pte_t *pte = virt_to_kpte(addr);

	if (protect)
		set_pte(pte, __pte(pte_val(*pte) & ~_PAGE_PRESENT));
	else
		set_pte(pte, __pte(pte_val(*pte) | _PAGE_PRESENT));

	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);

	return true;
}

#endif /* _ASM_RISCV_KFENCE_H */
back to top