bpf: Enforce W^X for bpf trampoline
authorSong Liu <song@kernel.org>
Mon, 26 Sep 2022 18:47:39 +0000 (11:47 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 27 Sep 2022 03:40:43 +0000 (20:40 -0700)
commit5b0d1c7bd5722467960829af51d523f5a6ffd848
tree0967cb40ef2d0af8f6beab452a0ed72cb0640c52
parent19c02415da2345d0dda2b5c4495bc17cc14b18b5
bpf: Enforce W^X for bpf trampoline

Mark the trampoline as RO+X after arch_prepare_bpf_trampoline, so that
the trampoine follows W^X rule strictly. This will turn off warnings like

CPA refuse W^X violation: 8000000000000163 -> 0000000000000163 range: ...

Also remove bpf_jit_alloc_exec_page(), since it is not used any more.

Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20220926184739.3512547-3-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/trampoline.c