Skip to content

Commit

Permalink
bpf: Eliminate CONFIG_MODULES limitation from JIT for arm64
Browse files Browse the repository at this point in the history
CONFIG_MODULES is only needed for its memory allocator, which is trivial
to add back into arm64 when modules aren't enabled. Do so in order to
take advantage of JIT compilation when CONFIG_MODULES=n.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: atndko <z1281552865@gmail.com>
Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
  • Loading branch information
kerneltoast authored and Hadenix committed Feb 2, 2024
1 parent a0db1c5 commit 6d119bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm64/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ccflags-y += -Ikernel/sched/
arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
entry-fpsimd.o process.o ptrace.o setup.o signal.o \
sys.o stacktrace.o time.o traps.o io.o vdso.o \
hyp-stub.o psci.o cpu_ops.o insn.o \
hyp-stub.o psci.o cpu_ops.o insn.o module.o \
return_address.o cpuinfo.o cpu_errata.o \
cpufeature.o alternative.o cacheinfo.o \
smp.o smp_spin_table.o topology.o smccc-call.o
Expand All @@ -37,7 +37,7 @@ arm64-obj-$(CONFIG_COMPAT) += sigreturn32.o
endif
arm64-obj-$(CONFIG_KUSER_HELPERS) += kuser32.o
arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o
arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o
arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o
arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
Expand Down
9 changes: 9 additions & 0 deletions arch/arm64/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <asm/insn.h>
#include <asm/sections.h>

#if defined(CONFIG_MODULES) || defined(CONFIG_BPF_JIT)
void *module_alloc(unsigned long size)
{
void *p;
Expand Down Expand Up @@ -66,6 +67,13 @@ void *module_alloc(unsigned long size)
return p;
}

void module_memfree(void *module_region)
{
vfree(module_region);
}
#endif /* CONFIG_MODULES || CONFIG_BPF_JIT */

#ifdef CONFIG_MODULES
enum aarch64_reloc_op {
RELOC_OP_NONE,
RELOC_OP_ABS,
Expand Down Expand Up @@ -425,3 +433,4 @@ int module_finalize(const Elf_Ehdr *hdr,

return 0;
}
#endif /* CONFIG_MODULES */

0 comments on commit 6d119bc

Please sign in to comment.