arm64: bpf: Don't use module memory for the BPF JIT CFI check.
Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev> Change-Id: Ibe2716d57a4cb3bab3fa9d89191f7bbe9e0adc1c
This commit is contained in:
committed by
Bruno Martins
parent
030d374eb9
commit
8e9cd82b78
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user