linux/arch/x86/net
Menglong Dong ae4a3160d1 bpf: specify the old and new poke_type for bpf_arch_text_poke
In the origin logic, the bpf_arch_text_poke() assume that the old and new
instructions have the same opcode. However, they can have different opcode
if we want to replace a "call" insn with a "jmp" insn.

Therefore, add the new function parameter "old_t" along with the "new_t",
which are used to indicate the old and new poke type. Meanwhile, adjust
the implement of bpf_arch_text_poke() for all the archs.

"BPF_MOD_NOP" is added to make the code more readable. In
bpf_arch_text_poke(), we still check if the new and old address is NULL to
determine if nop insn should be used, which I think is more safe.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Link: https://lore.kernel.org/r/20251118123639.688444-6-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2025-11-24 09:47:03 -08:00
..
Makefile bpf, x86: Add x86 JIT support for timed may_goto 2025-03-15 11:48:28 -07:00
bpf_jit_comp.c bpf: specify the old and new poke_type for bpf_arch_text_poke 2025-11-24 09:47:03 -08:00
bpf_jit_comp32.c bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro() 2024-03-14 19:28:52 -07:00
bpf_timed_may_goto.S bpf, x86: Fix objtool warning for timed may_goto 2025-03-15 15:55:14 -07:00