Skip to content

Commit fd18417

Browse files
vincentmliKernel Patches Daemon
authored andcommitted
bpf, x86: No bpf_arch_text_poke() for kernel text
kernel function replies on ftrace to poke kernel functions. Signed-off-by: Vincent Li <[email protected]>
1 parent 1a8f119 commit fd18417

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/x86/net/bpf_jit_comp.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,12 @@ static int __bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
643643
int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
644644
void *old_addr, void *new_addr)
645645
{
646-
if (!is_kernel_text((long)ip) &&
647-
!is_bpf_text_address((long)ip))
648-
/* BPF poking in modules is not supported */
649-
return -EINVAL;
646+
if (!is_bpf_text_address((long)ip))
647+
/* Only poking bpf text is supported. Since kernel function
648+
* entry is set up by ftrace, we reply on ftrace to poke kernel
649+
* functions. BPF poking in modules is not supported.
650+
*/
651+
return -ENOTSUPP;
650652

651653
/*
652654
* See emit_prologue(), for IBT builds the trampoline hook is preceded

0 commit comments

Comments
 (0)