bpf: Fix extable fixup offset.
authorAlexei Starovoitov <ast@kernel.org>
Thu, 16 Dec 2021 02:38:30 +0000 (18:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Dec 2021 08:32:45 +0000 (09:32 +0100)
commit9f55f2913ebda52c3d39222b1bd8597930726b15
tree92cbc99ae6e47a59806db0ecf8fa19be64dc4ff2
parentecd8ad3af6d5f5bbbde97370ae4f885ab7ac47e3
bpf: Fix extable fixup offset.

[ Upstream commit 433956e91200734d09958673a56df02d00a917c2 ]

The prog - start_of_ldx is the offset before the faulting ldx to the location
after it, so this will be used to adjust pt_regs->ip for jumping over it and
continuing, and with old temp it would have been fixed up to the wrong offset,
causing crash.

Fixes: 4c5de127598e ("bpf: Emit explicit NULL pointer checks for PROBE_LDX instructions.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/net/bpf_jit_comp.c