]> www.infradead.org Git - users/dwmw2/linux.git/commit
bpf: Fill new bpf_prog_pack with illegal instructions
authorSong Liu <song@kernel.org>
Fri, 20 May 2022 23:57:51 +0000 (16:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 06:48:59 +0000 (08:48 +0200)
commit8da0d2d056beaff23e12e543f6828f7c61e02d52
tree69d011b32a34e9f2d28678a128b3e354a12a7151
parente8020d96dd5b2dcc1f6a8ee4f87a53a373002cd5
bpf: Fill new bpf_prog_pack with illegal instructions

commit d88bb5eed04ce50cc20e7f9282977841728be798 upstream.

bpf_prog_pack enables sharing huge pages among multiple BPF programs.
These pages are marked as executable before the JIT engine fill it with
BPF programs. To make these pages safe, fill the hole bpf_prog_pack with
illegal instructions before making it executable.

Fixes: 57631054fae6 ("bpf: Introduce bpf_prog_pack allocator")
Fixes: 33c9805860e5 ("bpf: Introduce bpf_jit_binary_pack_[alloc|finalize|free]")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220520235758.1858153-2-song@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/core.c