All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Fix JIT of is_mov_percpu_addr instruction.
@ 2024-04-17 21:44 Alexei Starovoitov
  2024-04-18 16:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alexei Starovoitov @ 2024-04-17 21:44 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, martin.lau, eddyz87, kernel-team

From: Alexei Starovoitov <ast@kernel.org>

The codegen for is_mov_percpu_addr instruction works for rax/r8 registers
only. Fix it to generate proper x86 byte code for other registers.

Fixes: 7bdbf7446305 ("bpf: add special internal-only MOV instruction to resolve per-CPU addrs")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 arch/x86/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 2b5a475c4dd0..673fdbd765d7 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -1439,7 +1439,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, u8 *rw_image
 #ifdef CONFIG_SMP
 				/* add <dst>, gs:[<off>] */
 				EMIT2(0x65, add_1mod(0x48, dst_reg));
-				EMIT3(0x03, add_1reg(0x04, dst_reg), 0x25);
+				EMIT3(0x03, add_2reg(0x04, 0, dst_reg), 0x25);
 				EMIT((u32)(unsigned long)&this_cpu_off, 4);
 #endif
 				break;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] bpf: Fix JIT of is_mov_percpu_addr instruction.
  2024-04-17 21:44 [PATCH bpf-next] bpf: Fix JIT of is_mov_percpu_addr instruction Alexei Starovoitov
@ 2024-04-18 16:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-18 16:10 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: bpf, daniel, andrii, martin.lau, eddyz87, kernel-team

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Wed, 17 Apr 2024 14:44:06 -0700 you wrote:
> From: Alexei Starovoitov <ast@kernel.org>
> 
> The codegen for is_mov_percpu_addr instruction works for rax/r8 registers
> only. Fix it to generate proper x86 byte code for other registers.
> 
> Fixes: 7bdbf7446305 ("bpf: add special internal-only MOV instruction to resolve per-CPU addrs")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: Fix JIT of is_mov_percpu_addr instruction.
    https://git.kernel.org/bpf/bpf-next/c/462e5e2a5938

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-18 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 21:44 [PATCH bpf-next] bpf: Fix JIT of is_mov_percpu_addr instruction Alexei Starovoitov
2024-04-18 16:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.