]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, x86: Fall back to interpreter mode when extra pass fails
authorHou Tao <houtao1@huawei.com>
Wed, 9 Mar 2022 12:33:18 +0000 (20:33 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 16 Mar 2022 22:12:18 +0000 (15:12 -0700)
commit40d26c7f55b17a2a48178851bbb48d4b1e0d7453
tree137bebfa791a5058aa800f7a4a6d7b9081bbe6d0
parent6f41da35d5ea7b94724e842787d9fc786fe24a3c
bpf, x86: Fall back to interpreter mode when extra pass fails

Extra pass for subprog jit may fail (e.g. due to bpf_jit_harden race),
but bpf_func is not cleared for the subprog and jit_subprogs will
succeed. The running of the bpf program may lead to oops because the
memory for the jited subprog image has already been freed.

So fall back to interpreter mode by clearing bpf_func/jited/jited_len
when extra pass fails.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220309123321.2400262-2-houtao1@huawei.com
arch/x86/net/bpf_jit_comp.c