]> git.baikalelectronics.ru Git - kernel.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)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 23 May 2022 21:07:29 +0000 (23:07 +0200)
commit1ed3b676dc664751067c40c0c8e10e8424c4e0d1
tree699971170d11656aa2f2a15d9fce780edb856500
parent099a34bd65025c7588866e2e41dbe72f78f31f5f
bpf: Fill new bpf_prog_pack with illegal instructions

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: 0a066f82325a ("bpf: Introduce bpf_prog_pack allocator")
Fixes: d69eaf2dbc24 ("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
kernel/bpf/core.c