Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e9cd82b authored by Diab Neiroukh's avatar Diab Neiroukh Committed by Bruno Martins
Browse files

arm64: bpf: Don't use module memory for the BPF JIT CFI check.



Signed-off-by: default avatarDiab Neiroukh <lazerl0rd@thezest.dev>
Change-Id: Ibe2716d57a4cb3bab3fa9d89191f7bbe9e0adc1c
parent 030d374e
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -984,17 +984,10 @@ bool arch_bpf_jit_check_func(const struct bpf_prog *prog)

	/*
	 * bpf_func must be correctly aligned and within the correct region.
	 * module_alloc places JIT code in the module region, unless
	 * ARM64_MODULE_PLTS is enabled, in which case we might end up using
	 * the vmalloc region too.
	 */
	if (unlikely(!IS_ALIGNED(func, sizeof(u32))))
		return false;

	if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
			is_vmalloc_addr(prog->bpf_func))
		return true;

	return (func >= MODULES_VADDR && func < MODULES_END);
	return (func >= BPF_JIT_REGION_START && func < BPF_JIT_REGION_END);
}
#endif